diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -1938,7 +1938,10 @@ } case Builtin::BI__builtin_conj: case Builtin::BI__builtin_conjf: - case Builtin::BI__builtin_conjl: { + case Builtin::BI__builtin_conjl: + case Builtin::BIconj: + case Builtin::BIconjf: + case Builtin::BIconjl: { ComplexPairTy ComplexVal = EmitComplexExpr(E->getArg(0)); Value *Real = ComplexVal.first; Value *Imag = ComplexVal.second; diff --git a/clang/test/CodeGen/complex-libcalls-2.c b/clang/test/CodeGen/complex-libcalls-2.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/complex-libcalls-2.c @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -w -S -o - -emit-llvm -fmath-errno %s | FileCheck %s + +float _Complex test_conjf(float _Complex x) { +// CHECK-LABEL: @test_conjf( +// CHECK: fneg float %x.imag + return conjf(x); +} + +double _Complex test_conj(double _Complex x) { +// CHECK-LABEL: @test_conj( +// CHECK: fneg double %x.imag + return conj(x); +} + +long double _Complex test_conjl(long double _Complex x) { +// CHECK-LABEL: @test_conjl( +// CHECK: fneg x86_fp80 %x.imag + return conjl(x); +} diff --git a/clang/test/CodeGen/complex-libcalls.c b/clang/test/CodeGen/complex-libcalls.c --- a/clang/test/CodeGen/complex-libcalls.c +++ b/clang/test/CodeGen/complex-libcalls.c @@ -112,12 +112,10 @@ conj(f); conjf(f); conjl(f); -// NO__ERRNO: declare { double, double } @conj(double, double) [[READNONE:#[0-9]+]] -// NO__ERRNO: declare <2 x float> @conjf(<2 x float>) [[READNONE]] -// NO__ERRNO: declare { x86_fp80, x86_fp80 } @conjl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @conj(double, double) [[READNONE:#[0-9]+]] -// HAS_ERRNO: declare <2 x float> @conjf(<2 x float>) [[READNONE]] -// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @conjl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] +// NO__ERRNO-NOT: .conj +// NO__ERRNO-NOT: @conj +// HAS_ERRNO-NOT: .conj +// HAS_ERRNO-NOT: @conj clog(f); clogf(f); clogl(f); @@ -133,7 +131,7 @@ // 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({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]] -// HAS_ERRNO: declare { double, double } @cproj(double, double) [[READNONE]] +// HAS_ERRNO: declare { double, double } @cproj(double, double) [[READNONE:#[0-9]+]] // HAS_ERRNO: declare <2 x float> @cprojf(<2 x float>) [[READNONE]] // HAS_ERRNO: declare { x86_fp80, x86_fp80 } @cprojl({ x86_fp80, x86_fp80 }* byval({ x86_fp80, x86_fp80 }) align 16) [[NOT_READNONE]]