[llvm] [GlobalIsel] Combine G_SELECT (PR #74116)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 11:50:39 PST 2023


================
@@ -767,13 +797,25 @@ define i32 @select_and_olt_one(double %v0, double %v1, double %v2, double %v3, i
 }
 
 define i32 @select_and_one_olt(double %v0, double %v1, double %v2, double %v3, i32 %a, i32 %b) #0 {
-; CHECK-LABEL: select_and_one_olt:
-; CHECK:       ; %bb.0:
-; CHECK-NEXT:    fcmp d0, d1
-; CHECK-NEXT:    fccmp d0, d1, #1, ne
-; CHECK-NEXT:    fccmp d2, d3, #0, vc
-; CHECK-NEXT:    csel w0, w0, w1, mi
-; CHECK-NEXT:    ret
+; SDISEL-LABEL: select_and_one_olt:
+; SDISEL:       ; %bb.0:
+; SDISEL-NEXT:    fcmp d0, d1
+; SDISEL-NEXT:    fccmp d0, d1, #1, ne
+; SDISEL-NEXT:    fccmp d2, d3, #0, vc
+; SDISEL-NEXT:    csel w0, w0, w1, mi
+; SDISEL-NEXT:    ret
+;
+; GISEL-LABEL: select_and_one_olt:
+; GISEL:       ; %bb.0:
+; GISEL-NEXT:    fcmp d0, d1
+; GISEL-NEXT:    cset w8, mi
+; GISEL-NEXT:    cset w9, gt
+; GISEL-NEXT:    orr w8, w8, w9
+; GISEL-NEXT:    tst w8, #0x1
+; GISEL-NEXT:    csel w8, w0, w1, ne
+; GISEL-NEXT:    fcmp d2, d3
+; GISEL-NEXT:    csel w0, w8, w1, mi
+; GISEL-NEXT:    ret
----------------
tschuett wrote:

loss with fcmp

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


More information about the llvm-commits mailing list