1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=aarch64 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
4 # Verify that we can fold compares into integer selects.
6 # This is an integer version of fold-fp-select.mir.
15 tracksRegLiveness: true
20 ; CHECK-LABEL: name: eq
21 ; CHECK: liveins: $w0, $w1
22 ; CHECK: [[COPY:%[0-9]+]]:gpr32sp = COPY $w0
23 ; CHECK: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
24 ; CHECK: [[MOVwzr:%[0-9]+]]:gpr32 = COPY $wzr
25 ; CHECK: $wzr = SUBSWri [[COPY]], 0, 0, implicit-def $nzcv
26 ; CHECK: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[MOVwzr]], [[COPY1]], 0, implicit $nzcv
27 ; CHECK: $w0 = COPY [[CSELWr]]
28 ; CHECK: RET_ReallyLR implicit $w0
29 %0:gpr(s32) = COPY $w0
30 %1:gpr(s32) = COPY $w1
31 %2:gpr(s32) = G_CONSTANT i32 0
32 %5:gpr(s32) = G_ICMP intpred(eq), %0(s32), %2
33 %3:gpr(s1) = G_TRUNC %5(s32)
34 %4:gpr(s32) = G_SELECT %3(s1), %2, %1
36 RET_ReallyLR implicit $w0
44 tracksRegLiveness: true
47 liveins: $s0, $w0, $w1
49 ; CHECK-LABEL: name: using_fcmp
50 ; CHECK: liveins: $s0, $w0, $w1
51 ; CHECK: [[COPY:%[0-9]+]]:gpr32 = COPY $w1
52 ; CHECK: [[COPY1:%[0-9]+]]:fpr32 = COPY $s0
53 ; CHECK: [[MOVwzr:%[0-9]+]]:gpr32 = COPY $wzr
54 ; CHECK: FCMPSri [[COPY1]], implicit-def $nzcv
55 ; CHECK: [[CSELWr:%[0-9]+]]:gpr32 = CSELWr [[MOVwzr]], [[COPY]], 0, implicit $nzcv
56 ; CHECK: $w0 = COPY [[CSELWr]]
57 ; CHECK: RET_ReallyLR implicit $w0
58 %1:gpr(s32) = COPY $w1
59 %2:fpr(s32) = COPY $s0
60 %3:fpr(s32) = G_FCONSTANT float 0.000000e+00
61 %6:gpr(s32) = G_CONSTANT i32 0
62 %7:gpr(s32) = G_FCMP floatpred(oeq), %2(s32), %3
63 %4:gpr(s1) = G_TRUNC %7(s32)
64 %5:gpr(s32) = G_SELECT %4(s1), %6, %1
66 RET_ReallyLR implicit $w0