1*e4b17023SJohn Marino /* Header file for libgcc2.c. */ 2*e4b17023SJohn Marino /* Copyright (C) 2000, 2001, 2004, 2005, 2009, 2010 3*e4b17023SJohn Marino Free Software Foundation, Inc. 4*e4b17023SJohn Marino 5*e4b17023SJohn Marino This file is part of GCC. 6*e4b17023SJohn Marino 7*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under 8*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free 9*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later 10*e4b17023SJohn Marino version. 11*e4b17023SJohn Marino 12*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY 13*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or 14*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15*e4b17023SJohn Marino for more details. 16*e4b17023SJohn Marino 17*e4b17023SJohn Marino Under Section 7 of GPL version 3, you are granted additional 18*e4b17023SJohn Marino permissions described in the GCC Runtime Library Exception, version 19*e4b17023SJohn Marino 3.1, as published by the Free Software Foundation. 20*e4b17023SJohn Marino 21*e4b17023SJohn Marino You should have received a copy of the GNU General Public License and 22*e4b17023SJohn Marino a copy of the GCC Runtime Library Exception along with this program; 23*e4b17023SJohn Marino see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 24*e4b17023SJohn Marino <http://www.gnu.org/licenses/>. */ 25*e4b17023SJohn Marino 26*e4b17023SJohn Marino #ifndef GCC_LIBGCC2_H 27*e4b17023SJohn Marino #define GCC_LIBGCC2_H 28*e4b17023SJohn Marino 29*e4b17023SJohn Marino #ifndef HIDE_EXPORTS 30*e4b17023SJohn Marino #pragma GCC visibility push(default) 31*e4b17023SJohn Marino #endif 32*e4b17023SJohn Marino 33*e4b17023SJohn Marino extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t); 34*e4b17023SJohn Marino extern void __clear_cache (char *, char *); 35*e4b17023SJohn Marino extern void __eprintf (const char *, const char *, unsigned int, const char *) 36*e4b17023SJohn Marino __attribute__ ((__noreturn__)); 37*e4b17023SJohn Marino 38*e4b17023SJohn Marino #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE 39*e4b17023SJohn Marino #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE 40*e4b17023SJohn Marino #endif 41*e4b17023SJohn Marino 42*e4b17023SJohn Marino #ifndef LIBGCC2_HAS_SF_MODE 43*e4b17023SJohn Marino #define LIBGCC2_HAS_SF_MODE (BITS_PER_UNIT == 8) 44*e4b17023SJohn Marino #endif 45*e4b17023SJohn Marino 46*e4b17023SJohn Marino #ifndef LIBGCC2_HAS_DF_MODE 47*e4b17023SJohn Marino #define LIBGCC2_HAS_DF_MODE \ 48*e4b17023SJohn Marino (BITS_PER_UNIT == 8 \ 49*e4b17023SJohn Marino && (__SIZEOF_DOUBLE__ * __CHAR_BIT__ == 64 \ 50*e4b17023SJohn Marino || LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64)) 51*e4b17023SJohn Marino #endif 52*e4b17023SJohn Marino 53*e4b17023SJohn Marino #ifndef LIBGCC2_HAS_XF_MODE 54*e4b17023SJohn Marino #define LIBGCC2_HAS_XF_MODE \ 55*e4b17023SJohn Marino (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80) 56*e4b17023SJohn Marino #endif 57*e4b17023SJohn Marino 58*e4b17023SJohn Marino #ifndef LIBGCC2_HAS_TF_MODE 59*e4b17023SJohn Marino #define LIBGCC2_HAS_TF_MODE \ 60*e4b17023SJohn Marino (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128) 61*e4b17023SJohn Marino #endif 62*e4b17023SJohn Marino 63*e4b17023SJohn Marino #ifndef SF_SIZE 64*e4b17023SJohn Marino #if LIBGCC2_HAS_SF_MODE 65*e4b17023SJohn Marino #define SF_SIZE FLT_MANT_DIG 66*e4b17023SJohn Marino #else 67*e4b17023SJohn Marino #define SF_SIZE 0 68*e4b17023SJohn Marino #endif 69*e4b17023SJohn Marino #endif 70*e4b17023SJohn Marino 71*e4b17023SJohn Marino #ifndef DF_SIZE 72*e4b17023SJohn Marino #if LIBGCC2_HAS_DF_MODE 73*e4b17023SJohn Marino #if __SIZEOF_DOUBLE__ * __CHAR_BIT__ == 64 74*e4b17023SJohn Marino #define DF_SIZE DBL_MANT_DIG 75*e4b17023SJohn Marino #elif LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64 76*e4b17023SJohn Marino #define DF_SIZE LDBL_MANT_DIG 77*e4b17023SJohn Marino #else 78*e4b17023SJohn Marino #define DF_SIZE 0 79*e4b17023SJohn Marino #endif 80*e4b17023SJohn Marino #else 81*e4b17023SJohn Marino #define DF_SIZE 0 82*e4b17023SJohn Marino #endif 83*e4b17023SJohn Marino #endif 84*e4b17023SJohn Marino 85*e4b17023SJohn Marino #ifndef XF_SIZE 86*e4b17023SJohn Marino #if LIBGCC2_HAS_XF_MODE 87*e4b17023SJohn Marino #define XF_SIZE LDBL_MANT_DIG 88*e4b17023SJohn Marino #else 89*e4b17023SJohn Marino #define XF_SIZE 0 90*e4b17023SJohn Marino #endif 91*e4b17023SJohn Marino #endif 92*e4b17023SJohn Marino 93*e4b17023SJohn Marino #ifndef TF_SIZE 94*e4b17023SJohn Marino #if LIBGCC2_HAS_TF_MODE 95*e4b17023SJohn Marino #define TF_SIZE LDBL_MANT_DIG 96*e4b17023SJohn Marino #else 97*e4b17023SJohn Marino #define TF_SIZE 0 98*e4b17023SJohn Marino #endif 99*e4b17023SJohn Marino #endif 100*e4b17023SJohn Marino 101*e4b17023SJohn Marino /* FIXME: This #ifdef probably should be removed, ie. enable the test 102*e4b17023SJohn Marino for mips too. */ 103*e4b17023SJohn Marino /* Don't use IBM Extended Double TFmode for TI->SF calculations. 104*e4b17023SJohn Marino The conversion from long double to float suffers from double 105*e4b17023SJohn Marino rounding, because we convert via double. In other cases, going 106*e4b17023SJohn Marino through the software fp routines is much slower than the fallback. */ 107*e4b17023SJohn Marino #ifdef __powerpc__ 108*e4b17023SJohn Marino #define AVOID_FP_TYPE_CONVERSION(SIZE) (SIZE == 106) 109*e4b17023SJohn Marino #elif defined(WIDEST_HARDWARE_FP_SIZE) 110*e4b17023SJohn Marino #define AVOID_FP_TYPE_CONVERSION(SIZE) (SIZE > WIDEST_HARDWARE_FP_SIZE) 111*e4b17023SJohn Marino #else 112*e4b17023SJohn Marino #define AVOID_FP_TYPE_CONVERSION(SIZE) 0 113*e4b17023SJohn Marino #endif 114*e4b17023SJohn Marino 115*e4b17023SJohn Marino /* In the first part of this file, we are interfacing to calls generated 116*e4b17023SJohn Marino by the compiler itself. These calls pass values into these routines 117*e4b17023SJohn Marino which have very specific modes (rather than very specific types), and 118*e4b17023SJohn Marino these compiler-generated calls also expect any return values to have 119*e4b17023SJohn Marino very specific modes (rather than very specific types). Thus, we need 120*e4b17023SJohn Marino to avoid using regular C language type names in this part of the file 121*e4b17023SJohn Marino because the sizes for those types can be configured to be anything. 122*e4b17023SJohn Marino Instead we use the following special type names. */ 123*e4b17023SJohn Marino 124*e4b17023SJohn Marino typedef int QItype __attribute__ ((mode (QI))); 125*e4b17023SJohn Marino typedef unsigned int UQItype __attribute__ ((mode (QI))); 126*e4b17023SJohn Marino typedef int HItype __attribute__ ((mode (HI))); 127*e4b17023SJohn Marino typedef unsigned int UHItype __attribute__ ((mode (HI))); 128*e4b17023SJohn Marino #if MIN_UNITS_PER_WORD > 1 129*e4b17023SJohn Marino /* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1. */ 130*e4b17023SJohn Marino typedef int SItype __attribute__ ((mode (SI))); 131*e4b17023SJohn Marino typedef unsigned int USItype __attribute__ ((mode (SI))); 132*e4b17023SJohn Marino #if __SIZEOF_LONG_LONG__ > 4 133*e4b17023SJohn Marino /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2. */ 134*e4b17023SJohn Marino typedef int DItype __attribute__ ((mode (DI))); 135*e4b17023SJohn Marino typedef unsigned int UDItype __attribute__ ((mode (DI))); 136*e4b17023SJohn Marino #if MIN_UNITS_PER_WORD > 4 137*e4b17023SJohn Marino /* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4. */ 138*e4b17023SJohn Marino typedef int TItype __attribute__ ((mode (TI))); 139*e4b17023SJohn Marino typedef unsigned int UTItype __attribute__ ((mode (TI))); 140*e4b17023SJohn Marino #endif 141*e4b17023SJohn Marino #endif 142*e4b17023SJohn Marino #endif 143*e4b17023SJohn Marino 144*e4b17023SJohn Marino #if LIBGCC2_HAS_SF_MODE 145*e4b17023SJohn Marino typedef float SFtype __attribute__ ((mode (SF))); 146*e4b17023SJohn Marino typedef _Complex float SCtype __attribute__ ((mode (SC))); 147*e4b17023SJohn Marino #endif 148*e4b17023SJohn Marino #if LIBGCC2_HAS_DF_MODE 149*e4b17023SJohn Marino typedef float DFtype __attribute__ ((mode (DF))); 150*e4b17023SJohn Marino typedef _Complex float DCtype __attribute__ ((mode (DC))); 151*e4b17023SJohn Marino #endif 152*e4b17023SJohn Marino #if LIBGCC2_HAS_XF_MODE 153*e4b17023SJohn Marino typedef float XFtype __attribute__ ((mode (XF))); 154*e4b17023SJohn Marino typedef _Complex float XCtype __attribute__ ((mode (XC))); 155*e4b17023SJohn Marino #endif 156*e4b17023SJohn Marino #if LIBGCC2_HAS_TF_MODE 157*e4b17023SJohn Marino typedef float TFtype __attribute__ ((mode (TF))); 158*e4b17023SJohn Marino typedef _Complex float TCtype __attribute__ ((mode (TC))); 159*e4b17023SJohn Marino #endif 160*e4b17023SJohn Marino 161*e4b17023SJohn Marino typedef int cmp_return_type __attribute__((mode (__libgcc_cmp_return__))); 162*e4b17023SJohn Marino typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__))); 163*e4b17023SJohn Marino 164*e4b17023SJohn Marino /* Make sure that we don't accidentally use any normal C language built-in 165*e4b17023SJohn Marino type names in the first part of this file. Instead we want to use *only* 166*e4b17023SJohn Marino the type names defined above. The following macro definitions insure 167*e4b17023SJohn Marino that if we *do* accidentally use some normal C language built-in type name, 168*e4b17023SJohn Marino we will get a syntax error. */ 169*e4b17023SJohn Marino 170*e4b17023SJohn Marino #define char bogus_type 171*e4b17023SJohn Marino #define short bogus_type 172*e4b17023SJohn Marino #define int bogus_type 173*e4b17023SJohn Marino #define long bogus_type 174*e4b17023SJohn Marino #define unsigned bogus_type 175*e4b17023SJohn Marino #define float bogus_type 176*e4b17023SJohn Marino #define double bogus_type 177*e4b17023SJohn Marino 178*e4b17023SJohn Marino /* Versions prior to 3.4.4 were not taking into account the word size for 179*e4b17023SJohn Marino the 5 trapping arithmetic functions absv, addv, subv, mulv and negv. As 180*e4b17023SJohn Marino a consequence, the si and di variants were always and the only ones emitted. 181*e4b17023SJohn Marino To maintain backward compatibility, COMPAT_SIMODE_TRAPPING_ARITHMETIC is 182*e4b17023SJohn Marino defined on platforms where it makes sense to still have the si variants 183*e4b17023SJohn Marino emitted. As a bonus, their implementation is now correct. Note that the 184*e4b17023SJohn Marino same mechanism should have been implemented for the di variants, but it 185*e4b17023SJohn Marino turns out that no platform would define COMPAT_DIMODE_TRAPPING_ARITHMETIC 186*e4b17023SJohn Marino if it existed. */ 187*e4b17023SJohn Marino 188*e4b17023SJohn Marino #if LIBGCC2_UNITS_PER_WORD == 8 189*e4b17023SJohn Marino #define W_TYPE_SIZE (8 * BITS_PER_UNIT) 190*e4b17023SJohn Marino #define Wtype DItype 191*e4b17023SJohn Marino #define UWtype UDItype 192*e4b17023SJohn Marino #define HWtype DItype 193*e4b17023SJohn Marino #define UHWtype UDItype 194*e4b17023SJohn Marino #define DWtype TItype 195*e4b17023SJohn Marino #define UDWtype UTItype 196*e4b17023SJohn Marino #ifdef LIBGCC2_GNU_PREFIX 197*e4b17023SJohn Marino #define __NW(a,b) __gnu_ ## a ## di ## b 198*e4b17023SJohn Marino #define __NDW(a,b) __gnu_ ## a ## ti ## b 199*e4b17023SJohn Marino #else 200*e4b17023SJohn Marino #define __NW(a,b) __ ## a ## di ## b 201*e4b17023SJohn Marino #define __NDW(a,b) __ ## a ## ti ## b 202*e4b17023SJohn Marino #endif 203*e4b17023SJohn Marino #define COMPAT_SIMODE_TRAPPING_ARITHMETIC 204*e4b17023SJohn Marino #elif LIBGCC2_UNITS_PER_WORD == 4 205*e4b17023SJohn Marino #define W_TYPE_SIZE (4 * BITS_PER_UNIT) 206*e4b17023SJohn Marino #define Wtype SItype 207*e4b17023SJohn Marino #define UWtype USItype 208*e4b17023SJohn Marino #define HWtype SItype 209*e4b17023SJohn Marino #define UHWtype USItype 210*e4b17023SJohn Marino #define DWtype DItype 211*e4b17023SJohn Marino #define UDWtype UDItype 212*e4b17023SJohn Marino #ifdef LIBGCC2_GNU_PREFIX 213*e4b17023SJohn Marino #define __NW(a,b) __gnu_ ## a ## si ## b 214*e4b17023SJohn Marino #define __NDW(a,b) __gnu_ ## a ## di ## b 215*e4b17023SJohn Marino #else 216*e4b17023SJohn Marino #define __NW(a,b) __ ## a ## si ## b 217*e4b17023SJohn Marino #define __NDW(a,b) __ ## a ## di ## b 218*e4b17023SJohn Marino #endif 219*e4b17023SJohn Marino #elif LIBGCC2_UNITS_PER_WORD == 2 220*e4b17023SJohn Marino #define W_TYPE_SIZE (2 * BITS_PER_UNIT) 221*e4b17023SJohn Marino #define Wtype HItype 222*e4b17023SJohn Marino #define UWtype UHItype 223*e4b17023SJohn Marino #define HWtype HItype 224*e4b17023SJohn Marino #define UHWtype UHItype 225*e4b17023SJohn Marino #define DWtype SItype 226*e4b17023SJohn Marino #define UDWtype USItype 227*e4b17023SJohn Marino #ifdef LIBGCC2_GNU_PREFIX 228*e4b17023SJohn Marino #define __NW(a,b) __gnu_ ## a ## hi ## b 229*e4b17023SJohn Marino #define __NDW(a,b) __gnu_ ## a ## si ## b 230*e4b17023SJohn Marino #else 231*e4b17023SJohn Marino #define __NW(a,b) __ ## a ## hi ## b 232*e4b17023SJohn Marino #define __NDW(a,b) __ ## a ## si ## b 233*e4b17023SJohn Marino #endif 234*e4b17023SJohn Marino #else 235*e4b17023SJohn Marino #define W_TYPE_SIZE BITS_PER_UNIT 236*e4b17023SJohn Marino #define Wtype QItype 237*e4b17023SJohn Marino #define UWtype UQItype 238*e4b17023SJohn Marino #define HWtype QItype 239*e4b17023SJohn Marino #define UHWtype UQItype 240*e4b17023SJohn Marino #define DWtype HItype 241*e4b17023SJohn Marino #define UDWtype UHItype 242*e4b17023SJohn Marino #ifdef LIBGCC2_GNU_PREFIX 243*e4b17023SJohn Marino #define __NW(a,b) __gnu_ ## a ## qi ## b 244*e4b17023SJohn Marino #define __NDW(a,b) __gnu_ ## a ## hi ## b 245*e4b17023SJohn Marino #else 246*e4b17023SJohn Marino #define __NW(a,b) __ ## a ## qi ## b 247*e4b17023SJohn Marino #define __NDW(a,b) __ ## a ## hi ## b 248*e4b17023SJohn Marino #endif 249*e4b17023SJohn Marino #endif 250*e4b17023SJohn Marino 251*e4b17023SJohn Marino #ifdef LIBGCC2_GNU_PREFIX 252*e4b17023SJohn Marino #define __N(a) __gnu_ ## a 253*e4b17023SJohn Marino #else 254*e4b17023SJohn Marino #define __N(a) __ ## a 255*e4b17023SJohn Marino #endif 256*e4b17023SJohn Marino #define Wtype_MAX ((Wtype)(((UWtype)1 << (W_TYPE_SIZE - 1)) - 1)) 257*e4b17023SJohn Marino #define Wtype_MIN (- Wtype_MAX - 1) 258*e4b17023SJohn Marino 259*e4b17023SJohn Marino #if W_TYPE_SIZE == 8 260*e4b17023SJohn Marino # define Wtype_MAXp1_F 0x1p8f 261*e4b17023SJohn Marino #elif W_TYPE_SIZE == 16 262*e4b17023SJohn Marino # define Wtype_MAXp1_F 0x1p16f 263*e4b17023SJohn Marino #elif W_TYPE_SIZE == 32 264*e4b17023SJohn Marino # define Wtype_MAXp1_F 0x1p32f 265*e4b17023SJohn Marino #elif W_TYPE_SIZE == 64 266*e4b17023SJohn Marino # define Wtype_MAXp1_F 0x1p64f 267*e4b17023SJohn Marino #else 268*e4b17023SJohn Marino # error "expand the table" 269*e4b17023SJohn Marino #endif 270*e4b17023SJohn Marino 271*e4b17023SJohn Marino #define __muldi3 __NDW(mul,3) 272*e4b17023SJohn Marino #define __divdi3 __NDW(div,3) 273*e4b17023SJohn Marino #define __udivdi3 __NDW(udiv,3) 274*e4b17023SJohn Marino #define __moddi3 __NDW(mod,3) 275*e4b17023SJohn Marino #define __umoddi3 __NDW(umod,3) 276*e4b17023SJohn Marino #define __negdi2 __NDW(neg,2) 277*e4b17023SJohn Marino #define __lshrdi3 __NDW(lshr,3) 278*e4b17023SJohn Marino #define __ashldi3 __NDW(ashl,3) 279*e4b17023SJohn Marino #define __ashrdi3 __NDW(ashr,3) 280*e4b17023SJohn Marino #define __cmpdi2 __NDW(cmp,2) 281*e4b17023SJohn Marino #define __ucmpdi2 __NDW(ucmp,2) 282*e4b17023SJohn Marino #define __udivmoddi4 __NDW(udivmod,4) 283*e4b17023SJohn Marino #define __fixunstfDI __NDW(fixunstf,) 284*e4b17023SJohn Marino #define __fixtfdi __NDW(fixtf,) 285*e4b17023SJohn Marino #define __fixunsxfDI __NDW(fixunsxf,) 286*e4b17023SJohn Marino #define __fixxfdi __NDW(fixxf,) 287*e4b17023SJohn Marino #define __fixunsdfDI __NDW(fixunsdf,) 288*e4b17023SJohn Marino #define __fixdfdi __NDW(fixdf,) 289*e4b17023SJohn Marino #define __fixunssfDI __NDW(fixunssf,) 290*e4b17023SJohn Marino #define __fixsfdi __NDW(fixsf,) 291*e4b17023SJohn Marino #define __floatdixf __NDW(float,xf) 292*e4b17023SJohn Marino #define __floatditf __NDW(float,tf) 293*e4b17023SJohn Marino #define __floatdidf __NDW(float,df) 294*e4b17023SJohn Marino #define __floatdisf __NDW(float,sf) 295*e4b17023SJohn Marino #define __floatundixf __NDW(floatun,xf) 296*e4b17023SJohn Marino #define __floatunditf __NDW(floatun,tf) 297*e4b17023SJohn Marino #define __floatundidf __NDW(floatun,df) 298*e4b17023SJohn Marino #define __floatundisf __NDW(floatun,sf) 299*e4b17023SJohn Marino #define __fixunsxfSI __NW(fixunsxf,) 300*e4b17023SJohn Marino #define __fixunstfSI __NW(fixunstf,) 301*e4b17023SJohn Marino #define __fixunsdfSI __NW(fixunsdf,) 302*e4b17023SJohn Marino #define __fixunssfSI __NW(fixunssf,) 303*e4b17023SJohn Marino 304*e4b17023SJohn Marino #define __absvSI2 __NW(absv,2) 305*e4b17023SJohn Marino #define __addvSI3 __NW(addv,3) 306*e4b17023SJohn Marino #define __subvSI3 __NW(subv,3) 307*e4b17023SJohn Marino #define __mulvSI3 __NW(mulv,3) 308*e4b17023SJohn Marino #define __negvSI2 __NW(negv,2) 309*e4b17023SJohn Marino #define __absvDI2 __NDW(absv,2) 310*e4b17023SJohn Marino #define __addvDI3 __NDW(addv,3) 311*e4b17023SJohn Marino #define __subvDI3 __NDW(subv,3) 312*e4b17023SJohn Marino #define __mulvDI3 __NDW(mulv,3) 313*e4b17023SJohn Marino #define __negvDI2 __NDW(negv,2) 314*e4b17023SJohn Marino 315*e4b17023SJohn Marino #define __ffsSI2 __NW(ffs,2) 316*e4b17023SJohn Marino #define __clzSI2 __NW(clz,2) 317*e4b17023SJohn Marino #define __ctzSI2 __NW(ctz,2) 318*e4b17023SJohn Marino #define __clrsbSI2 __NW(clrsb,2) 319*e4b17023SJohn Marino #define __popcountSI2 __NW(popcount,2) 320*e4b17023SJohn Marino #define __paritySI2 __NW(parity,2) 321*e4b17023SJohn Marino #define __ffsDI2 __NDW(ffs,2) 322*e4b17023SJohn Marino #define __clzDI2 __NDW(clz,2) 323*e4b17023SJohn Marino #define __ctzDI2 __NDW(ctz,2) 324*e4b17023SJohn Marino #define __clrsbDI2 __NDW(clrsb,2) 325*e4b17023SJohn Marino #define __popcountDI2 __NDW(popcount,2) 326*e4b17023SJohn Marino #define __parityDI2 __NDW(parity,2) 327*e4b17023SJohn Marino 328*e4b17023SJohn Marino #define __clz_tab __N(clz_tab) 329*e4b17023SJohn Marino #define __bswapsi2 __N(bswapsi2) 330*e4b17023SJohn Marino #define __bswapdi2 __N(bswapdi2) 331*e4b17023SJohn Marino #define __udiv_w_sdiv __N(udiv_w_sdiv) 332*e4b17023SJohn Marino #define __clear_cache __N(clear_cache) 333*e4b17023SJohn Marino #define __enable_execute_stack __N(enable_execute_stack) 334*e4b17023SJohn Marino 335*e4b17023SJohn Marino #ifndef __powisf2 336*e4b17023SJohn Marino #define __powisf2 __N(powisf2) 337*e4b17023SJohn Marino #endif 338*e4b17023SJohn Marino #ifndef __powidf2 339*e4b17023SJohn Marino #define __powidf2 __N(powidf2) 340*e4b17023SJohn Marino #endif 341*e4b17023SJohn Marino #ifndef __powitf2 342*e4b17023SJohn Marino #define __powitf2 __N(powitf2) 343*e4b17023SJohn Marino #endif 344*e4b17023SJohn Marino #ifndef __powixf2 345*e4b17023SJohn Marino #define __powixf2 __N(powixf2) 346*e4b17023SJohn Marino #endif 347*e4b17023SJohn Marino #ifndef __mulsc3 348*e4b17023SJohn Marino #define __mulsc3 __N(mulsc3) 349*e4b17023SJohn Marino #endif 350*e4b17023SJohn Marino #ifndef __muldc3 351*e4b17023SJohn Marino #define __muldc3 __N(muldc3) 352*e4b17023SJohn Marino #endif 353*e4b17023SJohn Marino #ifndef __mulxc3 354*e4b17023SJohn Marino #define __mulxc3 __N(mulxc3) 355*e4b17023SJohn Marino #endif 356*e4b17023SJohn Marino #ifndef __multc3 357*e4b17023SJohn Marino #define __multc3 __N(multc3) 358*e4b17023SJohn Marino #endif 359*e4b17023SJohn Marino #ifndef __divsc3 360*e4b17023SJohn Marino #define __divsc3 __N(divsc3) 361*e4b17023SJohn Marino #endif 362*e4b17023SJohn Marino #ifndef __divdc3 363*e4b17023SJohn Marino #define __divdc3 __N(divdc3) 364*e4b17023SJohn Marino #endif 365*e4b17023SJohn Marino #ifndef __divxc3 366*e4b17023SJohn Marino #define __divxc3 __N(divxc3) 367*e4b17023SJohn Marino #endif 368*e4b17023SJohn Marino #ifndef __divtc3 369*e4b17023SJohn Marino #define __divtc3 __N(divtc3) 370*e4b17023SJohn Marino #endif 371*e4b17023SJohn Marino 372*e4b17023SJohn Marino extern DWtype __muldi3 (DWtype, DWtype); 373*e4b17023SJohn Marino extern DWtype __divdi3 (DWtype, DWtype); 374*e4b17023SJohn Marino extern UDWtype __udivdi3 (UDWtype, UDWtype); 375*e4b17023SJohn Marino extern UDWtype __umoddi3 (UDWtype, UDWtype); 376*e4b17023SJohn Marino extern DWtype __moddi3 (DWtype, DWtype); 377*e4b17023SJohn Marino 378*e4b17023SJohn Marino /* __udivmoddi4 is static inline when building other libgcc2 portions. */ 379*e4b17023SJohn Marino #if (!defined (L_udivdi3) && !defined (L_divdi3) && \ 380*e4b17023SJohn Marino !defined (L_umoddi3) && !defined (L_moddi3)) 381*e4b17023SJohn Marino extern UDWtype __udivmoddi4 (UDWtype, UDWtype, UDWtype *); 382*e4b17023SJohn Marino #endif 383*e4b17023SJohn Marino 384*e4b17023SJohn Marino /* __negdi2 is static inline when building other libgcc2 portions. */ 385*e4b17023SJohn Marino #if !defined(L_divdi3) && !defined(L_moddi3) 386*e4b17023SJohn Marino extern DWtype __negdi2 (DWtype); 387*e4b17023SJohn Marino #endif 388*e4b17023SJohn Marino 389*e4b17023SJohn Marino extern DWtype __lshrdi3 (DWtype, shift_count_type); 390*e4b17023SJohn Marino extern DWtype __ashldi3 (DWtype, shift_count_type); 391*e4b17023SJohn Marino extern DWtype __ashrdi3 (DWtype, shift_count_type); 392*e4b17023SJohn Marino 393*e4b17023SJohn Marino /* __udiv_w_sdiv is static inline when building other libgcc2 portions. */ 394*e4b17023SJohn Marino #if (!defined(L_udivdi3) && !defined(L_divdi3) && \ 395*e4b17023SJohn Marino !defined(L_umoddi3) && !defined(L_moddi3)) 396*e4b17023SJohn Marino extern UWtype __udiv_w_sdiv (UWtype *, UWtype, UWtype, UWtype); 397*e4b17023SJohn Marino #endif 398*e4b17023SJohn Marino 399*e4b17023SJohn Marino extern cmp_return_type __cmpdi2 (DWtype, DWtype); 400*e4b17023SJohn Marino extern cmp_return_type __ucmpdi2 (DWtype, DWtype); 401*e4b17023SJohn Marino 402*e4b17023SJohn Marino #if MIN_UNITS_PER_WORD > 1 403*e4b17023SJohn Marino extern SItype __bswapsi2 (SItype); 404*e4b17023SJohn Marino #endif 405*e4b17023SJohn Marino #if __SIZEOF_LONG_LONG__ > 4 406*e4b17023SJohn Marino extern DItype __bswapdi2 (DItype); 407*e4b17023SJohn Marino #endif 408*e4b17023SJohn Marino 409*e4b17023SJohn Marino extern Wtype __absvSI2 (Wtype); 410*e4b17023SJohn Marino extern Wtype __addvSI3 (Wtype, Wtype); 411*e4b17023SJohn Marino extern Wtype __subvSI3 (Wtype, Wtype); 412*e4b17023SJohn Marino extern Wtype __mulvSI3 (Wtype, Wtype); 413*e4b17023SJohn Marino extern Wtype __negvSI2 (Wtype); 414*e4b17023SJohn Marino extern DWtype __absvDI2 (DWtype); 415*e4b17023SJohn Marino extern DWtype __addvDI3 (DWtype, DWtype); 416*e4b17023SJohn Marino extern DWtype __subvDI3 (DWtype, DWtype); 417*e4b17023SJohn Marino extern DWtype __mulvDI3 (DWtype, DWtype); 418*e4b17023SJohn Marino extern DWtype __negvDI2 (DWtype); 419*e4b17023SJohn Marino 420*e4b17023SJohn Marino #ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC 421*e4b17023SJohn Marino #define __absvsi2 __N(absvsi2) 422*e4b17023SJohn Marino #define __negvsi2 __N(negvsi2) 423*e4b17023SJohn Marino #define __addvsi3 __N(addvsi3) 424*e4b17023SJohn Marino #define __subvsi3 __N(subvsi3) 425*e4b17023SJohn Marino #define __mulvsi3 __N(mulvsi3) 426*e4b17023SJohn Marino 427*e4b17023SJohn Marino extern SItype __absvsi2 (SItype); 428*e4b17023SJohn Marino extern SItype __addvsi3 (SItype, SItype); 429*e4b17023SJohn Marino extern SItype __subvsi3 (SItype, SItype); 430*e4b17023SJohn Marino extern SItype __mulvsi3 (SItype, SItype); 431*e4b17023SJohn Marino extern SItype __negvsi2 (SItype); 432*e4b17023SJohn Marino #endif /* COMPAT_SIMODE_TRAPPING_ARITHMETIC */ 433*e4b17023SJohn Marino 434*e4b17023SJohn Marino #undef int 435*e4b17023SJohn Marino #if LIBGCC2_HAS_SF_MODE 436*e4b17023SJohn Marino extern DWtype __fixsfdi (SFtype); 437*e4b17023SJohn Marino extern SFtype __floatdisf (DWtype); 438*e4b17023SJohn Marino extern SFtype __floatundisf (UDWtype); 439*e4b17023SJohn Marino extern UWtype __fixunssfSI (SFtype); 440*e4b17023SJohn Marino extern UDWtype __fixunssfDI (SFtype); 441*e4b17023SJohn Marino extern SFtype __powisf2 (SFtype, int); 442*e4b17023SJohn Marino extern SCtype __divsc3 (SFtype, SFtype, SFtype, SFtype); 443*e4b17023SJohn Marino extern SCtype __mulsc3 (SFtype, SFtype, SFtype, SFtype); 444*e4b17023SJohn Marino #endif 445*e4b17023SJohn Marino #if LIBGCC2_HAS_DF_MODE 446*e4b17023SJohn Marino extern DWtype __fixdfdi (DFtype); 447*e4b17023SJohn Marino extern DFtype __floatdidf (DWtype); 448*e4b17023SJohn Marino extern DFtype __floatundidf (UDWtype); 449*e4b17023SJohn Marino extern UWtype __fixunsdfSI (DFtype); 450*e4b17023SJohn Marino extern UDWtype __fixunsdfDI (DFtype); 451*e4b17023SJohn Marino extern DFtype __powidf2 (DFtype, int); 452*e4b17023SJohn Marino extern DCtype __divdc3 (DFtype, DFtype, DFtype, DFtype); 453*e4b17023SJohn Marino extern DCtype __muldc3 (DFtype, DFtype, DFtype, DFtype); 454*e4b17023SJohn Marino #endif 455*e4b17023SJohn Marino 456*e4b17023SJohn Marino #if LIBGCC2_HAS_XF_MODE 457*e4b17023SJohn Marino extern DWtype __fixxfdi (XFtype); 458*e4b17023SJohn Marino extern UDWtype __fixunsxfDI (XFtype); 459*e4b17023SJohn Marino extern XFtype __floatdixf (DWtype); 460*e4b17023SJohn Marino extern XFtype __floatundixf (UDWtype); 461*e4b17023SJohn Marino extern UWtype __fixunsxfSI (XFtype); 462*e4b17023SJohn Marino extern XFtype __powixf2 (XFtype, int); 463*e4b17023SJohn Marino extern XCtype __divxc3 (XFtype, XFtype, XFtype, XFtype); 464*e4b17023SJohn Marino extern XCtype __mulxc3 (XFtype, XFtype, XFtype, XFtype); 465*e4b17023SJohn Marino #endif 466*e4b17023SJohn Marino 467*e4b17023SJohn Marino #if LIBGCC2_HAS_TF_MODE 468*e4b17023SJohn Marino extern UDWtype __fixunstfDI (TFtype); 469*e4b17023SJohn Marino extern DWtype __fixtfdi (TFtype); 470*e4b17023SJohn Marino extern TFtype __floatditf (DWtype); 471*e4b17023SJohn Marino extern TFtype __floatunditf (UDWtype); 472*e4b17023SJohn Marino extern TFtype __powitf2 (TFtype, int); 473*e4b17023SJohn Marino extern TCtype __divtc3 (TFtype, TFtype, TFtype, TFtype); 474*e4b17023SJohn Marino extern TCtype __multc3 (TFtype, TFtype, TFtype, TFtype); 475*e4b17023SJohn Marino #endif 476*e4b17023SJohn Marino #define int bogus_type 477*e4b17023SJohn Marino 478*e4b17023SJohn Marino /* DWstructs are pairs of Wtype values in the order determined by 479*e4b17023SJohn Marino __BYTE_ORDER__. */ 480*e4b17023SJohn Marino 481*e4b17023SJohn Marino #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ 482*e4b17023SJohn Marino struct DWstruct {Wtype high, low;}; 483*e4b17023SJohn Marino #else 484*e4b17023SJohn Marino struct DWstruct {Wtype low, high;}; 485*e4b17023SJohn Marino #endif 486*e4b17023SJohn Marino 487*e4b17023SJohn Marino /* We need this union to unpack/pack DImode values, since we don't have 488*e4b17023SJohn Marino any arithmetic yet. Incoming DImode parameters are stored into the 489*e4b17023SJohn Marino `ll' field, and the unpacked result is read from the struct `s'. */ 490*e4b17023SJohn Marino 491*e4b17023SJohn Marino typedef union 492*e4b17023SJohn Marino { 493*e4b17023SJohn Marino struct DWstruct s; 494*e4b17023SJohn Marino DWtype ll; 495*e4b17023SJohn Marino } DWunion; 496*e4b17023SJohn Marino 497*e4b17023SJohn Marino /* Defined for L_popcount_tab. Exported here because some targets may 498*e4b17023SJohn Marino want to use it for their own versions of the __popcount builtins. */ 499*e4b17023SJohn Marino extern const UQItype __popcount_tab[256]; 500*e4b17023SJohn Marino 501*e4b17023SJohn Marino /* Defined for L_clz. Exported here because some targets may want to use 502*e4b17023SJohn Marino it for their own versions of the __clz builtins. It contains the bit 503*e4b17023SJohn Marino position of the first set bit for the numbers 0 - 255. This avoids the 504*e4b17023SJohn Marino need for a separate table for the __ctz builtins. */ 505*e4b17023SJohn Marino extern const UQItype __clz_tab[256]; 506*e4b17023SJohn Marino 507*e4b17023SJohn Marino #include "longlong.h" 508*e4b17023SJohn Marino 509*e4b17023SJohn Marino #undef int 510*e4b17023SJohn Marino extern int __clzDI2 (UDWtype); 511*e4b17023SJohn Marino extern int __clzSI2 (UWtype); 512*e4b17023SJohn Marino extern int __ctzSI2 (UWtype); 513*e4b17023SJohn Marino extern int __ctzDI2 (UDWtype); 514*e4b17023SJohn Marino extern int __clrsbSI2 (Wtype); 515*e4b17023SJohn Marino extern int __clrsbDI2 (DWtype); 516*e4b17023SJohn Marino extern int __ffsSI2 (UWtype); 517*e4b17023SJohn Marino extern int __ffsDI2 (DWtype); 518*e4b17023SJohn Marino extern int __popcountSI2 (UWtype); 519*e4b17023SJohn Marino extern int __popcountDI2 (UDWtype); 520*e4b17023SJohn Marino extern int __paritySI2 (UWtype); 521*e4b17023SJohn Marino extern int __parityDI2 (UDWtype); 522*e4b17023SJohn Marino #define int bogus_type 523*e4b17023SJohn Marino 524*e4b17023SJohn Marino extern void __enable_execute_stack (void *); 525*e4b17023SJohn Marino 526*e4b17023SJohn Marino #ifndef HIDE_EXPORTS 527*e4b17023SJohn Marino #pragma GCC visibility pop 528*e4b17023SJohn Marino #endif 529*e4b17023SJohn Marino 530*e4b17023SJohn Marino #endif /* ! GCC_LIBGCC2_H */ 531