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 void @select_i8() {entry: ret void}
6 define void @select_i16() {entry: ret void}
7 define void @select_i32() {entry: ret void}
8 define void @select_ptr() {entry: ret void}
9 define void @select_with_negation() {entry: ret void}
10 define void @select_i64() {entry: ret void}
11 define void @select_float() {entry: ret void}
12 define void @select_double() {entry: ret void}
18 tracksRegLiveness: true
21 liveins: $a0, $a1, $a2
23 ; MIPS32-LABEL: name: select_i8
24 ; MIPS32: liveins: $a0, $a1, $a2
25 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
26 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
27 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
28 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
29 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
30 ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
31 ; MIPS32: $v0 = COPY [[SELECT]](s32)
32 ; MIPS32: RetRA implicit $v0
34 %0:_(s1) = G_TRUNC %3(s32)
36 %1:_(s8) = G_TRUNC %4(s32)
38 %2:_(s8) = G_TRUNC %5(s32)
39 %6:_(s8) = G_SELECT %0(s1), %1, %2
40 %7:_(s32) = G_ANYEXT %6(s8)
48 tracksRegLiveness: true
51 liveins: $a0, $a1, $a2
53 ; MIPS32-LABEL: name: select_i16
54 ; MIPS32: liveins: $a0, $a1, $a2
55 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
56 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
57 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
58 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
59 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
60 ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
61 ; MIPS32: $v0 = COPY [[SELECT]](s32)
62 ; MIPS32: RetRA implicit $v0
64 %0:_(s1) = G_TRUNC %3(s32)
66 %1:_(s16) = G_TRUNC %4(s32)
68 %2:_(s16) = G_TRUNC %5(s32)
69 %6:_(s16) = G_SELECT %0(s1), %1, %2
70 %7:_(s32) = G_ANYEXT %6(s16)
78 tracksRegLiveness: true
81 liveins: $a0, $a1, $a2
83 ; MIPS32-LABEL: name: select_i32
84 ; MIPS32: liveins: $a0, $a1, $a2
85 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
86 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
87 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
88 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
89 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
90 ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
91 ; MIPS32: $v0 = COPY [[SELECT]](s32)
92 ; MIPS32: RetRA implicit $v0
94 %0:_(s1) = G_TRUNC %3(s32)
97 %4:_(s32) = G_SELECT %0(s1), %1, %2
105 tracksRegLiveness: true
108 liveins: $a0, $a1, $a2
110 ; MIPS32-LABEL: name: select_ptr
111 ; MIPS32: liveins: $a0, $a1, $a2
112 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
113 ; MIPS32: [[COPY1:%[0-9]+]]:_(p0) = COPY $a1
114 ; MIPS32: [[COPY2:%[0-9]+]]:_(p0) = COPY $a2
115 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
116 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
117 ; MIPS32: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
118 ; MIPS32: $v0 = COPY [[SELECT]](p0)
119 ; MIPS32: RetRA implicit $v0
121 %0:_(s1) = G_TRUNC %3(s32)
124 %4:_(p0) = G_SELECT %0(s1), %1, %2
130 name: select_with_negation
132 tracksRegLiveness: true
135 liveins: $a0, $a1, $a2, $a3
137 ; MIPS32-LABEL: name: select_with_negation
138 ; MIPS32: liveins: $a0, $a1, $a2, $a3
139 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
140 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
141 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
142 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
143 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
144 ; MIPS32: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(slt), [[COPY]](s32), [[COPY1]]
145 ; MIPS32: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[ICMP]], [[C]]
146 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[XOR]], [[C]]
147 ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY2]], [[COPY3]]
148 ; MIPS32: $v0 = COPY [[SELECT]](s32)
149 ; MIPS32: RetRA implicit $v0
154 %5:_(s1) = G_CONSTANT i1 true
155 %4:_(s1) = G_ICMP intpred(slt), %0(s32), %1
156 %6:_(s1) = G_XOR %4, %5
157 %7:_(s32) = G_SELECT %6(s1), %2, %3
165 tracksRegLiveness: true
167 - { id: 0, offset: 20, size: 4, alignment: 4, isImmutable: true }
168 - { id: 1, offset: 16, size: 4, alignment: 8, isImmutable: true }
171 liveins: $a0, $a2, $a3
173 ; MIPS32-LABEL: name: select_i64
174 ; MIPS32: liveins: $a0, $a2, $a3
175 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
176 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a2
177 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a3
178 ; MIPS32: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY1]](s32), [[COPY2]](s32)
179 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
180 ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s32) from %fixed-stack.0, align 8)
181 ; MIPS32: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.1
182 ; MIPS32: [[LOAD1:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (load (s32) from %fixed-stack.1)
183 ; MIPS32: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[LOAD]](s32), [[LOAD1]](s32)
184 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
185 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
186 ; MIPS32: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s32), [[MV]], [[MV1]]
187 ; MIPS32: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[SELECT]](s64)
188 ; MIPS32: $v0 = COPY [[UV]](s32)
189 ; MIPS32: $v1 = COPY [[UV1]](s32)
190 ; MIPS32: RetRA implicit $v0, implicit $v1
192 %0:_(s1) = G_TRUNC %3(s32)
195 %1:_(s64) = G_MERGE_VALUES %4(s32), %5(s32)
196 %8:_(p0) = G_FRAME_INDEX %fixed-stack.1
197 %6:_(s32) = G_LOAD %8(p0) :: (load (s32) from %fixed-stack.1, align 8)
198 %9:_(p0) = G_FRAME_INDEX %fixed-stack.0
199 %7:_(s32) = G_LOAD %9(p0) :: (load (s32) from %fixed-stack.0)
200 %2:_(s64) = G_MERGE_VALUES %6(s32), %7(s32)
201 %10:_(s64) = G_SELECT %0(s1), %1, %2
202 %11:_(s32), %12:_(s32) = G_UNMERGE_VALUES %10(s64)
205 RetRA implicit $v0, implicit $v1
211 tracksRegLiveness: true
214 liveins: $a0, $a1, $a2
216 ; MIPS32-LABEL: name: select_float
217 ; MIPS32: liveins: $a0, $a1, $a2
218 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
219 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
220 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
221 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
222 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY]], [[C]]
223 ; MIPS32: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY1]], [[COPY2]]
224 ; MIPS32: $f0 = COPY [[SELECT]](s32)
225 ; MIPS32: RetRA implicit $f0
227 %0:_(s1) = G_TRUNC %3(s32)
230 %4:_(s32) = G_SELECT %0(s1), %1, %2
238 tracksRegLiveness: true
240 - { id: 0, offset: 16, size: 4, alignment: 8, isImmutable: true }
245 ; MIPS32-LABEL: name: select_double
246 ; MIPS32: liveins: $d6, $d7
247 ; MIPS32: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
248 ; MIPS32: [[COPY1:%[0-9]+]]:_(s64) = COPY $d7
249 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
250 ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load (s32) from %fixed-stack.0, align 8)
251 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
252 ; MIPS32: [[AND:%[0-9]+]]:_(s32) = G_AND [[LOAD]], [[C]]
253 ; MIPS32: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]]
254 ; MIPS32: $d0 = COPY [[SELECT]](s64)
255 ; MIPS32: RetRA implicit $d0
258 %4:_(p0) = G_FRAME_INDEX %fixed-stack.0
259 %3:_(s32) = G_LOAD %4(p0) :: (load (s32) from %fixed-stack.0, align 8)
260 %2:_(s1) = G_TRUNC %3(s32)
261 %5:_(s64) = G_SELECT %2(s1), %0, %1