rx-abi-functions.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* RX C ABI functions
  2. Copyright (C) 2009-2022 Free Software Foundation, Inc.
  3. Contributed by Red Hat.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3, or (at your option)
  8. any later version.
  9. GCC is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. Under Section 7 of GPL version 3, you are granted additional
  14. permissions described in the GCC Runtime Library Exception, version
  15. 3.1, as published by the Free Software Foundation.
  16. You should have received a copy of the GNU General Public License
  17. along with GCC; see the file COPYING3. If not see
  18. <http://www.gnu.org/licenses/>. */
  19. /* The RX C ABI includes the specification of a set of compiler support
  20. functions. Libgcc2 includes some of them, although the names have to
  21. be changed (see rx-abi.h), and the rest are defined here.
  22. FIXME: Given that FINE_GRAINED_LIBRARIES is defined we ought to consider
  23. compiling this file multiple times with one function per iteration being
  24. compiled. */
  25. #ifdef __RX_64BIT_DOUBLES__
  26. int _COM_CMPLTd (double a, double b) { return __ltdf2 (a, b) == -1; }
  27. int _COM_CMPGTd (double a, double b) { return __gtdf2 (a, b) == 1; }
  28. int _COM_CMPLEd (double a, double b) { return __ledf2 (a, b) != 1; }
  29. int _COM_CMPGEd (double a, double b) { return __gedf2 (a, b) != -1; }
  30. int _COM_CMPEQd (double a, double b) { return __eqdf2 (a, b) == 0; }
  31. int _COM_CMPNEd (double a, double b) { return __nedf2 (a, b) != 0; }
  32. int _COM_CMPLTf (double, double) __attribute__ ((weak, alias ("_COM_CMPLTd")));
  33. int _COM_CMPGTf (double, double) __attribute__ ((weak, alias ("_COM_CMPGTd")));
  34. int _COM_CMPLEf (double, double) __attribute__ ((weak, alias ("_COM_CMPLEd")));
  35. int _COM_CMPGEf (double, double) __attribute__ ((weak, alias ("_COM_CMPGEd")));
  36. int _COM_CMPEQf (double, double) __attribute__ ((weak, alias ("_COM_CMPEQd")));
  37. int _COM_CMPNEf (double, double) __attribute__ ((weak, alias ("_COM_CMPNEd")));
  38. #else /* 32-bit doubles. */
  39. double _COM_CONVfd (float a) { return a; }
  40. float _COM_CONVdf (double a) { return a; }
  41. int _COM_CMPLTd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPLTf")));
  42. int _COM_CMPGTd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPGTf")));
  43. int _COM_CMPLEd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPLEf")));
  44. int _COM_CMPGEd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPGEf")));
  45. int _COM_CMPEQd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPEQf")));
  46. int _COM_CMPNEd (double a, double b) __attribute__ ((weak, alias ("_COM_CMPNEf")));
  47. signed long long _COM_CONVd64s (double a) { return (signed long long) a; }
  48. unsigned long long _COM_CONVd64u (double a) { return (unsigned long long) a; }
  49. int _COM_CMPLTf (float a, float b) { return __ltsf2 (a, b) == -1; }
  50. int _COM_CMPGTf (float a, float b) { return __gtsf2 (a, b) == 1; }
  51. int _COM_CMPLEf (float a, float b) { return __lesf2 (a, b) != 1; }
  52. int _COM_CMPGEf (float a, float b) { return __gesf2 (a, b) != -1; }
  53. int _COM_CMPEQf (float a, float b) { return __eqsf2 (a, b) == 0; }
  54. int _COM_CMPNEf (float a, float b) { return __nesf2 (a, b) != 0; }
  55. #endif /* 64-bit vs 32-bit doubles. */
  56. double _COM_CONV64sd (signed long long a) { return (double) a; }
  57. double _COM_CONV64ud (unsigned long long a) { return (double) a; }
  58. extern int __cmpdi2 (long long, long long);
  59. extern int __ucmpdi2 (long long, long long);
  60. int _COM_CMPLT64s (long long a, long long b) { return __cmpdi2 (a, b) == 0; }
  61. int _COM_CMPLT64u (long long a, long long b) { return __ucmpdi2 (a, b) == 0; }
  62. int _COM_CMPGT64s (long long a, long long b) { return __cmpdi2 (a, b) == 2; }
  63. int _COM_CMPGT64u (long long a, long long b) { return __ucmpdi2 (a, b) == 2; }
  64. int _COM_CMPLE64s (long long a, long long b) { return __cmpdi2 (a, b) != 2; }
  65. int _COM_CMPLE64u (long long a, long long b) { return __ucmpdi2 (a, b) != 2; }
  66. int _COM_CMPGE64s (long long a, long long b) { return __cmpdi2 (a, b) != 0; }
  67. int _COM_CMPGE64u (long long a, long long b) { return __ucmpdi2 (a, b) != 0; }
  68. int _COM_CMPEQ64 (long long a, long long b) { return __cmpdi2 (a, b) == 1; }
  69. int _COM_CMPNE64 (long long a, long long b) { return __cmpdi2 (a, b) != 1; }