1 /* Copyright (c) 2007 Jeff Johnston <jjohnstn@redhat.com> */ 2 #ifndef _MACHFASTMATH_H 3 #define _MACHFASTMATH_H 4 5 #ifndef __x86_64 6 7 #if defined(__GNUC__) && __STDC__ - 0 > 0 8 9 #define __str1__(__x) #__x 10 #define __str2__(__x) __str1__(__x) 11 #define __U_L_PREFIX__ __str2__(__USER_LABEL_PREFIX__) 12 13 __extension__ double atan2(double, double) 14 __asm__(__U_L_PREFIX__ "_f_atan2"); 15 __extension__ double exp(double) 16 __asm__(__U_L_PREFIX__ "_f_exp"); 17 __extension__ double frexp(double, int*) 18 __asm__(__U_L_PREFIX__ "_f_frexp"); 19 __extension__ double ldexp(double, int) 20 __asm__(__U_L_PREFIX__ "_f_ldexp"); 21 __extension__ double log(double) 22 __asm__(__U_L_PREFIX__ "_f_log"); 23 __extension__ double log10(double) 24 __asm__(__U_L_PREFIX__ "_f_log10"); 25 __extension__ double pow(double, double) 26 __asm__(__U_L_PREFIX__ "_f_pow"); 27 __extension__ double tan(double) 28 __asm__(__U_L_PREFIX__ "_f_tan"); 29 30 #if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L 31 32 33 __extension__ float atan2f(float, float) 34 __asm__(__U_L_PREFIX__ "_f_atan2f"); 35 __extension__ float expf(float) 36 __asm__(__U_L_PREFIX__ "_f_expf"); 37 __extension__ float frexpf(float, int*) 38 __asm__(__U_L_PREFIX__ "_f_frexpf"); 39 __extension__ float ldexpf(float, int) 40 __asm__(__U_L_PREFIX__ "_f_ldexpf"); 41 __extension__ long long llrint(double) 42 __asm__(__U_L_PREFIX__ "_f_llrint"); 43 __extension__ long long llrintf(float) 44 __asm__(__U_L_PREFIX__ "_f_llrintf"); 45 __extension__ long long llrintl(long double) 46 __asm__(__U_L_PREFIX__ "_f_llrintl"); 47 __extension__ float logf(float) 48 __asm__(__U_L_PREFIX__ "_f_logf"); 49 __extension__ float log10f(float) 50 __asm__(__U_L_PREFIX__ "_f_log10f"); 51 __extension__ long lrint(double) 52 __asm__(__U_L_PREFIX__ "_f_lrint"); 53 __extension__ long lrintf(float) 54 __asm__(__U_L_PREFIX__ "_f_lrintf"); 55 __extension__ long lrintl(long double) 56 __asm__(__U_L_PREFIX__ "_f_lrintl"); 57 __extension__ float powf(float, float) 58 __asm__(__U_L_PREFIX__ "_f_powf"); 59 __extension__ double rint(double) 60 __asm__(__U_L_PREFIX__ "_f_rint"); 61 __extension__ float rintf(float) 62 __asm__(__U_L_PREFIX__ "_f_rintf"); 63 __extension__ long double rintl(long double) 64 __asm__(__U_L_PREFIX__ "_f_rintl"); 65 __extension__ float tanf(float) 66 __asm__(__U_L_PREFIX__ "_f_tanf"); 67 #endif 68 69 #else 70 71 double EXFUN(_f_atan2,(double, double)); 72 double EXFUN(_f_exp,(double)); 73 double EXFUN(_f_frexp,(double, int*)); 74 double EXFUN(_f_ldexp,(double, int)); 75 double EXFUN(_f_log,(double)); 76 double EXFUN(_f_log10,(double)); 77 double EXFUN(_f_pow,(double, double)); 78 79 #define atan2(__y,__x) _f_atan2((__y),(__x)) 80 #define exp(__x) _f_exp(__x) 81 #define frexp(__x,__p) _f_frexp((__x),(__p)) 82 #define ldexp(__x,__e) _f_ldexp((__x),(__e)) 83 #define log(__x) _f_log(__x) 84 #define log10(__x) _f_log10(__x) 85 #define pow(__x,__y) _f_pow((__x),(__y)) 86 87 #ifndef __STRICT_ANSI__ 88 89 float EXFUN(_f_atan2f,(float, float)); 90 float EXFUN(_f_expf,(float)); 91 float EXFUN(_f_frexpf,(float, int*)); 92 float EXFUN(_f_ldexpf,(float, int)); 93 long long EXFUN(_f_llrint,(double)); 94 long long EXFUN(_f_llrintf,(float)); 95 long long EXFUN(_f_llrintl,(long double)); 96 float EXFUN(_f_logf,(float)); 97 float EXFUN(_f_log10f,(float)); 98 long EXFUN(_f_lrint,(double)); 99 long EXFUN(_f_lrintf,(float)); 100 long EXFUN(_f_lrintl,(long double)); 101 float EXFUN(_f_powf,(float, float)); 102 float EXFUN(_f_rint,(double)); 103 double EXFUN(_f_rintf,(float)); 104 long double EXFUN(_f_rintl,(long double)); 105 106 #define atan2f(__y,__x) _f_atan2f((__y),(__x)) 107 #define expf(__x) _f_expf(__x) 108 #define frexpf(__x,__p) _f_frexpf((__x),(__p)) 109 #define ldexpf(__x,__e) _f_ldexpf((__x),(__e)) 110 #define llrint(__x) _f_llrint((__x)) 111 #define llrintf(__x) _f_llrintf((__x)) 112 #define llrintl(__x) _f_llrintl((__x)) 113 #define logf(__x) _f_logf(__x) 114 #define log10f(__x) _f_log10f(__x) 115 #define lrint(__x) _f_lrint((__x)) 116 #define lrintf(__x) _f_lrintf((__x)) 117 #define lrintl(__x) _f_lrintl((__x)) 118 #define powf(__x,y) _f_powf((__x),(__y)) 119 #define rint(__x) _f_rint((__x)) 120 #define rintf(__x) _f_rintf((__x)) 121 #define rintl(__x) _f_rintl((__x)) 122 #endif 123 124 #endif /* GCC */ 125 126 #endif /* !__x86_64 */ 127 128 #endif /* _MACHFASTMATH_H */ 129