1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO 2 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO 3 4 // Test attributes and builtin codegen of complex library calls. 5 6 void foo(float f) { 7 cabs(f); cabsf(f); cabsl(f); 8 9 // NO__ERRNO: declare double @cabs(double noundef, double noundef) [[READNONE:#[0-9]+]] 10 // NO__ERRNO: declare float @cabsf(<2 x float> noundef) [[READNONE]] 11 // NO__ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE:#[0-9]+]] 12 // HAS_ERRNO: declare double @cabs(double noundef, double noundef) [[NOT_READNONE:#[0-9]+]] 13 // HAS_ERRNO: declare float @cabsf(<2 x float> noundef) [[NOT_READNONE]] 14 // HAS_ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 15 16 cacos(f); cacosf(f); cacosl(f); 17 18 // NO__ERRNO: declare { double, double } @cacos(double noundef, double noundef) [[READNONE]] 19 // NO__ERRNO: declare <2 x float> @cacosf(<2 x float> noundef) [[READNONE]] 20 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 21 // HAS_ERRNO: declare { double, double } @cacos(double noundef, double noundef) [[NOT_READNONE]] 22 // HAS_ERRNO: declare <2 x float> @cacosf(<2 x float> noundef) [[NOT_READNONE]] 23 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 24 25 cacosh(f); cacoshf(f); cacoshl(f); 26 27 // NO__ERRNO: declare { double, double } @cacosh(double noundef, double noundef) [[READNONE]] 28 // NO__ERRNO: declare <2 x float> @cacoshf(<2 x float> noundef) [[READNONE]] 29 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 30 // HAS_ERRNO: declare { double, double } @cacosh(double noundef, double noundef) [[NOT_READNONE]] 31 // HAS_ERRNO: declare <2 x float> @cacoshf(<2 x float> noundef) [[NOT_READNONE]] 32 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 33 34 carg(f); cargf(f); cargl(f); 35 36 // NO__ERRNO: declare double @carg(double noundef, double noundef) [[READNONE]] 37 // NO__ERRNO: declare float @cargf(<2 x float> noundef) [[READNONE]] 38 // NO__ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 39 // HAS_ERRNO: declare double @carg(double noundef, double noundef) [[NOT_READNONE]] 40 // HAS_ERRNO: declare float @cargf(<2 x float> noundef) [[NOT_READNONE]] 41 // HAS_ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 42 43 casin(f); casinf(f); casinl(f); 44 45 // NO__ERRNO: declare { double, double } @casin(double noundef, double noundef) [[READNONE]] 46 // NO__ERRNO: declare <2 x float> @casinf(<2 x float> noundef) [[READNONE]] 47 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 48 // HAS_ERRNO: declare { double, double } @casin(double noundef, double noundef) [[NOT_READNONE]] 49 // HAS_ERRNO: declare <2 x float> @casinf(<2 x float> noundef) [[NOT_READNONE]] 50 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 51 52 casinh(f); casinhf(f); casinhl(f); 53 54 // NO__ERRNO: declare { double, double } @casinh(double noundef, double noundef) [[READNONE]] 55 // NO__ERRNO: declare <2 x float> @casinhf(<2 x float> noundef) [[READNONE]] 56 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 57 // HAS_ERRNO: declare { double, double } @casinh(double noundef, double noundef) [[NOT_READNONE]] 58 // HAS_ERRNO: declare <2 x float> @casinhf(<2 x float> noundef) [[NOT_READNONE]] 59 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 60 61 catan(f); catanf(f); catanl(f); 62 63 // NO__ERRNO: declare { double, double } @catan(double noundef, double noundef) [[READNONE]] 64 // NO__ERRNO: declare <2 x float> @catanf(<2 x float> noundef) [[READNONE]] 65 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 66 // HAS_ERRNO: declare { double, double } @catan(double noundef, double noundef) [[NOT_READNONE]] 67 // HAS_ERRNO: declare <2 x float> @catanf(<2 x float> noundef) [[NOT_READNONE]] 68 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 69 70 catanh(f); catanhf(f); catanhl(f); 71 72 // NO__ERRNO: declare { double, double } @catanh(double noundef, double noundef) [[READNONE]] 73 // NO__ERRNO: declare <2 x float> @catanhf(<2 x float> noundef) [[READNONE]] 74 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 75 // HAS_ERRNO: declare { double, double } @catanh(double noundef, double noundef) [[NOT_READNONE]] 76 // HAS_ERRNO: declare <2 x float> @catanhf(<2 x float> noundef) [[NOT_READNONE]] 77 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 78 79 ccos(f); ccosf(f); ccosl(f); 80 81 // NO__ERRNO: declare { double, double } @ccos(double noundef, double noundef) [[READNONE]] 82 // NO__ERRNO: declare <2 x float> @ccosf(<2 x float> noundef) [[READNONE]] 83 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 84 // HAS_ERRNO: declare { double, double } @ccos(double noundef, double noundef) [[NOT_READNONE]] 85 // HAS_ERRNO: declare <2 x float> @ccosf(<2 x float> noundef) [[NOT_READNONE]] 86 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 87 88 ccosh(f); ccoshf(f); ccoshl(f); 89 90 // NO__ERRNO: declare { double, double } @ccosh(double noundef, double noundef) [[READNONE]] 91 // NO__ERRNO: declare <2 x float> @ccoshf(<2 x float> noundef) [[READNONE]] 92 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 93 // HAS_ERRNO: declare { double, double } @ccosh(double noundef, double noundef) [[NOT_READNONE]] 94 // HAS_ERRNO: declare <2 x float> @ccoshf(<2 x float> noundef) [[NOT_READNONE]] 95 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 96 97 cexp(f); cexpf(f); cexpl(f); 98 99 // NO__ERRNO: declare { double, double } @cexp(double noundef, double noundef) [[READNONE]] 100 // NO__ERRNO: declare <2 x float> @cexpf(<2 x float> noundef) [[READNONE]] 101 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 102 // HAS_ERRNO: declare { double, double } @cexp(double noundef, double noundef) [[NOT_READNONE]] 103 // HAS_ERRNO: declare <2 x float> @cexpf(<2 x float> noundef) [[NOT_READNONE]] 104 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 105 106 cimag(f); cimagf(f); cimagl(f); 107 108 // NO__ERRNO-NOT: .cimag 109 // NO__ERRNO-NOT: @cimag 110 // HAS_ERRNO-NOT: .cimag 111 // HAS_ERRNO-NOT: @cimag 112 113 conj(f); conjf(f); conjl(f); 114 115 // NO__ERRNO-NOT: .conj 116 // NO__ERRNO-NOT: @conj 117 // HAS_ERRNO-NOT: .conj 118 // HAS_ERRNO-NOT: @conj 119 120 clog(f); clogf(f); clogl(f); 121 122 // NO__ERRNO: declare { double, double } @clog(double noundef, double noundef) [[READNONE]] 123 // NO__ERRNO: declare <2 x float> @clogf(<2 x float> noundef) [[READNONE]] 124 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 125 // HAS_ERRNO: declare { double, double } @clog(double noundef, double noundef) [[NOT_READNONE]] 126 // HAS_ERRNO: declare <2 x float> @clogf(<2 x float> noundef) [[NOT_READNONE]] 127 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 128 129 cproj(f); cprojf(f); cprojl(f); 130 131 // NO__ERRNO: declare { double, double } @cproj(double noundef, double noundef) [[READNONE]] 132 // NO__ERRNO: declare <2 x float> @cprojf(<2 x float> noundef) [[READNONE]] 133 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 134 // HAS_ERRNO: declare { double, double } @cproj(double noundef, double noundef) [[READNONE:#[0-9]+]] 135 // HAS_ERRNO: declare <2 x float> @cprojf(<2 x float> noundef) [[READNONE]] 136 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[WILLRETURN_NOT_READNONE:#[0-9]+]] 137 138 cpow(f,f); cpowf(f,f); cpowl(f,f); 139 140 // NO__ERRNO: declare { double, double } @cpow(double noundef, double noundef, double noundef, double noundef) [[READNONE]] 141 // NO__ERRNO: declare <2 x float> @cpowf(<2 x float> noundef, <2 x float> noundef) [[READNONE]] 142 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16, { x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 143 // HAS_ERRNO: declare { double, double } @cpow(double noundef, double noundef, double noundef, double noundef) [[NOT_READNONE]] 144 // HAS_ERRNO: declare <2 x float> @cpowf(<2 x float> noundef, <2 x float> noundef) [[NOT_READNONE]] 145 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16, { x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 146 147 creal(f); crealf(f); creall(f); 148 149 // NO__ERRNO-NOT: .creal 150 // NO__ERRNO-NOT: @creal 151 // HAS_ERRNO-NOT: .creal 152 // HAS_ERRNO-NOT: @creal 153 154 csin(f); csinf(f); csinl(f); 155 156 // NO__ERRNO: declare { double, double } @csin(double noundef, double noundef) [[READNONE]] 157 // NO__ERRNO: declare <2 x float> @csinf(<2 x float> noundef) [[READNONE]] 158 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 159 // HAS_ERRNO: declare { double, double } @csin(double noundef, double noundef) [[NOT_READNONE]] 160 // HAS_ERRNO: declare <2 x float> @csinf(<2 x float> noundef) [[NOT_READNONE]] 161 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 162 163 csinh(f); csinhf(f); csinhl(f); 164 165 // NO__ERRNO: declare { double, double } @csinh(double noundef, double noundef) [[READNONE]] 166 // NO__ERRNO: declare <2 x float> @csinhf(<2 x float> noundef) [[READNONE]] 167 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 168 // HAS_ERRNO: declare { double, double } @csinh(double noundef, double noundef) [[NOT_READNONE]] 169 // HAS_ERRNO: declare <2 x float> @csinhf(<2 x float> noundef) [[NOT_READNONE]] 170 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 171 172 csqrt(f); csqrtf(f); csqrtl(f); 173 174 // NO__ERRNO: declare { double, double } @csqrt(double noundef, double noundef) [[READNONE]] 175 // NO__ERRNO: declare <2 x float> @csqrtf(<2 x float> noundef) [[READNONE]] 176 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 177 // HAS_ERRNO: declare { double, double } @csqrt(double noundef, double noundef) [[NOT_READNONE]] 178 // HAS_ERRNO: declare <2 x float> @csqrtf(<2 x float> noundef) [[NOT_READNONE]] 179 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 180 181 ctan(f); ctanf(f); ctanl(f); 182 183 // NO__ERRNO: declare { double, double } @ctan(double noundef, double noundef) [[READNONE]] 184 // NO__ERRNO: declare <2 x float> @ctanf(<2 x float> noundef) [[READNONE]] 185 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 186 // HAS_ERRNO: declare { double, double } @ctan(double noundef, double noundef) [[NOT_READNONE]] 187 // HAS_ERRNO: declare <2 x float> @ctanf(<2 x float> noundef) [[NOT_READNONE]] 188 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 189 190 ctanh(f); ctanhf(f); ctanhl(f); 191 192 // NO__ERRNO: declare { double, double } @ctanh(double noundef, double noundef) [[READNONE]] 193 // NO__ERRNO: declare <2 x float> @ctanhf(<2 x float> noundef) [[READNONE]] 194 // NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 195 // HAS_ERRNO: declare { double, double } @ctanh(double noundef, double noundef) [[NOT_READNONE]] 196 // HAS_ERRNO: declare <2 x float> @ctanhf(<2 x float> noundef) [[NOT_READNONE]] 197 // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* noundef byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] 198 }; 199 200 // NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } 201 // NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} } 202 203 // HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} } 204 // HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } 205 // HAS_ERRNO: attributes [[WILLRETURN_NOT_READNONE]] = { nounwind willreturn {{.*}} } 206