1 ; RUN: llc -mtriple=x86_64-- -global-isel=0 -print-after=finalize-isel \
2 ; RUN: -stop-after=finalize-isel %s -o /dev/null 2>&1 | \
3 ; RUN: FileCheck %s --check-prefix=CHECK-SDISEL
4 ; RUN: llc -mtriple=x86_64-- -global-isel=1 -print-after=finalize-isel \
5 ; RUN: -stop-after=finalize-isel %s -o /dev/null 2>&1 | \
6 ; RUN: FileCheck %s --check-prefix=CHECK-GISEL
9 define i32 @baz(i32 %0) {
10 ; CHECK-SDISEL: bb.0 (%ir-block.1):
11 ; CHECK-SDISEL: successors: %bb.4(0x80000000); %bb.4(100.00%)
12 ; CHECK-SDISEL: liveins: $edi
13 ; CHECK-SDISEL: %1:gr32 = COPY $edi
14 ; CHECK-SDISEL: %2:gr32 = MOV32r0 implicit-def dead $eflags
15 ; CHECK-SDISEL: %3:gr32 = COPY %1:gr32
16 ; CHECK-SDISEL: bb.4 (%ir-block.1):
17 ; CHECK-SDISEL: ; predecessors: %bb.0
18 ; CHECK-SDISEL: successors: %bb.3(0x55555555), %bb.1(0x2aaaaaab); %bb.3(66.67%), %bb.1(33.33%)
19 ; CHECK-SDISEL: %4:gr32 = MOV32ri 13056
20 ; CHECK-SDISEL: BT32rr killed %4:gr32, %3:gr32, implicit-def $eflags
21 ; CHECK-SDISEL: JCC_1 %bb.3, 2, implicit $eflags
22 ; CHECK-SDISEL: JMP_1 %bb.1
23 ; CHECK-SDISEL: bb.5 (%ir-block.1):
24 ; CHECK-SDISEL: bb.1.sw.epilog8:
25 ; CHECK-SDISEL: ; predecessors: %bb.4
26 ; CHECK-SDISEL: successors: %bb.3(0x80000000); %bb.3(100.00%)
27 ; CHECK-SDISEL: %5:gr32 = MOV32ri 1
28 ; CHECK-SDISEL: JMP_1 %bb.3
29 ; CHECK-SDISEL: bb.2.if.then.unreachabledefault:
30 ; CHECK-SDISEL: bb.3.return:
31 ; CHECK-SDISEL: ; predecessors: %bb.4, %bb.1
32 ; CHECK-SDISEL: %0:gr32 = PHI %2:gr32, %bb.4, %5:gr32, %bb.1
33 ; CHECK-SDISEL: $eax = COPY %0:gr32
34 ; CHECK-SDISEL: RET 0, $eax
37 ; CHECK-GISEL: bb.1 (%ir-block.1):
38 ; CHECK-GISEL: successors: %bb.5(0x80000000); %bb.5(100.00%)
39 ; CHECK-GISEL: liveins: $edi
40 ; CHECK-GISEL: %0:gr32 = COPY $edi
41 ; CHECK-GISEL: %10:gr32 = MOV32ri 1
42 ; CHECK-GISEL: %11:gr32 = MOV32r0 implicit-def dead $eflags
43 ; CHECK-GISEL: %2:gr32 = SUB32ri %0:gr32(tied-def 0), 0, implicit-def dead $eflags
44 ; CHECK-GISEL: bb.5 (%ir-block.1):
45 ; CHECK-GISEL: ; predecessors: %bb.1
46 ; CHECK-GISEL: successors: %bb.4(0x55555555), %bb.2(0x2aaaaaab); %bb.4(66.67%), %bb.2(33.33%)
47 ; CHECK-GISEL: %3:gr32 = MOV32ri 1
48 ; CHECK-GISEL: %13:gr8 = COPY %2.sub_8bit:gr32
49 ; CHECK-GISEL: $cl = COPY %13:gr8
50 ; CHECK-GISEL: %4:gr32 = SHL32rCL %3:gr32(tied-def 0), implicit-def dead $eflags, implicit $cl
51 ; CHECK-GISEL: %6:gr32 = AND32ri %4:gr32(tied-def 0), 13056, implicit-def dead $eflags
52 ; CHECK-GISEL: %7:gr32 = MOV32r0 implicit-def dead $eflags
53 ; CHECK-GISEL: CMP32rr %6:gr32, %7:gr32, implicit-def $eflags
54 ; CHECK-GISEL: %12:gr8 = SETCCr 5, implicit $eflags
55 ; CHECK-GISEL: TEST8ri %12:gr8, 1, implicit-def $eflags
56 ; CHECK-GISEL: JCC_1 %bb.4, 5, implicit $eflags
57 ; CHECK-GISEL: JMP_1 %bb.2
58 ; CHECK-GISEL: bb.6 (%ir-block.1):
59 ; CHECK-GISEL: bb.2.sw.epilog8:
60 ; CHECK-GISEL: ; predecessors: %bb.5
61 ; CHECK-GISEL: successors: %bb.4(0x80000000); %bb.4(100.00%)
62 ; CHECK-GISEL: JMP_1 %bb.4
63 ; CHECK-GISEL: bb.3.if.then.unreachabledefault:
64 ; CHECK-GISEL: bb.4.return:
65 ; CHECK-GISEL: ; predecessors: %bb.5, %bb.2
66 ; CHECK-GISEL: %9:gr32 = PHI %10:gr32, %bb.2, %11:gr32, %bb.5
67 ; CHECK-GISEL: $eax = COPY %9:gr32
68 ; CHECK-GISEL: RET 0, implicit $eax
70 switch i32 %0, label %if.then.unreachabledefault [
71 i32 4, label %sw.epilog8
72 i32 5, label %sw.epilog8
88 if.then.unreachabledefault:
92 %retval.0 = phi i32 [ 1, %sw.epilog8 ], [ 0, %sw.bb2 ], [ 0, %sw.bb4 ]