[llvm] [InstCombine] Make fptrunc combine use union of fast math flags (PR #118808)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 06:16:29 PST 2024


================
@@ -78,6 +89,28 @@ define half @test4-fast(float %a) {
 ; CHECK-NEXT:    [[TMP1:%.*]] = fptrunc fast float [[A:%.*]] to half
 ; CHECK-NEXT:    [[C:%.*]] = fneg fast half [[TMP1]]
 ; CHECK-NEXT:    ret half [[C]]
+;
+  %b = fsub fast float -0.0, %a
+  %c = fptrunc fast float %b to half
+  ret half %c
+}
+
+define half @test4-mixed-fast-1(float %a) {
+; CHECK-LABEL: @test4-mixed-fast-1(
+; CHECK-NEXT:    [[TMP1:%.*]] = fptrunc float [[A:%.*]] to half
+; CHECK-NEXT:    [[C:%.*]] = fneg half [[TMP1]]
+; CHECK-NEXT:    ret half [[C]]
+;
+  %b = fsub float -0.0, %a
+  %c = fptrunc fast float %b to half
+  ret half %c
+}
+
----------------
arsenm wrote:

Test a vector case, and with a subset of flags

https://github.com/llvm/llvm-project/pull/118808


More information about the llvm-commits mailing list