Skip to content

Commit dbc2e6c

Browse files
committed
Reimplement constrained 'trunc' using operand bundles
Previously the function 'trunc' in non-default floating-point environment was implemented using a special LLVM intrinsic 'experimental.constrained.trunc'. The introduction of floating-point operand bundles now allows expressing the interaction with the floating-point environment using the same intrinsic as in the default mode. This changes removes 'llvm.experimental.constrained.trunc' and use 'llvm.trunc' in all cases.
1 parent ac4271a commit dbc2e6c

File tree

64 files changed

+353
-362
lines changed

Some content is hidden

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

64 files changed

+353
-362
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,17 @@ static Value *emitUnaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
687687
}
688688
}
689689

690+
// Emit a simple mangled intrinsic that has 1 argument and a return type
691+
// matching the argument type.
692+
static Value *emitUnaryFPBuiltin(CodeGenFunction &CGF, const CallExpr *E,
693+
unsigned IntrinsicID) {
694+
llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
695+
696+
CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E);
697+
Function *F = CGF.CGM.getIntrinsic(IntrinsicID, Src0->getType());
698+
return CGF.Builder.CreateCall(F, Src0);
699+
}
700+
690701
// Emit an intrinsic that has 2 operands of the same type as its result.
691702
// Depending on mode, this may be a constrained floating-point intrinsic.
692703
static Value *emitBinaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
@@ -3430,9 +3441,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID,
34303441
case Builtin::BI__builtin_truncf16:
34313442
case Builtin::BI__builtin_truncl:
34323443
case Builtin::BI__builtin_truncf128:
3433-
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(*this, E,
3434-
Intrinsic::trunc,
3435-
Intrinsic::experimental_constrained_trunc));
3444+
return RValue::get(emitUnaryFPBuiltin(*this, E, Intrinsic::trunc));
34363445

34373446
case Builtin::BIlround:
34383447
case Builtin::BIlroundf:
@@ -6879,7 +6888,7 @@ Value *CodeGenFunction::EmitNeonCall(Function *F, SmallVectorImpl<Value*> &Ops,
68796888
unsigned j = 0;
68806889
for (Function::const_arg_iterator ai = F->arg_begin(), ae = F->arg_end();
68816890
ai != ae; ++ai, ++j) {
6882-
if (F->isConstrainedFPIntrinsic())
6891+
if (F->isLegacyConstrainedIntrinsic())
68836892
if (ai->getType()->isMetadataTy())
68846893
continue;
68856894
if (shift > 0 && shift == j)
@@ -6888,7 +6897,7 @@ Value *CodeGenFunction::EmitNeonCall(Function *F, SmallVectorImpl<Value*> &Ops,
68886897
Ops[j] = Builder.CreateBitCast(Ops[j], ai->getType(), name);
68896898
}
68906899

6891-
if (F->isConstrainedFPIntrinsic())
6900+
if (F->isLegacyConstrainedIntrinsic())
68926901
return Builder.CreateConstrainedFPCall(F, Ops, name);
68936902
else
68946903
return Builder.CreateCall(F, Ops, name);
@@ -13211,13 +13220,11 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
1321113220
: Intrinsic::rint;
1321213221
return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vrndx");
1321313222
}
13214-
case NEON::BI__builtin_neon_vrndh_f16: {
13223+
case NEON::BI__builtin_neon_vrndh_f16:
1321513224
Ops.push_back(EmitScalarExpr(E->getArg(0)));
13216-
Int = Builder.getIsFPConstrained()
13217-
? Intrinsic::experimental_constrained_trunc
13218-
: Intrinsic::trunc;
13219-
return EmitNeonCall(CGM.getIntrinsic(Int, HalfTy), Ops, "vrndz");
13220-
}
13225+
return EmitNeonCall(CGM.getIntrinsic(Intrinsic::trunc, HalfTy), Ops,
13226+
"vrndz");
13227+
1322113228
case NEON::BI__builtin_neon_vrnd32x_f32:
1322213229
case NEON::BI__builtin_neon_vrnd32xq_f32:
1322313230
case NEON::BI__builtin_neon_vrnd32x_f64:
@@ -13251,12 +13258,9 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
1325113258
return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vrnd64z");
1325213259
}
1325313260
case NEON::BI__builtin_neon_vrnd_v:
13254-
case NEON::BI__builtin_neon_vrndq_v: {
13255-
Int = Builder.getIsFPConstrained()
13256-
? Intrinsic::experimental_constrained_trunc
13257-
: Intrinsic::trunc;
13258-
return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vrndz");
13259-
}
13261+
case NEON::BI__builtin_neon_vrndq_v:
13262+
return EmitNeonCall(CGM.getIntrinsic(Intrinsic::trunc, Ty), Ops, "vrndz");
13263+
1326013264
case NEON::BI__builtin_neon_vcvt_f64_v:
1326113265
case NEON::BI__builtin_neon_vcvtq_f64_v:
1326213266
Ops[0] = Builder.CreateBitCast(Ops[0], Ty);
@@ -18611,9 +18615,8 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
1861118615
: Intrinsic::ceil;
1861218616
else if (BuiltinID == PPC::BI__builtin_vsx_xvrdpiz ||
1861318617
BuiltinID == PPC::BI__builtin_vsx_xvrspiz)
18614-
ID = Builder.getIsFPConstrained()
18615-
? Intrinsic::experimental_constrained_trunc
18616-
: Intrinsic::trunc;
18618+
return emitUnaryFPBuiltin(*this, E, Intrinsic::trunc);
18619+
1861718620
llvm::Function *F = CGM.getIntrinsic(ID, ResultType);
1861818621
return Builder.getIsFPConstrained() ? Builder.CreateConstrainedFPCall(F, X)
1861918622
: Builder.CreateCall(F, X);
@@ -19114,9 +19117,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
1911419117
.getScalarVal();
1911519118
case PPC::BI__builtin_ppc_friz:
1911619119
case PPC::BI__builtin_ppc_frizs:
19117-
return RValue::get(emitUnaryMaybeConstrainedFPBuiltin(
19118-
*this, E, Intrinsic::trunc,
19119-
Intrinsic::experimental_constrained_trunc))
19120+
return RValue::get(emitUnaryFPBuiltin(*this, E, Intrinsic::trunc))
1912019121
.getScalarVal();
1912119122
case PPC::BI__builtin_ppc_fsqrt:
1912219123
case PPC::BI__builtin_ppc_fsqrts:
@@ -21024,8 +21025,7 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
2102421025
CI = Intrinsic::experimental_constrained_round; break;
2102521026
case 4: ID = Intrinsic::roundeven;
2102621027
CI = Intrinsic::experimental_constrained_roundeven; break;
21027-
case 5: ID = Intrinsic::trunc;
21028-
CI = Intrinsic::experimental_constrained_trunc; break;
21028+
case 5: ID = Intrinsic::trunc; break;
2102921029
case 6: ID = Intrinsic::ceil;
2103021030
CI = Intrinsic::experimental_constrained_ceil; break;
2103121031
case 7: ID = Intrinsic::floor;
@@ -21034,7 +21034,7 @@ Value *CodeGenFunction::EmitSystemZBuiltinExpr(unsigned BuiltinID,
2103421034
break;
2103521035
}
2103621036
if (ID != Intrinsic::not_intrinsic) {
21037-
if (Builder.getIsFPConstrained()) {
21037+
if (Builder.getIsFPConstrained() && ID != Intrinsic::trunc) {
2103821038
Function *F = CGM.getIntrinsic(CI, ResultType);
2103921039
return Builder.CreateConstrainedFPCall(F, X);
2104021040
} 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
@@ -47,11 +47,13 @@ void test_float(void) {
4747
vd = __builtin_s390_vfidb(vd, 4, 4);
4848
// CHECK: call <2 x double> @llvm.experimental.constrained.roundeven.v2f64(<2 x double> %{{.*}})
4949
vd = __builtin_s390_vfidb(vd, 4, 5);
50-
// CHECK: call <2 x double> @llvm.experimental.constrained.trunc.v2f64(<2 x double> %{{.*}})
50+
// CHECK: call <2 x double> @llvm.trunc.v2f64(<2 x double> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
5151
vd = __builtin_s390_vfidb(vd, 4, 6);
5252
// CHECK: call <2 x double> @llvm.experimental.constrained.ceil.v2f64(<2 x double> %{{.*}})
5353
vd = __builtin_s390_vfidb(vd, 4, 7);
5454
// CHECK: call <2 x double> @llvm.experimental.constrained.floor.v2f64(<2 x double> %{{.*}})
5555
vd = __builtin_s390_vfidb(vd, 4, 3);
5656
// CHECK: call <2 x double> @llvm.s390.vfidb(<2 x double> %{{.*}}, i32 4, i32 3)
5757
}
58+
59+
// 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
@@ -62,7 +62,7 @@ void test_float(void) {
6262
vf = __builtin_s390_vfisb(vf, 4, 4);
6363
// CHECK: call <4 x float> @llvm.experimental.constrained.roundeven.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
6464
vf = __builtin_s390_vfisb(vf, 4, 5);
65-
// CHECK: call <4 x float> @llvm.experimental.constrained.trunc.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
65+
// CHECK: call <4 x float> @llvm.trunc.v4f32(<4 x float> %{{.*}}) #[[ATTR:[0-9]+]] [ "fpe.except"(metadata !"strict") ]
6666
vf = __builtin_s390_vfisb(vf, 4, 6);
6767
// CHECK: call <4 x float> @llvm.experimental.constrained.ceil.v4f32(<4 x float> %{{.*}}, metadata !{{.*}})
6868
vf = __builtin_s390_vfisb(vf, 4, 7);
@@ -71,3 +71,4 @@ void test_float(void) {
7171
// CHECK: call <4 x float> @llvm.s390.vfisb(<4 x float> %{{.*}}, i32 4, i32 3)
7272
}
7373

74+
// 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 !{{.*}})
@@ -318,3 +318,5 @@ void test_float(void) {
318318
// CHECK: call <2 x double> @llvm.experimental.constrained.roundeven.v2f64(<2 x double> %{{.*}}, metadata !{{.*}})
319319
// CHECK-ASM: vfidb %{{.*}}, %{{.*}}, 4, 4
320320
}
321+
322+
// 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)