Skip to content

Commit c7fae05

Browse files
committed
Don't emit intrinsics with strictfp
1 parent a963157 commit c7fae05

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3380,6 +3380,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
33803380
case Builtin::BI__builtin_sincospi:
33813381
case Builtin::BI__builtin_sincospif:
33823382
case Builtin::BI__builtin_sincospil:
3383+
if (Builder.getIsFPConstrained())
3384+
break; // TODO: Emit constrained sincospi intrinsic once one exists.
33833385
emitSincosBuiltin(*this, E, Intrinsic::sincospi);
33843386
return RValue::get(nullptr);
33853387

clang/test/CodeGen/AArch64/sincos.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %clang_cc1 -triple=aarch64-gnu-linux -emit-llvm -O1 %s -o - | FileCheck --check-prefix=NO-MATH-ERRNO %s
22
// RUN: %clang_cc1 -triple=aarch64-gnu-linux -emit-llvm -fmath-errno %s -o - | FileCheck --check-prefix=MATH-ERRNO %s
3+
// RUN: %clang_cc1 -triple=aarch64-gnu-linux -emit-llvm -ffp-exception-behavior=strict %s -o - | FileCheck --check-prefix=STRICT-FP %s
34

45
void sincos(double, double*, double*);
56
void sincosf(float, float*, float*);
@@ -15,6 +16,9 @@ void sincosl(long double, long double*, long double*);
1516
// MATH-ERRNO-LABEL: @sincos_f32
1617
// MATH-ERRNO: call void @sincosf(
1718
//
19+
// STRICT-FP-LABEL: @sincos_f32
20+
// STRICT-FP: call void @sincosf(
21+
//
1822
void sincos_f32(float x, float* fp0, float* fp1) {
1923
sincosf(x, fp0, fp1);
2024
}
@@ -43,6 +47,9 @@ void sincos_builtin_f32(float x, float* fp0, float* fp1) {
4347
// MATH-ERRNO-LABEL: @sincos_f64
4448
// MATH-ERRNO: call void @sincos(
4549
//
50+
// STRICT-FP-LABEL: @sincos_f64
51+
// STRICT-FP: call void @sincos(
52+
//
4653
void sincos_f64(double x, double* dp0, double* dp1) {
4754
sincos(x, dp0, dp1);
4855
}
@@ -71,6 +78,9 @@ void sincos_builtin_f64(double x, double* dp0, double* dp1) {
7178
// MATH-ERRNO-LABEL: @sincos_f128
7279
// MATH-ERRNO: call void @sincosl(
7380
//
81+
// STRICT-FP-LABEL: @sincos_f128
82+
// STRICT-FP: call void @sincosl(
83+
//
7484
void sincos_f128(long double x, long double* ldp0, long double* ldp1) {
7585
sincosl(x, ldp0, ldp1);
7686
}
@@ -99,6 +109,9 @@ void sincos_builtin_f128(long double x, long double* ldp0, long double* ldp1) {
99109
// MATH-ERRNO-LABEL: @sincospi_f32
100110
// MATH-ERRNO: call void @sincospif(
101111
//
112+
// STRICT-FP-LABEL: @sincospi_f32
113+
// STRICT-FP: call void @sincospif(
114+
//
102115
void sincospi_f32(float x, float* fp0, float* fp1) {
103116
__builtin_sincospif(x, fp0, fp1);
104117
}
@@ -113,6 +126,9 @@ void sincospi_f32(float x, float* fp0, float* fp1) {
113126
// MATH-ERRNO-LABEL: @sincospi_f64
114127
// MATH-ERRNO: call void @sincospi(
115128
//
129+
// STRICT-FP-LABEL: @sincospi_f64
130+
// STRICT-FP: call void @sincospi(
131+
//
116132
void sincospi_f64(double x, double* dp0, double* dp1) {
117133
__builtin_sincospi(x, dp0, dp1);
118134
}
@@ -127,6 +143,9 @@ void sincospi_f64(double x, double* dp0, double* dp1) {
127143
// MATH-ERRNO-LABEL: @sincospi_f128
128144
// MATH-ERRNO: call void @sincospil(
129145
//
146+
// STRICT-FP-LABEL: @sincospi_f128
147+
// STRICT-FP: call void @sincospil(
148+
//
130149
void sincospi_f128(long double x, long double* ldp0, long double* ldp1) {
131150
__builtin_sincospil(x, ldp0, ldp1);
132151
}

0 commit comments

Comments
 (0)