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