From: Sanjay Patel Date: Tue, 7 Nov 2017 15:13:22 +0000 (+0000) Subject: [CodeGen] split math and complex tests into separate files; NFCI X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f31b02cad84b2a02a1c209e28bc076a674ca420e;p=clang [CodeGen] split math and complex tests into separate files; NFCI The files are already large, and we may need to add even more RUNs to distinguish differences based on OS, environment, or other platform things. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317583 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGen/complex-builtins.c b/test/CodeGen/complex-builtins.c new file mode 100644 index 0000000000..687a294250 --- /dev/null +++ b/test/CodeGen/complex-builtins.c @@ -0,0 +1,206 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO + +// Test attributes and codegen of complex builtins. + +void foo(float f) { + __builtin_cabs(f); __builtin_cabsf(f); __builtin_cabsl(f); + +// NO__ERRNO: declare double @cabs(double, double) [[READNONE:#[0-9]+]] +// NO__ERRNO: declare float @cabsf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE:#[0-9]+]] +// HAS_ERRNO: declare double @cabs(double, double) [[READNONE:#[0-9]+]] +// HAS_ERRNO: declare float @cabsf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE:#[0-9]+]] + + __builtin_cacos(f); __builtin_cacosf(f); __builtin_cacosl(f); + +// NO__ERRNO: declare { double, double } @cacos(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @cacosf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @cacos(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @cacosf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_cacosh(f); __builtin_cacoshf(f); __builtin_cacoshl(f); + +// NO__ERRNO: declare { double, double } @cacosh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @cacosh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_carg(f); __builtin_cargf(f); __builtin_cargl(f); + +// NO__ERRNO: declare double @carg(double, double) [[READNONE]] +// NO__ERRNO: declare float @cargf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare double @carg(double, double) [[READNONE]] +// HAS_ERRNO: declare float @cargf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_casin(f); __builtin_casinf(f); __builtin_casinl(f); + +// NO__ERRNO: declare { double, double } @casin(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @casinf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @casin(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @casinf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_casinh(f); __builtin_casinhf(f); __builtin_casinhl(f); + +// NO__ERRNO: declare { double, double } @casinh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @casinhf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @casinh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @casinhf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_catan(f); __builtin_catanf(f); __builtin_catanl(f); + +// NO__ERRNO: declare { double, double } @catan(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @catanf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @catan(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @catanf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_catanh(f); __builtin_catanhf(f); __builtin_catanhl(f); + +// NO__ERRNO: declare { double, double } @catanh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @catanhf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @catanh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @catanhf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_ccos(f); __builtin_ccosf(f); __builtin_ccosl(f); + +// NO__ERRNO: declare { double, double } @ccos(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @ccosf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @ccos(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @ccosf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_ccosh(f); __builtin_ccoshf(f); __builtin_ccoshl(f); + +// NO__ERRNO: declare { double, double } @ccosh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @ccosh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_cexp(f); __builtin_cexpf(f); __builtin_cexpl(f); + +// NO__ERRNO: declare { double, double } @cexp(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @cexpf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @cexp(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @cexpf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_cimag(f); __builtin_cimagf(f); __builtin_cimagl(f); + +// NO__ERRNO-NOT: .cimag +// NO__ERRNO-NOT: @cimag +// HAS_ERRNO-NOT: .cimag +// HAS_ERRNO-NOT: @cimag + + __builtin_conj(f); __builtin_conjf(f); __builtin_conjl(f); + +// NO__ERRNO-NOT: .conj +// NO__ERRNO-NOT: @conj +// HAS_ERRNO-NOT: .conj +// HAS_ERRNO-NOT: @conj + + __builtin_clog(f); __builtin_clogf(f); __builtin_clogl(f); + +// NO__ERRNO: declare { double, double } @clog(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @clogf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @clog(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @clogf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_cproj(f); __builtin_cprojf(f); __builtin_cprojl(f); + +// NO__ERRNO: declare { double, double } @cproj(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @cproj(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_cpow(f,f); __builtin_cpowf(f,f); __builtin_cpowl(f,f); + +// NO__ERRNO: declare { double, double } @cpow(double, double, double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* byval align 16, { x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @cpow(double, double, double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* byval align 16, { x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_creal(f); __builtin_crealf(f); __builtin_creall(f); + +// NO__ERRNO-NOT: .creal +// NO__ERRNO-NOT: @creal +// HAS_ERRNO-NOT: .creal +// HAS_ERRNO-NOT: @creal + + __builtin_csin(f); __builtin_csinf(f); __builtin_csinl(f); + +// NO__ERRNO: declare { double, double } @csin(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @csinf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @csin(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @csinf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_csinh(f); __builtin_csinhf(f); __builtin_csinhl(f); + +// NO__ERRNO: declare { double, double } @csinh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @csinhf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @csinh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @csinhf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_csqrt(f); __builtin_csqrtf(f); __builtin_csqrtl(f); + +// NO__ERRNO: declare { double, double } @csqrt(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @csqrtf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @csqrt(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @csqrtf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_ctan(f); __builtin_ctanf(f); __builtin_ctanl(f); + +// NO__ERRNO: declare { double, double } @ctan(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @ctanf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @ctan(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @ctanf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + __builtin_ctanh(f); __builtin_ctanhf(f); __builtin_ctanhl(f); + +// NO__ERRNO: declare { double, double } @ctanh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @ctanh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +}; + + +// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } +// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} } + +// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } +// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} } + diff --git a/test/CodeGen/complex-libcalls.c b/test/CodeGen/complex-libcalls.c new file mode 100644 index 0000000000..72aa74d170 --- /dev/null +++ b/test/CodeGen/complex-libcalls.c @@ -0,0 +1,208 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO + +// Test attributes and builtin codegen of complex library calls. + +void foo(float f) { + cabs(f); cabsf(f); cabsl(f); + +// NO__ERRNO: declare double @cabs(double, double) [[READNONE:#[0-9]+]] +// NO__ERRNO: declare float @cabsf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE:#[0-9+]]] +// HAS_ERRNO: declare double @cabs(double, double) [[READNONE:#[0-9]+]] +// HAS_ERRNO: declare float @cabsf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE:#[0-9]+]] + + cacos(f); cacosf(f); cacosl(f); + +// NO__ERRNO: declare { double, double } @cacos(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @cacosf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @cacos(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @cacosf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + cacosh(f); cacoshf(f); cacoshl(f); + +// NO__ERRNO: declare { double, double } @cacosh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @cacosh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + carg(f); cargf(f); cargl(f); + +// NO__ERRNO: declare double @carg(double, double) [[READNONE]] +// NO__ERRNO: declare float @cargf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare double @carg(double, double) [[READNONE]] +// HAS_ERRNO: declare float @cargf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + casin(f); casinf(f); casinl(f); + +// NO__ERRNO: declare { double, double } @casin(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @casinf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @casin(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @casinf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + casinh(f); casinhf(f); casinhl(f); + +// NO__ERRNO: declare { double, double } @casinh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @casinhf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @casinh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @casinhf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + catan(f); catanf(f); catanl(f); + +// NO__ERRNO: declare { double, double } @catan(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @catanf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @catan(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @catanf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + catanh(f); catanhf(f); catanhl(f); + +// NO__ERRNO: declare { double, double } @catanh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @catanhf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @catanh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @catanhf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + ccos(f); ccosf(f); ccosl(f); + +// NO__ERRNO: declare { double, double } @ccos(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @ccosf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @ccos(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @ccosf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + ccosh(f); ccoshf(f); ccoshl(f); + +// NO__ERRNO: declare { double, double } @ccosh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @ccosh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + cexp(f); cexpf(f); cexpl(f); + +// NO__ERRNO: declare { double, double } @cexp(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @cexpf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @cexp(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @cexpf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + cimag(f); cimagf(f); cimagl(f); + +// NO__ERRNO-NOT: .cimag +// NO__ERRNO-NOT: @cimag +// HAS_ERRNO-NOT: .cimag +// HAS_ERRNO-NOT: @cimag + + conj(f); conjf(f); conjl(f); + +// NO__ERRNO: declare { double, double } @conj(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @conjf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @conjl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @conj(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @conjf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @conjl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + clog(f); clogf(f); clogl(f); + +// NO__ERRNO: declare { double, double } @clog(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @clogf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @clog(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @clogf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + cproj(f); cprojf(f); cprojl(f); + +// NO__ERRNO: declare { double, double } @cproj(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @cproj(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + cpow(f,f); cpowf(f,f); cpowl(f,f); + +// NO__ERRNO: declare { double, double } @cpow(double, double, double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* byval align 16, { x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @cpow(double, double, double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* byval align 16, { x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + creal(f); crealf(f); creall(f); + +// NO__ERRNO-NOT: .creal +// NO__ERRNO-NOT: @creal +// HAS_ERRNO-NOT: .creal +// HAS_ERRNO-NOT: @creal + + csin(f); csinf(f); csinl(f); + +// NO__ERRNO: declare { double, double } @csin(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @csinf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @csin(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @csinf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + csinh(f); csinhf(f); csinhl(f); + +// NO__ERRNO: declare { double, double } @csinh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @csinhf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @csinh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @csinhf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + csqrt(f); csqrtf(f); csqrtl(f); + +// NO__ERRNO: declare { double, double } @csqrt(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @csqrtf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @csqrt(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @csqrtf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + ctan(f); ctanf(f); ctanl(f); + +// NO__ERRNO: declare { double, double } @ctan(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @ctanf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @ctan(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @ctanf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] + + ctanh(f); ctanhf(f); ctanhl(f); + +// NO__ERRNO: declare { double, double } @ctanh(double, double) [[READNONE]] +// NO__ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[READNONE]] +// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +// HAS_ERRNO: declare { double, double } @ctanh(double, double) [[READNONE]] +// HAS_ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[READNONE]] +// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] +}; + + +// NO__ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } +// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} } + +// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}readnone{{.*}} } +// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind "correctly{{.*}} } + diff --git a/test/CodeGen/builtin-errno.c b/test/CodeGen/math-builtins.c similarity index 70% rename from test/CodeGen/builtin-errno.c rename to test/CodeGen/math-builtins.c index 4b2361d12d..cb9b597458 100644 --- a/test/CodeGen/builtin-errno.c +++ b/test/CodeGen/math-builtins.c @@ -1,32 +1,9 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO -// Test math, complex, and other builtin attributes to see how errno affects the resulting codegen. - - -double *d; -float f; -float *fp; -long double *l; -int *i; -const char *c; - -void foo() { - __builtin_abs(f); __builtin_labs(f); __builtin_llabs(f); - -// NO__ERRNO-NOT: .abs -// NO__ERRNO-NOT: .labs -// NO__ERRNO-NOT: .llabs -// NO__ERRNO-NOT: @abs -// NO__ERRNO-NOT: @labs -// NO__ERRNO-NOT: @llabs -// HAS_ERRNO-NOT: .abs -// HAS_ERRNO-NOT: .labs -// HAS_ERRNO-NOT: .llabs -// HAS_ERRNO-NOT: @abs -// HAS_ERRNO-NOT: @labs -// HAS_ERRNO-NOT: @llabs +// Test attributes and codegen of math builtins. +void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) { __builtin_atan2(f,f); __builtin_atan2f(f,f) ; __builtin_atan2l(f, f); // NO__ERRNO: declare double @atan2(double, double) [[READNONE:#[0-9]+]] @@ -570,200 +547,6 @@ void foo() { // HAS_ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]] // HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]] - - /* complex */ - - __builtin_cabs(f); __builtin_cabsf(f); __builtin_cabsl(f); - -// NO__ERRNO: declare double @cabs(double, double) [[READNONE]] -// NO__ERRNO: declare float @cabsf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare double @cabs(double, double) [[READNONE]] -// HAS_ERRNO: declare float @cabsf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_cacos(f); __builtin_cacosf(f); __builtin_cacosl(f); - -// NO__ERRNO: declare { double, double } @cacos(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @cacosf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cacos(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @cacosf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_cacosh(f); __builtin_cacoshf(f); __builtin_cacoshl(f); - -// NO__ERRNO: declare { double, double } @cacosh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cacosh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_carg(f); __builtin_cargf(f); __builtin_cargl(f); - -// NO__ERRNO: declare double @carg(double, double) [[READNONE]] -// NO__ERRNO: declare float @cargf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare double @carg(double, double) [[READNONE]] -// HAS_ERRNO: declare float @cargf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_casin(f); __builtin_casinf(f); __builtin_casinl(f); - -// NO__ERRNO: declare { double, double } @casin(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @casinf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @casin(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @casinf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_casinh(f); __builtin_casinhf(f); __builtin_casinhl(f); - -// NO__ERRNO: declare { double, double } @casinh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @casinhf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @casinh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @casinhf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_catan(f); __builtin_catanf(f); __builtin_catanl(f); - -// NO__ERRNO: declare { double, double } @catan(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @catanf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @catan(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @catanf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_catanh(f); __builtin_catanhf(f); __builtin_catanhl(f); - -// NO__ERRNO: declare { double, double } @catanh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @catanhf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @catanh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @catanhf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_ccos(f); __builtin_ccosf(f); __builtin_ccosl(f); - -// NO__ERRNO: declare { double, double } @ccos(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @ccosf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @ccos(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @ccosf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_ccosh(f); __builtin_ccoshf(f); __builtin_ccoshl(f); - -// NO__ERRNO: declare { double, double } @ccosh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @ccosh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_cexp(f); __builtin_cexpf(f); __builtin_cexpl(f); - -// NO__ERRNO: declare { double, double } @cexp(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @cexpf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cexp(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @cexpf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_cimag(f); __builtin_cimagf(f); __builtin_cimagl(f); - -// NO__ERRNO-NOT: .cimag -// NO__ERRNO-NOT: @cimag -// HAS_ERRNO-NOT: .cimag -// HAS_ERRNO-NOT: @cimag - - __builtin_conj(f); __builtin_conjf(f); __builtin_conjl(f); - -// NO__ERRNO-NOT: .conj -// NO__ERRNO-NOT: @conj -// HAS_ERRNO-NOT: .conj -// HAS_ERRNO-NOT: @conj - - __builtin_clog(f); __builtin_clogf(f); __builtin_clogl(f); - -// NO__ERRNO: declare { double, double } @clog(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @clogf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @clog(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @clogf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_cproj(f); __builtin_cprojf(f); __builtin_cprojl(f); - -// NO__ERRNO: declare { double, double } @cproj(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cproj(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_cpow(f,f); __builtin_cpowf(f,f); __builtin_cpowl(f,f); - -// NO__ERRNO: declare { double, double } @cpow(double, double, double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* byval align 16, { x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cpow(double, double, double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* byval align 16, { x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_creal(f); __builtin_crealf(f); __builtin_creall(f); - -// NO__ERRNO-NOT: .creal -// NO__ERRNO-NOT: @creal -// HAS_ERRNO-NOT: .creal -// HAS_ERRNO-NOT: @creal - - __builtin_csin(f); __builtin_csinf(f); __builtin_csinl(f); - -// NO__ERRNO: declare { double, double } @csin(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @csinf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @csin(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @csinf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_csinh(f); __builtin_csinhf(f); __builtin_csinhl(f); - -// NO__ERRNO: declare { double, double } @csinh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @csinhf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @csinh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @csinhf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_csqrt(f); __builtin_csqrtf(f); __builtin_csqrtl(f); - -// NO__ERRNO: declare { double, double } @csqrt(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @csqrtf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @csqrt(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @csqrtf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_ctan(f); __builtin_ctanf(f); __builtin_ctanl(f); - -// NO__ERRNO: declare { double, double } @ctan(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @ctanf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @ctan(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @ctanf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - __builtin_ctanh(f); __builtin_ctanhf(f); __builtin_ctanhl(f); - -// NO__ERRNO: declare { double, double } @ctanh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @ctanh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] }; diff --git a/test/CodeGen/libcalls-errno.c b/test/CodeGen/math-libcalls.c similarity index 68% rename from test/CodeGen/libcalls-errno.c rename to test/CodeGen/math-libcalls.c index 7813dc1cc2..fcb54ed8d9 100644 --- a/test/CodeGen/libcalls-errno.c +++ b/test/CodeGen/math-libcalls.c @@ -1,17 +1,9 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s -check-prefix=NO__ERRNO // RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=HAS_ERRNO -// Test attributes of library calls to see how errno affects the resulting codegen. +// Test attributes and builtin codegen of math library calls. - -double *d; -float f; -float *fp; -long double *l; -int *i; -const char *c; - -void foo() { +void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) { atan2(f,f); atan2f(f,f) ; atan2l(f, f); // NO__ERRNO: declare double @atan2(double, double) [[READNONE:#[0-9]+]] @@ -525,202 +517,6 @@ void foo() { // HAS_ERRNO: declare double @trunc(double) [[READNONE]] // HAS_ERRNO: declare float @truncf(float) [[READNONE]] // HAS_ERRNO: declare x86_fp80 @truncl(x86_fp80) [[READNONE]] - - /* complex */ - - cabs(f); cabsf(f); cabsl(f); - -// NO__ERRNO: declare double @cabs(double, double) [[READNONE]] -// NO__ERRNO: declare float @cabsf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare double @cabs(double, double) [[READNONE]] -// HAS_ERRNO: declare float @cabsf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @cabsl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - cacos(f); cacosf(f); cacosl(f); - -// NO__ERRNO: declare { double, double } @cacos(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @cacosf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cacos(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @cacosf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - cacosh(f); cacoshf(f); cacoshl(f); - -// NO__ERRNO: declare { double, double } @cacosh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cacosh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @cacoshf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cacoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - carg(f); cargf(f); cargl(f); - -// NO__ERRNO: declare double @carg(double, double) [[READNONE]] -// NO__ERRNO: declare float @cargf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare double @carg(double, double) [[READNONE]] -// HAS_ERRNO: declare float @cargf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare x86_fp80 @cargl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - casin(f); casinf(f); casinl(f); - -// NO__ERRNO: declare { double, double } @casin(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @casinf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @casin(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @casinf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - casinh(f); casinhf(f); casinhl(f); - -// NO__ERRNO: declare { double, double } @casinh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @casinhf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @casinh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @casinhf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @casinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - catan(f); catanf(f); catanl(f); - -// NO__ERRNO: declare { double, double } @catan(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @catanf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @catan(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @catanf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - catanh(f); catanhf(f); catanhl(f); - -// NO__ERRNO: declare { double, double } @catanh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @catanhf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @catanh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @catanhf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @catanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - ccos(f); ccosf(f); ccosl(f); - -// NO__ERRNO: declare { double, double } @ccos(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @ccosf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @ccos(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @ccosf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccosl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - ccosh(f); ccoshf(f); ccoshl(f); - -// NO__ERRNO: declare { double, double } @ccosh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @ccosh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @ccoshf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ccoshl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - cexp(f); cexpf(f); cexpl(f); - -// NO__ERRNO: declare { double, double } @cexp(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @cexpf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cexp(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @cexpf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cexpl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - cimag(f); cimagf(f); cimagl(f); - -// NO__ERRNO-NOT: .cimag -// NO__ERRNO-NOT: @cimag -// HAS_ERRNO-NOT: .cimag -// HAS_ERRNO-NOT: @cimag - - conj(f); conjf(f); conjl(f); - -// NO__ERRNO: declare { double, double } @conj(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @conjf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @conjl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @conj(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @conjf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @conjl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - clog(f); clogf(f); clogl(f); - -// NO__ERRNO: declare { double, double } @clog(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @clogf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @clog(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @clogf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @clogl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - cproj(f); cprojf(f); cprojl(f); - -// NO__ERRNO: declare { double, double } @cproj(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cproj(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - cpow(f,f); cpowf(f,f); cpowl(f,f); - -// NO__ERRNO: declare { double, double } @cpow(double, double, double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* byval align 16, { x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cpow(double, double, double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @cpowf(<2 x float>, <2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cpowl({ x86_fp80, x86_fp80 }* byval align 16, { x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - creal(f); crealf(f); creall(f); - -// NO__ERRNO-NOT: .creal -// NO__ERRNO-NOT: @creal -// HAS_ERRNO-NOT: .creal -// HAS_ERRNO-NOT: @creal - - csin(f); csinf(f); csinl(f); - -// NO__ERRNO: declare { double, double } @csin(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @csinf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @csin(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @csinf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - csinh(f); csinhf(f); csinhl(f); - -// NO__ERRNO: declare { double, double } @csinh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @csinhf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @csinh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @csinhf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csinhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - csqrt(f); csqrtf(f); csqrtl(f); - -// NO__ERRNO: declare { double, double } @csqrt(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @csqrtf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @csqrt(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @csqrtf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @csqrtl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - ctan(f); ctanf(f); ctanl(f); - -// NO__ERRNO: declare { double, double } @ctan(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @ctanf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @ctan(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @ctanf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] - - ctanh(f); ctanhf(f); ctanhl(f); - -// NO__ERRNO: declare { double, double } @ctanh(double, double) [[READNONE]] -// NO__ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @ctanh(double, double) [[READNONE]] -// HAS_ERRNO: declare <2 x float> @ctanhf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @ctanhl({ x86_fp80, x86_fp80 }* byval align 16) [[NOT_READNONE]] };