[llvm] Optimize fptrunc(x)>=C1 --> x>=C2 (PR #99475)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 19 05:48:16 PDT 2024


================
@@ -0,0 +1,11 @@
+; RUN: opt -passes=instcombine -S < %s | FileCheck %s
+
+
+;CHECK-LABEL: @src(
+;CHECK: %result = fcmp oge double %0, 1.000000e+02
+;CHECK-NEXT: ret i1 %result
+define i1 @src(double %0) {
+    %trunc = fptrunc double %0 to float
+    %result = fcmp oge float %trunc, 1.000000e+02
+    ret i1 %result
+}
----------------
arsenm wrote:

I mean the flags on the compare should be preserved, and you don't have any tests using fast math flags. e.g. https://alive2.llvm.org/ce/z/uQr4-J

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


More information about the llvm-commits mailing list