Skip to content

Commit 3da7fd1

Browse files
committed
Reimplement constrained 'trunc' using operand bundles
Previously the function 'trunc' in non-default floating-point environment was implemented with a special LLVM intrinsic 'experimental.constrained.trunc'. Introduction of floating-point operand bundles allows expressing the interaction with the FP environment using the same intrinsic as for the default mode. This changes removes 'llvm.experimental.constrained.trunc' and use 'llvm.trunc' in all cases.
1 parent 868660b commit 3da7fd1

File tree

66 files changed

+363
-363
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+363
-363
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,17 @@ static Value *emitUnaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
657657
}
658658
}
659659

660+
// Emit a simple mangled intrinsic that has 1 argument and a return type
661+
// matching the argument type.
662+
static Value *emitUnaryFPBuiltin(CodeGenFunction &CGF, const CallExpr *E,
663+
unsigned IntrinsicID) {
664+
llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
665+
666+
CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E);
667+
Function *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
668+
return CGF.Builder.CreateCall(F, Src0);
669+
}
670+
660671
// Emit an intrinsic that has 2 operands of the same type as its result.
661672
// Depending on mode, this may be a constrained floating-point intrinsic.
662673
static Value *emitBinaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
@@ -3238,9 +3249,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
32383249
case Builtin::BI__builtin_truncf16:
32393250
case Builtin::BI__builtin_truncl:
32403251
case Builtin::BI__builtin_truncf128:
3241-
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(*this, E,
3242-
Intrinsic::trunc,
3243-
Intrinsic::experimental_constrained_trunc));
3252+
return RValue::get(emitUnaryFPBuiltin(*this, E, Intrinsic::trunc));
32443253

32453254
case Builtin::BIlround:
32463255
case Builtin::BIlroundf:
@@ -6827,7 +6836,7 @@ Value *CodeGenFunction::EmitNeonCall(Function *F, SmallVectorImpl<Value*> &Ops,
68276836
unsigned j = 0;
68286837
for (Function::const_arg_iterator ai = F->arg_begin(), ae = F->arg_end();
68296838
ai != ae; ++ai, ++j) {
6830-
if (F->isConstrainedFPIntrinsic())
6839+
if (F->isLegacyConstrainedIntrinsic())
68316840
if (ai->getType()->isMetadataTy())
68326841
continue;
68336842
if (shift > 0 && shift == j)
@@ -6836,7 +6845,7 @@ Value *CodeGenFunction::EmitNeonCall(Function *F, SmallVectorImpl<Value*> &Ops,
68366845
Ops[j] = Builder.CreateBitCast(Ops[j], ai->getType(), name);
68376846
}
68386847

6839-
if (F->isConstrainedFPIntrinsic())
6848+
if (F->isLegacyConstrainedIntrinsic())
68406849
return Builder.CreateConstrainedFPCall(F, Ops, name);
68416850
else
68426851
return Builder.CreateCall(F, Ops, name);
@@ -12989,13 +12998,11 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
1298912998
: Intrinsic::rint;
1299012999
return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vrndx");
1299113000
}
12992-
case NEON::BI__builtin_neon_vrndh_f16: {
13001+
case NEON::BI__builtin_neon_vrndh_f16:
1299313002
Ops.push_back(EmitScalarExpr(E->getArg(0)));
12994-
Int = Builder.getIsFPConstrained()
12995-
? Intrinsic::experimental_constrained_trunc
12996-
: Intrinsic::trunc;
12997-
return EmitNeonCall(CGM.getIntrinsic(Int, HalfTy), Ops, "vrndz");
12998-
}
13003+
return EmitNeonCall(CGM.getIntrinsic(Intrinsic::trunc, HalfTy), Ops,
13004+
"vrndz");
13005+
1299913006
case NEON::BI__builtin_neon_vrnd32x_f32:
1300013007
case NEON::BI__builtin_neon_vrnd32xq_f32:
1300113008
case NEON::BI__builtin_neon_vrnd32x_f64:
@@ -13029,12 +13036,9 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
1302913036
return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vrnd64z");
1303013037
}
1303113038
case NEON::BI__builtin_neon_vrnd_v:
13032-
case NEON::BI__builtin_neon_vrndq_v: {
13033-
Int = Builder.getIsFPConstrained()
13034-
? Intrinsic::experimental_constrained_trunc
13035-
: Intrinsic::trunc;
13036-
return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vrndz");
13037-
}
13039+
case NEON::BI__builtin_neon_vrndq_v:
13040+
return EmitNeonCall(CGM.getIntrinsic(Intrinsic::trunc, Ty), Ops, "vrndz");
13041+
1303813042
case NEON::BI__builtin_neon_vcvt_f64_v:
1303913043
case NEON::BI__builtin_neon_vcvtq_f64_v:
1304013044
Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
@@ -18251,9 +18255,8 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
1825118255
: Intrinsic::ceil;
1825218256
else if (BuiltinID == PPC::BI__builtin_vsx_xvrdpiz ||
1825318257
BuiltinID == PPC::BI__builtin_vsx_xvrspiz)
18254-
ID = Builder.getIsFPConstrained()
18255-
? Intrinsic::experimental_constrained_trunc
18256-
: Intrinsic::trunc;
18258+
return emitUnaryFPBuiltin(*this, E, Intrinsic::trunc);
18259+
1825718260
llvm::Function *F = CGM.getIntrinsic(ID, ResultType);
1825818261
return Builder.getIsFPConstrained() ? Builder.CreateConstrainedFPCall(F, X)
1825918262
: Builder.CreateCall(F, X);
@@ -18754,9 +18757,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
1875418757
.getScalarVal();
1875518758
case PPC::BI__builtin_ppc_friz:
1875618759
case PPC::BI__builtin_ppc_frizs:
18757-
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
18758-
*this, E, Intrinsic::trunc,
18759-
Intrinsic::experimental_constrained_trunc))
18760+
return RValue::get(emitUnaryFPBuiltin(*this, E, Intrinsic::trunc))
1876018761
.getScalarVal();
1876118762
case PPC::BI__builtin_ppc_fsqrt:
1876218763
case PPC::BI__builtin_ppc_fsqrts:
@@ -20536,8 +20537,7 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
2053620537
CI = Intrinsic::experimental_constrained_nearbyint; break;
2053720538
case 1: ID = Intrinsic::round;
2053820539
CI = Intrinsic::experimental_constrained_round; break;
20539-
case 5: ID = Intrinsic::trunc;
20540-
CI = Intrinsic::experimental_constrained_trunc; break;
20540+
case 5: ID = Intrinsic::trunc; break;
2054120541
case 6: ID = Intrinsic::ceil;
2054220542
CI = Intrinsic::experimental_constrained_ceil; break;
2054320543
case 7: ID = Intrinsic::floor;
@@ -20546,7 +20546,7 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
2054620546
break;
2054720547
}
2054820548
if (ID != Intrinsic::not_intrinsic) {
20549-
if (Builder.getIsFPConstrained()) {
20549+
if (Builder.getIsFPConstrained() && ID != Intrinsic::trunc) {
2055020550
Function *F = CGM.getIntrinsic(CI, ResultType);
2055120551
return Builder.CreateConstrainedFPCall(F, X);
2055220552
} else {

clang/test/CodeGen/AArch64/neon-intrinsics-constrained.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ float64x1_t test_vrndx_f64(float64x1_t a) {
792792
// COMMON-LABEL: test_vrnd_f64
793793
// COMMONIR: [[TMP0:%.*]] = bitcast <1 x double> %a to <8 x i8>
794794
// UNCONSTRAINED: [[VRNDZ1_I:%.*]] = call <1 x double> @llvm.trunc.v1f64(<1 x double> %a)
795-
// CONSTRAINED: [[VRNDZ1_I:%.*]] = call <1 x double> @llvm.experimental.constrained.trunc.v1f64(<1 x double> %a, metadata !"fpexcept.strict")
795+
// CONSTRAINED: [[VRNDZ1_I:%.*]] = call <1 x double> @llvm.trunc.v1f64(<1 x double> %a) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
796796
// COMMONIR: ret <1 x double> [[VRNDZ1_I]]
797797
float64x1_t test_vrnd_f64(float64x1_t a) {
798798
return vrnd_f64(a);

clang/test/CodeGen/AArch64/v8.2a-fp16-intrinsics-constrained.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ uint64_t test_vcvth_u64_f16 (float16_t a) {
150150

151151
// COMMON-LABEL: test_vrndh_f16
152152
// UNCONSTRAINED: [[RND:%.*]] = call half @llvm.trunc.f16(half %a)
153-
// CONSTRAINED: [[RND:%.*]] = call half @llvm.experimental.constrained.trunc.f16(half %a, metadata !"fpexcept.strict")
153+
// CONSTRAINED: [[RND:%.*]] = call half @llvm.trunc.f16(half %a) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
154154
// COMMONIR: ret half [[RND]]
155155
float16_t test_vrndh_f16(float16_t a) {
156156
return vrndh_f16(a);
@@ -298,3 +298,5 @@ float16_t test_vfmsh_f16(float16_t a, float16_t b, float16_t c) {
298298
return vfmsh_f16(a, b, c);
299299
}
300300

301+
// CHECK: attributes #[[ATTR]] = { strictfp memory(inaccessiblemem: readwrite) }
302+

clang/test/CodeGen/PowerPC/builtins-ppc-fpconstrained.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ void test_float(void) {
8585
vf = __builtin_vsx_xvrspiz(vf);
8686
// CHECK-LABEL: try-xvrspiz
8787
// CHECK-UNCONSTRAINED: @llvm.trunc.v4f32(<4 x float> %{{.*}})
88-
// CHECK-CONSTRAINED: @llvm.experimental.constrained.trunc.v4f32(<4 x float> %{{.*}}, metadata !"fpexcept.strict")
88+
// CHECK-CONSTRAINED: @llvm.trunc.v4f32(<4 x float> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
8989
// CHECK-ASM: xvrspiz
9090

9191
vd = __builtin_vsx_xvrdpiz(vd);
9292
// CHECK-LABEL: try-xvrdpiz
9393
// CHECK-UNCONSTRAINED: @llvm.trunc.v2f64(<2 x double> %{{.*}})
94-
// CHECK-CONSTRAINED: @llvm.experimental.constrained.trunc.v2f64(<2 x double> %{{.*}}, metadata !"fpexcept.strict")
94+
// CHECK-CONSTRAINED: @llvm.trunc.v2f64(<2 x double> %{{.*}}) #[[ATTR]] [ "fpe.except"(metadata !"strict") ]
9595
// CHECK-ASM: xvrdpiz
9696

9797
vf = __builtin_vsx_xvmaddasp(vf, vf, vf);
@@ -156,3 +156,5 @@ void test_float(void) {
156156
// CHECK-CONSTRAINED: fneg <2 x double> [[RESULT1]]
157157
// CHECK-ASM: xvnmsubadp
158158
}
159+
160+
// CHECK-CONSTRAINED: attributes #[[ATTR]] = { strictfp memory(inaccessiblemem: readwrite) }

clang/test/CodeGen/SystemZ/builtins-systemz-vector-constrained.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,13 @@ void test_float(void) {
4545
vd = __builtin_s390_vfidb(vd, 4, 1);
4646
// CHECK: call <2 x double> @llvm.experimental.constrained.round.v2f64(<2 x double> %{{.*}})
4747
vd = __builtin_s390_vfidb(vd, 4, 5);
48-
// CHECK: call <2 x double> @llvm.experimental.constrained.trunc.v2f64(<2 x double> %{{.*}})
48+
// CHECK: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
4949
vd = __builtin_s390_vfidb(vd, 4, 6);
5050
// CHECK: call <2 x double> @llvm.experimental.constrained.ceil.v2f64(<2 x double> %{{.*}})
5151
vd = __builtin_s390_vfidb(vd, 4, 7);
5252
// CHECK: call <2 x double> @llvm.experimental.constrained.floor.v2f64(<2 x double> %{{.*}})
5353
vd = __builtin_s390_vfidb(vd, 4, 4);
5454
// CHECK: call <2 x double> @llvm.s390.vfidb(<2 x double> %{{.*}}, i32 4, i32 4)
5555
}
56+
57+
// CHECK: attributes #[[ATTR]] = { strictfp memory(inaccessiblemem: readwrite) }

clang/test/CodeGen/SystemZ/builtins-systemz-vector2-constrained.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ void test_float(void) {
6060
vf = __builtin_s390_vfisb(vf, 4, 1);
6161
// CHECK: call <4 x float> @llvm.experimental.constrained.round.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
6262
vf = __builtin_s390_vfisb(vf, 4, 5);
63-
// CHECK: call <4 x float> @llvm.experimental.constrained.trunc.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
63+
// CHECK: call <4 x float> @llvm.trunc.v4f32(<4 x float> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
6464
vf = __builtin_s390_vfisb(vf, 4, 6);
6565
// CHECK: call <4 x float> @llvm.experimental.constrained.ceil.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
6666
vf = __builtin_s390_vfisb(vf, 4, 7);
6767
// CHECK: call <4 x float> @llvm.experimental.constrained.floor.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
6868
}
6969

70+
// CHECK: attributes #[[ATTR]] = { strictfp memory(inaccessiblemem: readwrite) }

clang/test/CodeGen/SystemZ/builtins-systemz-zvector-constrained.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,10 @@ void test_float(void) {
303303
// CHECK: call <2 x double> @llvm.experimental.constrained.floor.v2f64(<2 x double> %{{.*}}, metadata !{{.*}})
304304
// CHECK-ASM: vfidb %{{.*}}, %{{.*}}, 4, 7
305305
vd = vec_roundz(vd);
306-
// CHECK: call <2 x double> @llvm.experimental.constrained.trunc.v2f64(<2 x double> %{{.*}}, metadata !{{.*}})
306+
// CHECK: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
307307
// CHECK-ASM: vfidb %{{.*}}, %{{.*}}, 4, 5
308308
vd = vec_trunc(vd);
309-
// CHECK: call <2 x double> @llvm.experimental.constrained.trunc.v2f64(<2 x double> %{{.*}}, metadata !{{.*}})
309+
// CHECK: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{.*}}) #[[ATTR]] [ "fpe.except"(metadata !"strict") ]
310310
// CHECK-ASM: vfidb %{{.*}}, %{{.*}}, 4, 5
311311
vd = vec_roundc(vd);
312312
// CHECK: call <2 x double> @llvm.experimental.constrained.nearbyint.v2f64(<2 x double> %{{.*}}, metadata !{{.*}})
@@ -316,3 +316,5 @@ void test_float(void) {
316316
// CHECK-ASM: vfidb %{{.*}}, %{{.*}}, 0, 0
317317
vd = vec_round(vd);
318318
}
319+
320+
// CHECK: attributes #[[ATTR]] = { strictfp memory(inaccessiblemem: readwrite) }

clang/test/CodeGen/SystemZ/builtins-systemz-zvector2-constrained.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,16 +495,16 @@ void test_float(void) {
495495
// CHECK-ASM: vfidb %{{.*}}, %{{.*}}, 4, 7
496496

497497
vf = vec_roundz(vf);
498-
// CHECK: call <4 x float> @llvm.experimental.constrained.trunc.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
498+
// CHECK: call <4 x float> @llvm.trunc.v4f32(<4 x float> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
499499
// CHECK-ASM: vfisb %{{.*}}, %{{.*}}, 4, 5
500500
vf = vec_trunc(vf);
501-
// CHECK: call <4 x float> @llvm.experimental.constrained.trunc.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
501+
// CHECK: call <4 x float> @llvm.trunc.v4f32(<4 x float> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
502502
// CHECK-ASM: vfisb %{{.*}}, %{{.*}}, 4, 5
503503
vd = vec_roundz(vd);
504-
// CHECK: call <2 x double> @llvm.experimental.constrained.trunc.v2f64(<2 x double> %{{.*}}, metadata !{{.*}})
504+
// CHECK: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
505505
// CHECK-ASM: vfidb %{{.*}}, %{{.*}}, 4, 5
506506
vd = vec_trunc(vd);
507-
// CHECK: call <2 x double> @llvm.experimental.constrained.trunc.v2f64(<2 x double> %{{.*}}, metadata !{{.*}})
507+
// CHECK: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
508508
// CHECK-ASM: vfidb %{{.*}}, %{{.*}}, 4, 5
509509

510510
vf = vec_roundc(vf);
@@ -541,3 +541,5 @@ void test_float(void) {
541541
// CHECK: call { <2 x i64>, i32 } @llvm.s390.vftcidb(<2 x double> %{{.*}}, i32 4095)
542542
// CHECK-ASM: vftcidb
543543
}
544+
545+
// CHECK: attributes #[[ATTR]] = { strictfp memory(inaccessiblemem: readwrite) }

clang/test/CodeGen/arm64-vrnd-constrained.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
float64x2_t rnd5(float64x2_t a) { return vrndq_f64(a); }
1515
// COMMON-LABEL: rnd5
1616
// UNCONSTRAINED: call <2 x double> @llvm.trunc.v2f64(<2 x double>
17-
// CONSTRAINED: call <2 x double> @llvm.experimental.constrained.trunc.v2f64(<2 x double>
17+
// CONSTRAINED: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
1818
// CHECK-ASM: frintz.2d v{{[0-9]+}}, v{{[0-9]+}}
1919

2020
float64x2_t rnd13(float64x2_t a) { return vrndmq_f64(a); }
@@ -41,3 +41,5 @@ float64x2_t rnd25(float64x2_t a) { return vrndxq_f64(a); }
4141
// CONSTRAINED: call <2 x double> @llvm.experimental.constrained.rint.v2f64(<2 x double>
4242
// CHECK-ASM: frintx.2d v{{[0-9]+}}, v{{[0-9]+}}
4343

44+
// CHECK: attributes #[[ATTR]] = { strictfp memory(inaccessiblemem: readwrite) }
45+

clang/test/CodeGen/constrained-math-builtins.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,10 @@ __builtin_atan2(f,f); __builtin_atan2f(f,f); __builtin_atan2l(f,f);
242242

243243
__builtin_trunc(f); __builtin_truncf(f); __builtin_truncl(f); __builtin_truncf128(f);
244244

245-
// CHECK: call double @llvm.experimental.constrained.trunc.f64(double %{{.*}}, metadata !"fpexcept.strict")
246-
// CHECK: call float @llvm.experimental.constrained.trunc.f32(float %{{.*}}, metadata !"fpexcept.strict")
247-
// CHECK: call x86_fp80 @llvm.experimental.constrained.trunc.f80(x86_fp80 %{{.*}}, metadata !"fpexcept.strict")
248-
// CHECK: call fp128 @llvm.experimental.constrained.trunc.f128(fp128 %{{.*}}, metadata !"fpexcept.strict")
245+
// CHECK: call double @llvm.trunc.f64(double %{{.*}}) #[[ATTR_CALL:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
246+
// CHECK: call float @llvm.trunc.f32(float %{{.*}}) #[[ATTR_CALL]] [ "fpe.except"(metadata !"strict") ]
247+
// CHECK: call x86_fp80 @llvm.trunc.f80(x86_fp80 %{{.*}}) #[[ATTR_CALL]] [ "fpe.except"(metadata !"strict") ]
248+
// CHECK: call fp128 @llvm.trunc.f128(fp128 %{{.*}}) #[[ATTR_CALL]] [ "fpe.except"(metadata !"strict") ]
249249
};
250250

251251
// CHECK: declare double @llvm.experimental.constrained.frem.f64(double, double, metadata, metadata)
@@ -377,10 +377,10 @@ __builtin_atan2(f,f); __builtin_atan2f(f,f); __builtin_atan2l(f,f);
377377
// CHECK: declare x86_fp80 @llvm.experimental.constrained.tan.f80(x86_fp80, metadata, metadata)
378378
// CHECK: declare fp128 @llvm.experimental.constrained.tan.f128(fp128, metadata, metadata)
379379

380-
// CHECK: declare double @llvm.experimental.constrained.trunc.f64(double, metadata)
381-
// CHECK: declare float @llvm.experimental.constrained.trunc.f32(float, metadata)
382-
// CHECK: declare x86_fp80 @llvm.experimental.constrained.trunc.f80(x86_fp80, metadata)
383-
// CHECK: declare fp128 @llvm.experimental.constrained.trunc.f128(fp128, metadata)
380+
// CHECK: declare double @llvm.trunc.f64(double) #[[ATTR_FUNC:[0-9]+]]
381+
// CHECK: declare float @llvm.trunc.f32(float) #[[ATTR_FUNC]]
382+
// CHECK: declare x86_fp80 @llvm.trunc.f80(x86_fp80) #[[ATTR_FUNC]]
383+
// CHECK: declare fp128 @llvm.trunc.f128(fp128) #[[ATTR_FUNC]]
384384

385385
#pragma STDC FP_CONTRACT ON
386386
void bar(float f) {
@@ -401,3 +401,6 @@ void bar(float f) {
401401
// CHECK: fneg
402402
// CHECK: call float @llvm.experimental.constrained.fmuladd.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
403403
};
404+
405+
// CHECK: attributes #[[ATTR_FUNC]] = { {{.*}} memory(none) }
406+
// CHECK: attributes #[[ATTR_CALL]] = { strictfp memory(inaccessiblemem: readwrite) }

0 commit comments

Comments
 (0)