[llvm] [InstCombine] Fold fcmp into select (PR #86482)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 22 01:29:53 PDT 2024


================
@@ -148,3 +149,98 @@ define i1 @fcmp_ogt_select(i1 %cond, float %a, float %b) {
   %res = fcmp ogt float %lhs, %rhs
   ret i1 %res
 }
+
+define i1 @test_fcmp_select_const_const(double %x) {
+; CHECK-LABEL: @test_fcmp_select_const_const(
+; CHECK-NEXT:    [[CMP1:%.*]] = fcmp uno double [[X:%.*]], 0.000000e+00
+; CHECK-NEXT:    ret i1 [[CMP1]]
+;
+  %cmp1 = fcmp ord double %x, 0.000000e+00
+  %sel = select i1 %cmp1, double 0xFFFFFFFFFFFFFFFF, double 0.000000e+00
+  %cmp2 = fcmp oeq double %sel, 0.000000e+00
----------------
dtcxzyw wrote:

Done.

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


More information about the llvm-commits mailing list