[llvm-branch-commits] [llvm] 67a1ffd - [FPEnv] Teach the IRBuilder about invoke's correct use of the strictfp attribute.

2020-12-15 Thread Kevin P. Neal via llvm-branch-commits

Author: Kevin P. Neal
Date: 2020-12-15T12:38:10-05:00
New Revision: 67a1ffd88ac08526bb6cfc7b3f607e6668ba1c70

URL: 
https://github.com/llvm/llvm-project/commit/67a1ffd88ac08526bb6cfc7b3f607e6668ba1c70
DIFF: 
https://github.com/llvm/llvm-project/commit/67a1ffd88ac08526bb6cfc7b3f607e6668ba1c70.diff

LOG: [FPEnv] Teach the IRBuilder about invoke's correct use of the strictfp 
attribute.

Similar to D69312, and documented in D69839, the IRBuilder needs to add
the strictfp attribute to invoke instructions when constrained floating
point is enabled.

Differential Revision: https://reviews.llvm.org/D93134

Added: 
clang/test/CodeGen/exceptions-strictfp.c

Modified: 
llvm/include/llvm/IR/IRBuilder.h

Removed: 




diff  --git a/clang/test/CodeGen/exceptions-strictfp.c 
b/clang/test/CodeGen/exceptions-strictfp.c
new file mode 100644
index ..f1c279908e45
--- /dev/null
+++ b/clang/test/CodeGen/exceptions-strictfp.c
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -triple armv7-apple-unknown -ffp-exception-behavior=strict 
-fexperimental-strict-floating-point -emit-llvm -o - %s -fexceptions 
-fsjlj-exceptions -fblocks | FileCheck %s
+
+// Verify strictfp attributes on invoke calls (and therefore also on
+// function definitions).
+
+// rdar://problem/8621849
+void test1() {
+  extern void test1_helper(void (^)(int));
+
+  // CHECK: define arm_aapcscc void @test1() [[STRICTFP0:#[0-9]+]] personality 
i8* bitcast (i32 (...)* @__gcc_personality_sj0 to i8*)
+
+  __block int x = 10;
+
+  // CHECK: invoke arm_aapcscc void @test1_helper({{.*}}) [[STRICTFP1:#[0-9]+]]
+  test1_helper(^(int v) { x = v; });
+
+  // CHECK:  landingpad { i8*, i32 }
+  // CHECK-NEXT:   cleanup
+}
+
+void test2_helper();
+void test2() {
+  // CHECK: define arm_aapcscc void @test2() [[STRICTFP0]] personality i8* 
bitcast (i32 (...)* @__gcc_personality_sj0 to i8*) {
+  __block int x = 10;
+  ^{ (void)x; };
+
+  // CHECK: invoke arm_aapcscc void @test2_helper({{.*}}) [[STRICTFP1:#[0-9]+]]
+  test2_helper(5, 6, 7);
+
+  // CHECK:  landingpad { i8*, i32 }
+  // CHECK-NEXT:   cleanup
+}
+void test2_helper(int x, int y) {
+}
+
+// CHECK: attributes [[STRICTFP0]] = { {{.*}}strictfp{{.*}} }
+// CHECK: attributes [[STRICTFP1]] = { strictfp }

diff  --git a/llvm/include/llvm/IR/IRBuilder.h 
b/llvm/include/llvm/IR/IRBuilder.h
index c2b3446d159f..6010f1a706a3 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -301,7 +301,7 @@ class IRBuilderBase {
 }
   }
 
-  void setConstrainedFPCallAttr(CallInst *I) {
+  void setConstrainedFPCallAttr(CallBase *I) {
 I->addAttribute(AttributeList::FunctionIndex, Attribute::StrictFP);
   }
 
@@ -1023,16 +1023,21 @@ class IRBuilderBase {
ArrayRef Args,
ArrayRef OpBundles,
const Twine &Name = "") {
-return Insert(
-InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args, 
OpBundles),
-Name);
+InvokeInst *II =
+InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args, 
OpBundles);
+if (IsFPConstrained)
+  setConstrainedFPCallAttr(II);
+return Insert(II, Name);
   }
   InvokeInst *CreateInvoke(FunctionType *Ty, Value *Callee,
BasicBlock *NormalDest, BasicBlock *UnwindDest,
ArrayRef Args = None,
const Twine &Name = "") {
-return Insert(InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args),
-  Name);
+InvokeInst *II =
+InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args);
+if (IsFPConstrained)
+  setConstrainedFPCallAttr(II);
+return Insert(II, Name);
   }
 
   InvokeInst *CreateInvoke(FunctionCallee Callee, BasicBlock *NormalDest,



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 2ec5973 - Revert "[FPEnv] Teach the IRBuilder about invoke's correct use of the strictfp attribute."

2020-12-15 Thread Kevin P. Neal via llvm-branch-commits

Author: Kevin P. Neal
Date: 2020-12-15T12:58:47-05:00
New Revision: 2ec5973fddb07e66ae0df7d0aac2cda55387b0bd

URL: 
https://github.com/llvm/llvm-project/commit/2ec5973fddb07e66ae0df7d0aac2cda55387b0bd
DIFF: 
https://github.com/llvm/llvm-project/commit/2ec5973fddb07e66ae0df7d0aac2cda55387b0bd.diff

LOG: Revert "[FPEnv] Teach the IRBuilder about invoke's correct use of the 
strictfp attribute."

The test is busted on some hosts that aren't the one I'm using.

This reverts commit 67a1ffd88ac08526bb6cfc7b3f607e6668ba1c70.

Added: 


Modified: 
llvm/include/llvm/IR/IRBuilder.h

Removed: 
clang/test/CodeGen/exceptions-strictfp.c



diff  --git a/clang/test/CodeGen/exceptions-strictfp.c 
b/clang/test/CodeGen/exceptions-strictfp.c
deleted file mode 100644
index f1c279908e45..
--- a/clang/test/CodeGen/exceptions-strictfp.c
+++ /dev/null
@@ -1,37 +0,0 @@
-// RUN: %clang_cc1 -triple armv7-apple-unknown -ffp-exception-behavior=strict 
-fexperimental-strict-floating-point -emit-llvm -o - %s -fexceptions 
-fsjlj-exceptions -fblocks | FileCheck %s
-
-// Verify strictfp attributes on invoke calls (and therefore also on
-// function definitions).
-
-// rdar://problem/8621849
-void test1() {
-  extern void test1_helper(void (^)(int));
-
-  // CHECK: define arm_aapcscc void @test1() [[STRICTFP0:#[0-9]+]] personality 
i8* bitcast (i32 (...)* @__gcc_personality_sj0 to i8*)
-
-  __block int x = 10;
-
-  // CHECK: invoke arm_aapcscc void @test1_helper({{.*}}) [[STRICTFP1:#[0-9]+]]
-  test1_helper(^(int v) { x = v; });
-
-  // CHECK:  landingpad { i8*, i32 }
-  // CHECK-NEXT:   cleanup
-}
-
-void test2_helper();
-void test2() {
-  // CHECK: define arm_aapcscc void @test2() [[STRICTFP0]] personality i8* 
bitcast (i32 (...)* @__gcc_personality_sj0 to i8*) {
-  __block int x = 10;
-  ^{ (void)x; };
-
-  // CHECK: invoke arm_aapcscc void @test2_helper({{.*}}) [[STRICTFP1:#[0-9]+]]
-  test2_helper(5, 6, 7);
-
-  // CHECK:  landingpad { i8*, i32 }
-  // CHECK-NEXT:   cleanup
-}
-void test2_helper(int x, int y) {
-}
-
-// CHECK: attributes [[STRICTFP0]] = { {{.*}}strictfp{{.*}} }
-// CHECK: attributes [[STRICTFP1]] = { strictfp }

diff  --git a/llvm/include/llvm/IR/IRBuilder.h 
b/llvm/include/llvm/IR/IRBuilder.h
index 6010f1a706a3..c2b3446d159f 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -301,7 +301,7 @@ class IRBuilderBase {
 }
   }
 
-  void setConstrainedFPCallAttr(CallBase *I) {
+  void setConstrainedFPCallAttr(CallInst *I) {
 I->addAttribute(AttributeList::FunctionIndex, Attribute::StrictFP);
   }
 
@@ -1023,21 +1023,16 @@ class IRBuilderBase {
ArrayRef Args,
ArrayRef OpBundles,
const Twine &Name = "") {
-InvokeInst *II =
-InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args, 
OpBundles);
-if (IsFPConstrained)
-  setConstrainedFPCallAttr(II);
-return Insert(II, Name);
+return Insert(
+InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args, 
OpBundles),
+Name);
   }
   InvokeInst *CreateInvoke(FunctionType *Ty, Value *Callee,
BasicBlock *NormalDest, BasicBlock *UnwindDest,
ArrayRef Args = None,
const Twine &Name = "") {
-InvokeInst *II =
-InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args);
-if (IsFPConstrained)
-  setConstrainedFPCallAttr(II);
-return Insert(II, Name);
+return Insert(InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args),
+  Name);
   }
 
   InvokeInst *CreateInvoke(FunctionCallee Callee, BasicBlock *NormalDest,



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 7fef551 - Revert "Revert "[FPEnv] Teach the IRBuilder about invoke's correct use of the strictfp attribute.""

2020-12-18 Thread Kevin P. Neal via llvm-branch-commits

Author: Kevin P. Neal
Date: 2020-12-18T12:42:06-05:00
New Revision: 7fef551cb123d9f1956f8ec7a142bd8a63d25fa9

URL: 
https://github.com/llvm/llvm-project/commit/7fef551cb123d9f1956f8ec7a142bd8a63d25fa9
DIFF: 
https://github.com/llvm/llvm-project/commit/7fef551cb123d9f1956f8ec7a142bd8a63d25fa9.diff

LOG: Revert "Revert "[FPEnv] Teach the IRBuilder about invoke's correct use of 
the strictfp attribute.""

Similar to D69312, and documented in D69839, the IRBuilder needs to add
the strictfp attribute to invoke instructions when constrained floating
point is enabled.

This is try 2, with the test corrected.

Differential Revision: https://reviews.llvm.org/D93134

Added: 
clang/test/CodeGen/exceptions-strictfp.c

Modified: 
llvm/include/llvm/IR/IRBuilder.h

Removed: 




diff  --git a/clang/test/CodeGen/exceptions-strictfp.c 
b/clang/test/CodeGen/exceptions-strictfp.c
new file mode 100644
index ..6f9e9f891b6c
--- /dev/null
+++ b/clang/test/CodeGen/exceptions-strictfp.c
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -triple armv7-apple-unknown -ffp-exception-behavior=strict 
-fexperimental-strict-floating-point -emit-llvm -o - %s -fexceptions 
-exception-model=sjlj -fblocks | FileCheck %s
+
+// Verify strictfp attributes on invoke calls (and therefore also on
+// function definitions).
+
+// rdar://problem/8621849
+void test1() {
+  extern void test1_helper(void (^)(int));
+
+  // CHECK: define arm_aapcscc void @test1() [[STRICTFP0:#[0-9]+]] personality 
i8* bitcast (i32 (...)* @__gcc_personality_sj0 to i8*)
+
+  __block int x = 10;
+
+  // CHECK: invoke arm_aapcscc void @test1_helper({{.*}}) [[STRICTFP1:#[0-9]+]]
+  test1_helper(^(int v) { x = v; });
+
+  // CHECK:  landingpad { i8*, i32 }
+  // CHECK-NEXT:   cleanup
+}
+
+void test2_helper();
+void test2() {
+  // CHECK: define arm_aapcscc void @test2() [[STRICTFP0]] personality i8* 
bitcast (i32 (...)* @__gcc_personality_sj0 to i8*) {
+  __block int x = 10;
+  ^{ (void)x; };
+
+  // CHECK: invoke arm_aapcscc void @test2_helper({{.*}}) [[STRICTFP1:#[0-9]+]]
+  test2_helper(5, 6, 7);
+
+  // CHECK:  landingpad { i8*, i32 }
+  // CHECK-NEXT:   cleanup
+}
+void test2_helper(int x, int y) {
+}
+
+// CHECK: attributes [[STRICTFP0]] = { {{.*}}strictfp{{.*}} }
+// CHECK: attributes [[STRICTFP1]] = { strictfp }

diff  --git a/llvm/include/llvm/IR/IRBuilder.h 
b/llvm/include/llvm/IR/IRBuilder.h
index 56005b26a538..6bc5e89453ad 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -350,7 +350,7 @@ class IRBuilderBase {
 }
   }
 
-  void setConstrainedFPCallAttr(CallInst *I) {
+  void setConstrainedFPCallAttr(CallBase *I) {
 I->addAttribute(AttributeList::FunctionIndex, Attribute::StrictFP);
   }
 
@@ -1088,16 +1088,21 @@ class IRBuilderBase {
ArrayRef Args,
ArrayRef OpBundles,
const Twine &Name = "") {
-return Insert(
-InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args, 
OpBundles),
-Name);
+InvokeInst *II =
+InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args, 
OpBundles);
+if (IsFPConstrained)
+  setConstrainedFPCallAttr(II);
+return Insert(II, Name);
   }
   InvokeInst *CreateInvoke(FunctionType *Ty, Value *Callee,
BasicBlock *NormalDest, BasicBlock *UnwindDest,
ArrayRef Args = None,
const Twine &Name = "") {
-return Insert(InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args),
-  Name);
+InvokeInst *II =
+InvokeInst::Create(Ty, Callee, NormalDest, UnwindDest, Args);
+if (IsFPConstrained)
+  setConstrainedFPCallAttr(II);
+return Insert(II, Name);
   }
 
   InvokeInst *CreateInvoke(FunctionCallee Callee, BasicBlock *NormalDest,



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] abfbc55 - [FPEnv] clang should get from the AST the metadata for constrained FP builtins

2020-11-30 Thread Kevin P. Neal via llvm-branch-commits

Author: Kevin P. Neal
Date: 2020-11-30T11:59:37-05:00
New Revision: abfbc5579bd4507ae286d4f29f8a157de0629372

URL: 
https://github.com/llvm/llvm-project/commit/abfbc5579bd4507ae286d4f29f8a157de0629372
DIFF: 
https://github.com/llvm/llvm-project/commit/abfbc5579bd4507ae286d4f29f8a157de0629372.diff

LOG: [FPEnv] clang should get from the AST the metadata for constrained FP 
builtins

Currently clang is not correctly retrieving from the AST the metadata for
constrained FP builtins. This patch fixes that for the non-target specific
builtins.

Differential Revision: https://reviews.llvm.org/D92122

Added: 
clang/test/CodeGen/strictfp_fpclassify.c

Modified: 
clang/lib/CodeGen/CGBuiltin.cpp
clang/test/CodeGen/builtin_float_strictfp.c
clang/test/CodeGen/constrained-math-builtins.c

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 828d66f83de9..73897a27bd94 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -440,6 +440,7 @@ static Value 
*emitUnaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
   llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
 
   if (CGF.Builder.getIsFPConstrained()) {
+CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E);
 Function *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, 
Src0->getType());
 return CGF.Builder.CreateConstrainedFPCall(F, { Src0 });
   } else {
@@ -457,6 +458,7 @@ static Value 
*emitBinaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
   llvm::Value *Src1 = CGF.EmitScalarExpr(E->getArg(1));
 
   if (CGF.Builder.getIsFPConstrained()) {
+CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E);
 Function *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, 
Src0->getType());
 return CGF.Builder.CreateConstrainedFPCall(F, { Src0, Src1 });
   } else {
@@ -475,6 +477,7 @@ static Value 
*emitTernaryMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
   llvm::Value *Src2 = CGF.EmitScalarExpr(E->getArg(2));
 
   if (CGF.Builder.getIsFPConstrained()) {
+CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E);
 Function *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID, 
Src0->getType());
 return CGF.Builder.CreateConstrainedFPCall(F, { Src0, Src1, Src2 });
   } else {
@@ -556,6 +559,7 @@ emitMaybeConstrainedFPToIntRoundBuiltin(CodeGenFunction 
&CGF, const CallExpr *E,
   llvm::Value *Src0 = CGF.EmitScalarExpr(E->getArg(0));
 
   if (CGF.Builder.getIsFPConstrained()) {
+CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E);
 Function *F = CGF.CGM.getIntrinsic(ConstrainedIntrinsicID,
{ResultType, Src0->getType()});
 return CGF.Builder.CreateConstrainedFPCall(F, {Src0});
@@ -2218,6 +,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 case Builtin::BI__builtin_fmodf16:
 case Builtin::BI__builtin_fmodl:
 case Builtin::BI__builtin_fmodf128: {
+  CodeGenFunction::CGFPOptionsRAII FPOptsRAII(*this, E);
   Value *Arg1 = EmitScalarExpr(E->getArg(0));
   Value *Arg2 = EmitScalarExpr(E->getArg(1));
   return RValue::get(Builder.CreateFRem(Arg1, Arg2, "fmod"));
@@ -2828,6 +2833,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
   case Builtin::BI__builtin_isunordered: {
 // Ordered comparisons: we know the arguments to these are matching scalar
 // floating point values.
+CodeGenFunction::CGFPOptionsRAII FPOptsRAII(*this, E);
+// FIXME: for strictfp/IEEE-754 we need to not trap on SNaN here.
 Value *LHS = EmitScalarExpr(E->getArg(0));
 Value *RHS = EmitScalarExpr(E->getArg(1));
 
@@ -2856,6 +2863,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 return RValue::get(Builder.CreateZExt(LHS, ConvertType(E->getType(;
   }
   case Builtin::BI__builtin_isnan: {
+CodeGenFunction::CGFPOptionsRAII FPOptsRAII(*this, E);
+// FIXME: for strictfp/IEEE-754 we need to not trap on SNaN here.
 Value *V = EmitScalarExpr(E->getArg(0));
 V = Builder.CreateFCmpUNO(V, V, "cmp");
 return RValue::get(Builder.CreateZExt(V, ConvertType(E->getType(;
@@ -2919,6 +2928,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 // isinf(x)--> fabs(x) == infinity
 // isfinite(x) --> fabs(x) != infinity
 // x != NaN via the ordered compare in either case.
+CodeGenFunction::CGFPOptionsRAII FPOptsRAII(*this, E);
+// FIXME: for strictfp/IEEE-754 we need to not trap on SNaN here.
 Value *V = EmitScalarExpr(E->getArg(0));
 Value *Fabs = EmitFAbs(*this, V);
 Constant *Infinity = ConstantFP::getInfinity(V->getType());
@@ -2931,6 +2942,8 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl 
GD, unsigned BuiltinID,
 
   case Builtin::BI__builtin_isinf_sign: {
 // isinf_sign(x) -> fabs(x) == infinity ? (sign

[llvm-branch-commits] [clang] acd4950 - [FPEnv] Correct constrained metadata in fp16-ops-strict.c

2020-12-08 Thread Kevin P. Neal via llvm-branch-commits

Author: Kevin P. Neal
Date: 2020-12-08T10:18:32-05:00
New Revision: acd4950d4f1e4ef5375a8a894a5b359caf7e844b

URL: 
https://github.com/llvm/llvm-project/commit/acd4950d4f1e4ef5375a8a894a5b359caf7e844b
DIFF: 
https://github.com/llvm/llvm-project/commit/acd4950d4f1e4ef5375a8a894a5b359caf7e844b.diff

LOG: [FPEnv] Correct constrained metadata in fp16-ops-strict.c

This test shows we're in some cases not getting strictfp information from
the AST. Correct that.

Differential Revision: https://reviews.llvm.org/D92596

Added: 


Modified: 
clang/lib/CodeGen/CGExprScalar.cpp
clang/test/CodeGen/fp16-ops-strictfp.c

Removed: 




diff  --git a/clang/lib/CodeGen/CGExprScalar.cpp 
b/clang/lib/CodeGen/CGExprScalar.cpp
index 4210e810acb7..973cefd831e6 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -2550,6 +2550,7 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const 
UnaryOperator *E, LValue LV,
   } else if (type->isRealFloatingType()) {
 // Add the inc/dec to the real part.
 llvm::Value *amt;
+CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, E);
 
 if (type->isHalfType() && !CGF.getContext().getLangOpts().NativeHalfType) {
   // Another special case: half FP increment should be done via float
@@ -3001,6 +3002,7 @@ LValue ScalarExprEmitter::EmitCompoundAssignLValue(
   else
 OpInfo.LHS = EmitLoadOfLValue(LHSLV, E->getExprLoc());
 
+  CodeGenFunction::CGFPOptionsRAII FPOptsRAII(CGF, OpInfo.FPFeatures);
   SourceLocation Loc = E->getExprLoc();
   OpInfo.LHS =
   EmitScalarConversion(OpInfo.LHS, LHSTy, E->getComputationLHSType(), Loc);

diff  --git a/clang/test/CodeGen/fp16-ops-strictfp.c 
b/clang/test/CodeGen/fp16-ops-strictfp.c
index fd50d56a852c..d81febad0c36 100644
--- a/clang/test/CodeGen/fp16-ops-strictfp.c
+++ b/clang/test/CodeGen/fp16-ops-strictfp.c
@@ -11,7 +11,6 @@
 //
 // Test that the constrained intrinsics are picking up the exception
 // metadata from the AST instead of the global default from the command line.
-// FIXME: All cases of "fpexcept.maytrap" in this test are wrong.
 
 #pragma float_control(except, on)
 
@@ -62,31 +61,31 @@ void foo(void) {
   // NOTNATIVE: store {{.*}} half {{.*}}, half*
   h1 = +h1;
 
-  // NATIVE-HALF: call half @llvm.experimental.constrained.fadd.f16(half 
%{{.*}}, half 0xH3C00, metadata !"round.tonearest", metadata 
!"fpexcept.maytrap")
-  // NOTNATIVE: call float @llvm.experimental.constrained.fpext.f32.f16(half 
%{{.*}}, metadata !"fpexcept.maytrap")
-  // NOTNATIVE: call float @llvm.experimental.constrained.fadd.f32(float 
%{{.*}}, float {{.*}}, metadata !"round.tonearest", metadata 
!"fpexcept.maytrap")
-  // NOTNATIVE: call half @llvm.experimental.constrained.fptrunc.f16.f32(float 
%{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
+  // NATIVE-HALF: call half @llvm.experimental.constrained.fadd.f16(half 
%{{.*}}, half 0xH3C00, metadata !"round.tonearest", metadata !"fpexcept.strict")
+  // NOTNATIVE: call float @llvm.experimental.constrained.fpext.f32.f16(half 
%{{.*}}, metadata !"fpexcept.strict")
+  // NOTNATIVE: call float @llvm.experimental.constrained.fadd.f32(float 
%{{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
+  // NOTNATIVE: call half @llvm.experimental.constrained.fptrunc.f16.f32(float 
%{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
   // CHECK: store {{.*}} half {{.*}}, half*
   h1++;
 
-  // NATIVE-HALF: call half @llvm.experimental.constrained.fadd.f16(half 
%{{.*}}, half 0xH3C00, metadata !"round.tonearest", metadata 
!"fpexcept.maytrap")
-  // NOTNATIVE: call float @llvm.experimental.constrained.fpext.f32.f16(half 
%{{.*}}, metadata !"fpexcept.maytrap")
-  // NOTNATIVE: call float @llvm.experimental.constrained.fadd.f32(float 
%{{.*}}, float {{.*}}, metadata !"round.tonearest", metadata 
!"fpexcept.maytrap")
-  // NOTNATIVE: call half @llvm.experimental.constrained.fptrunc.f16.f32(float 
%{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
+  // NATIVE-HALF: call half @llvm.experimental.constrained.fadd.f16(half 
%{{.*}}, half 0xH3C00, metadata !"round.tonearest", metadata !"fpexcept.strict")
+  // NOTNATIVE: call float @llvm.experimental.constrained.fpext.f32.f16(half 
%{{.*}}, metadata !"fpexcept.strict")
+  // NOTNATIVE: call float @llvm.experimental.constrained.fadd.f32(float 
%{{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
+  // NOTNATIVE: call half @llvm.experimental.constrained.fptrunc.f16.f32(float 
%{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
   // CHECK: store {{.*}} half {{.*}}, half*
   ++h1;
 
-  // NATIVE-HALF: call half @llvm.experimental.constrained.fadd.f16(half 
%{{.*}}, half 0xHBC00, metadata !"round.tonearest", metadata 
!"fpexcept.maytrap")
-  // NOTNATIVE: call float @llvm.experimental.constrained.fpext.f32.f16(half 
%{{.*}}, meta

[llvm-branch-commits] [llvm] [SelectionDAG] Adaptation for FP operation lowering (PR #138553)

2025-05-09 Thread Kevin P. Neal via llvm-branch-commits


@@ -6826,9 +6824,7 @@ void SelectionDAGBuilder::visitIntrinsicCall(const 
CallInst &I,
 case Intrinsic::exp10:Opcode = ISD::FEXP10;break;
 case Intrinsic::floor:Opcode = ISD::FFLOOR;break;
 case Intrinsic::ceil: Opcode = ISD::FCEIL; break;
-case Intrinsic::trunc:Opcode = ISD::FTRUNC;break;
 case Intrinsic::rint: Opcode = ISD::FRINT; break;
-case Intrinsic::nearbyint:Opcode = ISD::FNEARBYINT;break;

kpneal wrote:

Why are these two not needed?

https://github.com/llvm/llvm-project/pull/138553
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits