Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 -triple x86_64-apple-darwin12 -S -o - -emit-llvm %s | FileCheck %s -check-prefix=CHECK-NOERRNO
      2 // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=CHECK-ERRNO
      3 
      4 // Prototypes.
      5 double acos(double);
      6 long double acosl(long double);
      7 float acosf(float);
      8 double asin(double);
      9 long double asinl(long double);
     10 float asinf(float);
     11 double atan(double);
     12 long double atanl(long double);
     13 float atanf(float);
     14 double atan2(double, double);
     15 long double atan2l(long double, long double);
     16 float atan2f(float, float);
     17 double ceil(double);
     18 long double ceill(long double);
     19 float ceilf(float);
     20 double copysign(double, double);
     21 long double copysignl(long double, long double);
     22 float copysignf(float, float);
     23 double cos(double);
     24 long double cosl(long double);
     25 float cosf(float);
     26 double exp(double);
     27 long double expl(long double);
     28 float expf(float);
     29 double exp2(double);
     30 long double exp2l(long double);
     31 float exp2f(float);
     32 double fabs(double);
     33 long double fabsl(long double);
     34 float fabsf(float);
     35 double floor(double);
     36 long double floorl(long double);
     37 float floorf(float);
     38 double fma(double, double, double);
     39 long double fmal(long double, long double, long double);
     40 float fmaf(float, float, float);
     41 double fmax(double, double);
     42 long double fmaxl(long double, long double);
     43 float fmaxf(float, float);
     44 double fmin(double, double);
     45 long double fminl(long double, long double);
     46 float fminf(float, float);
     47 double log(double);
     48 long double logl(long double);
     49 float logf(float);
     50 double log2(double);
     51 long double log2l(long double);
     52 float log2f(float);
     53 double nearbyint(double);
     54 long double nearbyintl(long double);
     55 float nearbyintf(float);
     56 double pow(double, double);
     57 long double powl(long double, long double);
     58 float powf(float, float);
     59 double rint(double);
     60 long double rintl(long double);
     61 float rintf(float);
     62 double round(double);
     63 long double roundl(long double);
     64 float roundf(float);
     65 double sin(double);
     66 long double sinl(long double);
     67 float sinf(float);
     68 double sqrt(double);
     69 long double sqrtl(long double);
     70 float sqrtf(float);
     71 double tan(double);
     72 long double tanl(long double);
     73 float tanf(float);
     74 double trunc(double);
     75 long double truncl(long double);
     76 float truncf(float);
     77 
     78 // Force emission of the declare statements.
     79 void *use[] = {
     80   acos, acosl, acosf, asin, asinl, asinf, atan, atanl, atanf, atan2, atan2l,
     81   atan2f, ceil, ceill, ceilf, copysign, copysignl, copysignf, cos, cosl, cosf,
     82   exp, expl, expf, exp2, exp2l, exp2f, fabs, fabsl, fabsf, floor, floorl,
     83   floorf, fma, fmal, fmaf, fmax, fmaxl, fmaxf, fmin, fminl, fminf, log, logl,
     84   logf, log2, log2l, log2f, nearbyint, nearbyintl, nearbyintf, pow, powl, powf,
     85   rint, rintl, rintf, round, roundl, roundf, sin, sinl, sinf, sqrt, sqrtl,
     86   sqrtf, tan, tanl, tanf, trunc, truncl, truncf
     87 };
     88 
     89 // CHECK-NOERRNO: declare double @acos(double) [[NUW:#[0-9]+]]
     90 // CHECK-NOERRNO: declare x86_fp80 @acosl(x86_fp80) [[NUW]]
     91 // CHECK-NOERRNO: declare float @acosf(float) [[NUW]]
     92 // CHECK-NOERRNO: declare double @asin(double) [[NUW]]
     93 // CHECK-NOERRNO: declare x86_fp80 @asinl(x86_fp80) [[NUW]]
     94 // CHECK-NOERRNO: declare float @asinf(float) [[NUW]]
     95 // CHECK-NOERRNO: declare double @atan(double) [[NUW]]
     96 // CHECK-NOERRNO: declare x86_fp80 @atanl(x86_fp80) [[NUW]]
     97 // CHECK-NOERRNO: declare float @atanf(float) [[NUW]]
     98 // CHECK-NOERRNO: declare double @atan2(double, double) [[NUW]]
     99 // CHECK-NOERRNO: declare x86_fp80 @atan2l(x86_fp80, x86_fp80) [[NUW]]
    100 // CHECK-NOERRNO: declare float @atan2f(float, float) [[NUW]]
    101 // CHECK-NOERRNO: declare double @ceil(double) [[NUW]]
    102 // CHECK-NOERRNO: declare x86_fp80 @ceill(x86_fp80) [[NUW]]
    103 // CHECK-NOERRNO: declare float @ceilf(float) [[NUW]]
    104 // CHECK-NOERRNO: declare double @copysign(double, double) [[NUW]]
    105 // CHECK-NOERRNO: declare x86_fp80 @copysignl(x86_fp80, x86_fp80) [[NUW]]
    106 // CHECK-NOERRNO: declare float @copysignf(float, float) [[NUW]]
    107 // CHECK-NOERRNO: declare double @cos(double) [[NUW]]
    108 // CHECK-NOERRNO: declare x86_fp80 @cosl(x86_fp80) [[NUW]]
    109 // CHECK-NOERRNO: declare float @cosf(float) [[NUW]]
    110 // CHECK-NOERRNO: declare double @exp(double) [[NUW]]
    111 // CHECK-NOERRNO: declare x86_fp80 @expl(x86_fp80) [[NUW]]
    112 // CHECK-NOERRNO: declare float @expf(float) [[NUW]]
    113 // CHECK-NOERRNO: declare double @exp2(double) [[NUW]]
    114 // CHECK-NOERRNO: declare x86_fp80 @exp2l(x86_fp80) [[NUW]]
    115 // CHECK-NOERRNO: declare float @exp2f(float) [[NUW]]
    116 // CHECK-NOERRNO: declare double @fabs(double) [[NUW]]
    117 // CHECK-NOERRNO: declare x86_fp80 @fabsl(x86_fp80) [[NUW]]
    118 // CHECK-NOERRNO: declare float @fabsf(float) [[NUW]]
    119 // CHECK-NOERRNO: declare double @floor(double) [[NUW]]
    120 // CHECK-NOERRNO: declare x86_fp80 @floorl(x86_fp80) [[NUW]]
    121 // CHECK-NOERRNO: declare float @floorf(float) [[NUW]]
    122 // CHECK-NOERRNO: declare double @fma(double, double, double) [[NUW]]
    123 // CHECK-NOERRNO: declare x86_fp80 @fmal(x86_fp80, x86_fp80, x86_fp80) [[NUW]]
    124 // CHECK-NOERRNO: declare float @fmaf(float, float, float) [[NUW]]
    125 // CHECK-NOERRNO: declare double @fmax(double, double) [[NUW]]
    126 // CHECK-NOERRNO: declare x86_fp80 @fmaxl(x86_fp80, x86_fp80) [[NUW]]
    127 // CHECK-NOERRNO: declare float @fmaxf(float, float) [[NUW]]
    128 // CHECK-NOERRNO: declare double @fmin(double, double) [[NUW]]
    129 // CHECK-NOERRNO: declare x86_fp80 @fminl(x86_fp80, x86_fp80) [[NUW]]
    130 // CHECK-NOERRNO: declare float @fminf(float, float) [[NUW]]
    131 // CHECK-NOERRNO: declare double @log(double) [[NUW]]
    132 // CHECK-NOERRNO: declare x86_fp80 @logl(x86_fp80) [[NUW]]
    133 // CHECK-NOERRNO: declare float @logf(float) [[NUW]]
    134 // CHECK-NOERRNO: declare double @log2(double) [[NUW]]
    135 // CHECK-NOERRNO: declare x86_fp80 @log2l(x86_fp80) [[NUW]]
    136 // CHECK-NOERRNO: declare float @log2f(float) [[NUW]]
    137 // CHECK-NOERRNO: declare double @nearbyint(double) [[NUW]]
    138 // CHECK-NOERRNO: declare x86_fp80 @nearbyintl(x86_fp80) [[NUW]]
    139 // CHECK-NOERRNO: declare float @nearbyintf(float) [[NUW]]
    140 // CHECK-NOERRNO: declare double @pow(double, double) [[NUW]]
    141 // CHECK-NOERRNO: declare x86_fp80 @powl(x86_fp80, x86_fp80) [[NUW]]
    142 // CHECK-NOERRNO: declare float @powf(float, float) [[NUW]]
    143 // CHECK-NOERRNO: declare double @rint(double) [[NUW]]
    144 // CHECK-NOERRNO: declare x86_fp80 @rintl(x86_fp80) [[NUW]]
    145 // CHECK-NOERRNO: declare float @rintf(float) [[NUW]]
    146 // CHECK-NOERRNO: declare double @round(double) [[NUW]]
    147 // CHECK-NOERRNO: declare x86_fp80 @roundl(x86_fp80) [[NUW]]
    148 // CHECK-NOERRNO: declare float @roundf(float) [[NUW]]
    149 // CHECK-NOERRNO: declare double @sin(double) [[NUW]]
    150 // CHECK-NOERRNO: declare x86_fp80 @sinl(x86_fp80) [[NUW]]
    151 // CHECK-NOERRNO: declare float @sinf(float) [[NUW]]
    152 // CHECK-NOERRNO: declare double @sqrt(double) [[NUW]]
    153 // CHECK-NOERRNO: declare x86_fp80 @sqrtl(x86_fp80) [[NUW]]
    154 // CHECK-NOERRNO: declare float @sqrtf(float) [[NUW]]
    155 // CHECK-NOERRNO: declare double @tan(double) [[NUW]]
    156 // CHECK-NOERRNO: declare x86_fp80 @tanl(x86_fp80) [[NUW]]
    157 // CHECK-NOERRNO: declare float @tanf(float) [[NUW]]
    158 // CHECK-NOERRNO: declare double @trunc(double) [[NUW]]
    159 // CHECK-NOERRNO: declare x86_fp80 @truncl(x86_fp80) [[NUW]]
    160 // CHECK-NOERRNO: declare float @truncf(float) [[NUW]]
    161 
    162 // CHECK-ERRNO: declare double @ceil(double) [[NUW:#[0-9]+]]
    163 // CHECK-ERRNO: declare x86_fp80 @ceill(x86_fp80) [[NUW]]
    164 // CHECK-ERRNO: declare float @ceilf(float) [[NUW]]
    165 // CHECK-ERRNO: declare double @copysign(double, double) [[NUW]]
    166 // CHECK-ERRNO: declare x86_fp80 @copysignl(x86_fp80, x86_fp80) [[NUW]]
    167 // CHECK-ERRNO: declare float @copysignf(float, float) [[NUW]]
    168 // CHECK-ERRNO: declare double @fabs(double) [[NUW]]
    169 // CHECK-ERRNO: declare x86_fp80 @fabsl(x86_fp80) [[NUW]]
    170 // CHECK-ERRNO: declare float @fabsf(float) [[NUW]]
    171 // CHECK-ERRNO: declare double @floor(double) [[NUW]]
    172 // CHECK-ERRNO: declare x86_fp80 @floorl(x86_fp80) [[NUW]]
    173 // CHECK-ERRNO: declare float @floorf(float) [[NUW]]
    174 // CHECK-ERRNO: declare double @fmax(double, double) [[NUW]]
    175 // CHECK-ERRNO: declare x86_fp80 @fmaxl(x86_fp80, x86_fp80) [[NUW]]
    176 // CHECK-ERRNO: declare float @fmaxf(float, float) [[NUW]]
    177 // CHECK-ERRNO: declare double @fmin(double, double) [[NUW]]
    178 // CHECK-ERRNO: declare x86_fp80 @fminl(x86_fp80, x86_fp80) [[NUW]]
    179 // CHECK-ERRNO: declare float @fminf(float, float) [[NUW]]
    180 // CHECK-ERRNO: declare double @nearbyint(double) [[NUW]]
    181 // CHECK-ERRNO: declare x86_fp80 @nearbyintl(x86_fp80) [[NUW]]
    182 // CHECK-ERRNO: declare float @nearbyintf(float) [[NUW]]
    183 // CHECK-ERRNO: declare double @rint(double) [[NUW]]
    184 // CHECK-ERRNO: declare x86_fp80 @rintl(x86_fp80) [[NUW]]
    185 // CHECK-ERRNO: declare float @rintf(float) [[NUW]]
    186 // CHECK-ERRNO: declare double @round(double) [[NUW]]
    187 // CHECK-ERRNO: declare x86_fp80 @roundl(x86_fp80) [[NUW]]
    188 // CHECK-ERRNO: declare float @roundf(float) [[NUW]]
    189 // CHECK-ERRNO: declare double @trunc(double) [[NUW]]
    190 // CHECK-ERRNO: declare x86_fp80 @truncl(x86_fp80) [[NUW]]
    191 // CHECK-ERRNO: declare float @truncf(float) [[NUW]]
    192 
    193 // CHECK-NOERRNO: attributes [[NUW]] = { nounwind readnone{{.*}} }
    194 
    195 // CHECK-ERRNO: attributes [[NUW]] = { nounwind readnone{{.*}} }
    196