[llvm] [GlobalIsel] Combine G_SELECT (PR #74116)
Thorsten Schütt via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 2 08:15:25 PST 2023
================
@@ -552,14 +557,26 @@ define i64 @gccbug(i64 %x0, i64 %x1) {
}
define i32 @select_ororand(i32 %w0, i32 %w1, i32 %w2, i32 %w3) {
-; CHECK-LABEL: select_ororand:
-; CHECK: ; %bb.0:
-; CHECK-NEXT: cmp w3, #4
-; CHECK-NEXT: ccmp w2, #2, #0, gt
-; CHECK-NEXT: ccmp w1, #13, #2, ge
-; CHECK-NEXT: ccmp w0, #0, #4, ls
-; CHECK-NEXT: csel w0, w3, wzr, eq
-; CHECK-NEXT: ret
+; SDISEL-LABEL: select_ororand:
+; SDISEL: ; %bb.0:
+; SDISEL-NEXT: cmp w3, #4
+; SDISEL-NEXT: ccmp w2, #2, #0, gt
+; SDISEL-NEXT: ccmp w1, #13, #2, ge
+; SDISEL-NEXT: ccmp w0, #0, #4, ls
+; SDISEL-NEXT: csel w0, w3, wzr, eq
+; SDISEL-NEXT: ret
+;
+; GISEL-LABEL: select_ororand:
+; GISEL: ; %bb.0:
+; GISEL-NEXT: cmp w3, #4
+; GISEL-NEXT: csel w8, w3, wzr, gt
+; GISEL-NEXT: cmp w2, #2
+; GISEL-NEXT: csel w8, w8, wzr, lt
+; GISEL-NEXT: cmp w1, #13
+; GISEL-NEXT: csel w8, w3, w8, hi
+; GISEL-NEXT: cmp w0, #0
+; GISEL-NEXT: csel w0, w3, w8, eq
+; GISEL-NEXT: ret
----------------
tschuett wrote:
The combiner has eliminated the three logical binary operations through chaining, but now we have 4 selects.
https://github.com/llvm/llvm-project/pull/74116
More information about the llvm-commits
mailing list