1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
5 define i32 @mod4_0_to_11(i32 %a) {
7 switch i32 %a, label %sw.default [
18 sw.bb: ; preds = %entry, %entry
21 sw.bb1: ; preds = %entry, %entry
24 sw.bb2: ; preds = %entry, %entry
27 sw.bb3: ; preds = %entry, %entry
30 sw.default: ; preds = %entry
33 sw.epilog: ; preds = %sw.default
34 switch i32 %a, label %sw.default8 [
41 sw.bb4: ; preds = %sw.epilog
44 sw.bb5: ; preds = %sw.epilog
47 sw.bb6: ; preds = %sw.epilog
50 sw.bb7: ; preds = %sw.epilog
53 sw.default8: ; preds = %sw.epilog
61 tracksRegLiveness: true
66 blocks: [ '%bb.2', '%bb.3', '%bb.4', '%bb.5', '%bb.2', '%bb.3',
69 blocks: [ '%bb.8', '%bb.9', '%bb.10', '%bb.11' ]
71 ; MIPS32-LABEL: name: mod4_0_to_11
73 ; MIPS32-NEXT: successors: %bb.6(0x40000000), %bb.1(0x40000000)
74 ; MIPS32-NEXT: liveins: $a0
76 ; MIPS32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
77 ; MIPS32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 7
78 ; MIPS32-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
79 ; MIPS32-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
80 ; MIPS32-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
81 ; MIPS32-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
82 ; MIPS32-NEXT: [[C5:%[0-9]+]]:_(s32) = G_CONSTANT i32 -1
83 ; MIPS32-NEXT: [[C6:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
84 ; MIPS32-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[C6]]
85 ; MIPS32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY [[SUB]](s32)
86 ; MIPS32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY [[C]](s32)
87 ; MIPS32-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[COPY1]](s32), [[COPY2]]
88 ; MIPS32-NEXT: G_BRCOND [[ICMP]](s32), %bb.6
90 ; MIPS32-NEXT: bb.1.entry:
91 ; MIPS32-NEXT: successors: %bb.2(0x20000000), %bb.3(0x20000000), %bb.4(0x20000000), %bb.5(0x20000000)
93 ; MIPS32-NEXT: [[JUMP_TABLE:%[0-9]+]]:_(p0) = G_JUMP_TABLE %jump-table.0
94 ; MIPS32-NEXT: G_BRJT [[JUMP_TABLE]](p0), %jump-table.0, [[COPY1]](s32)
96 ; MIPS32-NEXT: bb.2.sw.bb:
97 ; MIPS32-NEXT: $v0 = COPY [[C4]](s32)
98 ; MIPS32-NEXT: RetRA implicit $v0
100 ; MIPS32-NEXT: bb.3.sw.bb1:
101 ; MIPS32-NEXT: $v0 = COPY [[C3]](s32)
102 ; MIPS32-NEXT: RetRA implicit $v0
103 ; MIPS32-NEXT: {{ $}}
104 ; MIPS32-NEXT: bb.4.sw.bb2:
105 ; MIPS32-NEXT: $v0 = COPY [[C2]](s32)
106 ; MIPS32-NEXT: RetRA implicit $v0
107 ; MIPS32-NEXT: {{ $}}
108 ; MIPS32-NEXT: bb.5.sw.bb3:
109 ; MIPS32-NEXT: $v0 = COPY [[C1]](s32)
110 ; MIPS32-NEXT: RetRA implicit $v0
111 ; MIPS32-NEXT: {{ $}}
112 ; MIPS32-NEXT: bb.6.sw.default:
113 ; MIPS32-NEXT: successors: %bb.7(0x80000000)
114 ; MIPS32-NEXT: {{ $}}
115 ; MIPS32-NEXT: bb.7.sw.epilog:
116 ; MIPS32-NEXT: successors: %bb.13(0x40000000), %bb.8(0x40000000)
117 ; MIPS32-NEXT: {{ $}}
118 ; MIPS32-NEXT: [[C7:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
119 ; MIPS32-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[C7]]
120 ; MIPS32-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY [[SUB1]](s32)
121 ; MIPS32-NEXT: [[COPY4:%[0-9]+]]:_(s32) = COPY [[C1]](s32)
122 ; MIPS32-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[COPY3]](s32), [[COPY4]]
123 ; MIPS32-NEXT: G_BRCOND [[ICMP1]](s32), %bb.13
124 ; MIPS32-NEXT: {{ $}}
125 ; MIPS32-NEXT: bb.8.sw.epilog:
126 ; MIPS32-NEXT: successors: %bb.9(0x20000000), %bb.10(0x20000000), %bb.11(0x20000000), %bb.12(0x20000000)
127 ; MIPS32-NEXT: {{ $}}
128 ; MIPS32-NEXT: [[JUMP_TABLE1:%[0-9]+]]:_(p0) = G_JUMP_TABLE %jump-table.1
129 ; MIPS32-NEXT: G_BRJT [[JUMP_TABLE1]](p0), %jump-table.1, [[COPY3]](s32)
130 ; MIPS32-NEXT: {{ $}}
131 ; MIPS32-NEXT: bb.9.sw.bb4:
132 ; MIPS32-NEXT: $v0 = COPY [[C4]](s32)
133 ; MIPS32-NEXT: RetRA implicit $v0
134 ; MIPS32-NEXT: {{ $}}
135 ; MIPS32-NEXT: bb.10.sw.bb5:
136 ; MIPS32-NEXT: $v0 = COPY [[C3]](s32)
137 ; MIPS32-NEXT: RetRA implicit $v0
138 ; MIPS32-NEXT: {{ $}}
139 ; MIPS32-NEXT: bb.11.sw.bb6:
140 ; MIPS32-NEXT: $v0 = COPY [[C2]](s32)
141 ; MIPS32-NEXT: RetRA implicit $v0
142 ; MIPS32-NEXT: {{ $}}
143 ; MIPS32-NEXT: bb.12.sw.bb7:
144 ; MIPS32-NEXT: $v0 = COPY [[C1]](s32)
145 ; MIPS32-NEXT: RetRA implicit $v0
146 ; MIPS32-NEXT: {{ $}}
147 ; MIPS32-NEXT: bb.13.sw.default8:
148 ; MIPS32-NEXT: $v0 = COPY [[C5]](s32)
149 ; MIPS32-NEXT: RetRA implicit $v0
154 %4:_(s32) = G_CONSTANT i32 7
155 %8:_(s32) = G_CONSTANT i32 3
156 %9:_(s32) = G_CONSTANT i32 2
157 %10:_(s32) = G_CONSTANT i32 1
158 %11:_(s32) = G_CONSTANT i32 0
159 %18:_(s32) = G_CONSTANT i32 -1
160 %1:_(s32) = G_CONSTANT i32 0
161 %2:_(s32) = G_SUB %0, %1
162 %3:_(s32) = COPY %2(s32)
163 %5:_(s32) = COPY %4(s32)
164 %6:_(s1) = G_ICMP intpred(ugt), %3(s32), %5
165 G_BRCOND %6(s1), %bb.6
168 successors: %bb.2, %bb.3, %bb.4, %bb.5
170 %7:_(p0) = G_JUMP_TABLE %jump-table.0
171 G_BRJT %7(p0), %jump-table.0, %3(s32)
192 %12:_(s32) = G_CONSTANT i32 8
193 %13:_(s32) = G_SUB %0, %12
194 %14:_(s32) = COPY %13(s32)
195 %15:_(s32) = COPY %8(s32)
196 %16:_(s1) = G_ICMP intpred(ugt), %14(s32), %15
197 G_BRCOND %16(s1), %bb.12
200 successors: %bb.8, %bb.9, %bb.10, %bb.11
202 %17:_(p0) = G_JUMP_TABLE %jump-table.1
203 G_BRJT %17(p0), %jump-table.1, %14(s32)