1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \
8 ; CHECK-LABEL: name: select_i8
9 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
11 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
12 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
13 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
14 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
15 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
16 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s64), [[TRUNC]], [[TRUNC1]]
17 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SELECT]](s32)
18 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
19 ; CHECK-NEXT: PseudoRET implicit $x10
23 %3:_(s8) = G_TRUNC %0(s64)
24 %4:_(s8) = G_TRUNC %1(s64)
25 %5:_(s1) = G_TRUNC %2(s64)
26 %6:_(s8) = G_SELECT %5(s1), %3(s8), %4
27 %7:_(s64) = G_ANYEXT %6(s8)
29 PseudoRET implicit $x10
36 ; CHECK-LABEL: name: select_i15
37 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
38 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
39 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
40 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
41 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
42 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
43 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
44 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s64), [[TRUNC]], [[TRUNC1]]
45 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SELECT]](s32)
46 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
47 ; CHECK-NEXT: PseudoRET implicit $x10
51 %3:_(s15) = G_TRUNC %0(s64)
52 %4:_(s15) = G_TRUNC %1(s64)
53 %5:_(s1) = G_TRUNC %2(s64)
54 %6:_(s15) = G_SELECT %5(s1), %3(s15), %4
55 %7:_(s64) = G_ANYEXT %6(s15)
57 PseudoRET implicit $x10
64 ; CHECK-LABEL: name: select_i16
65 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
66 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
67 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
68 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
69 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
70 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
71 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
72 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s64), [[TRUNC]], [[TRUNC1]]
73 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SELECT]](s32)
74 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
75 ; CHECK-NEXT: PseudoRET implicit $x10
79 %3:_(s16) = G_TRUNC %0(s64)
80 %4:_(s16) = G_TRUNC %1(s64)
81 %5:_(s1) = G_TRUNC %2(s64)
82 %6:_(s16) = G_SELECT %5(s1), %3(s16), %4
83 %7:_(s64) = G_ANYEXT %6(s16)
85 PseudoRET implicit $x10
92 ; CHECK-LABEL: name: select_i32
93 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
94 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
95 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
96 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
97 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
98 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
99 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
100 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s64), [[TRUNC]], [[TRUNC1]]
101 ; CHECK-NEXT: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[SELECT]](s32)
102 ; CHECK-NEXT: $x10 = COPY [[ANYEXT]](s64)
103 ; CHECK-NEXT: PseudoRET implicit $x10
104 %0:_(s64) = COPY $x10
105 %1:_(s64) = COPY $x11
106 %2:_(s64) = COPY $x12
107 %3:_(s32) = G_TRUNC %0(s64)
108 %4:_(s32) = G_TRUNC %1(s64)
109 %5:_(s1) = G_TRUNC %2(s64)
110 %6:_(s32) = G_SELECT %5(s1), %3(s32), %4
111 %7:_(s64) = G_ANYEXT %6(s32)
113 PseudoRET implicit $x10
120 ; CHECK-LABEL: name: select_i64
121 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
122 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
123 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
124 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
125 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
126 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), [[COPY]], [[COPY1]]
127 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64)
128 ; CHECK-NEXT: PseudoRET implicit $x10
129 %0:_(s64) = COPY $x10
130 %1:_(s64) = COPY $x11
131 %2:_(s64) = COPY $x12
132 %3:_(s1) = G_TRUNC %2(s64)
133 %4:_(s64) = G_SELECT %3(s1), %0(s64), %1(s64)
135 PseudoRET implicit $x10
142 ; CHECK-LABEL: name: select_i72
143 ; CHECK: %xhi:_(s64) = COPY $x10
144 ; CHECK-NEXT: %xlo:_(s64) = COPY $x11
145 ; CHECK-NEXT: %yhi:_(s64) = COPY $x12
146 ; CHECK-NEXT: %ylo:_(s64) = COPY $x13
147 ; CHECK-NEXT: %c0:_(s64) = COPY $x14
148 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
149 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %c0, [[C]]
150 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), %xhi, %yhi
151 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), %xlo, %ylo
152 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64)
153 ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s64)
154 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
155 %xhi:_(s64) = COPY $x10
156 %xlo:_(s64) = COPY $x11
157 %yhi:_(s64) = COPY $x12
158 %ylo:_(s64) = COPY $x13
159 %c0:_(s64) = COPY $x14
160 %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64)
161 %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64)
162 %x:_(s72) = G_TRUNC %x0(s128)
163 %y:_(s72) = G_TRUNC %y0(s128)
164 %c:_(s1) = G_TRUNC %c0(s64)
165 %z:_(s72) = G_SELECT %c(s1), %x(s72), %y
166 %z0:_(s128) = G_ANYEXT %z(s72)
167 %zhi:_(s64), %zlo:_(s64) = G_UNMERGE_VALUES %z0(s128)
168 $x10 = COPY %zhi(s64)
169 $x11 = COPY %zlo(s64)
170 PseudoRET implicit $x10, implicit $x11
177 ; CHECK-LABEL: name: select_i128
178 ; CHECK: %xhi:_(s64) = COPY $x10
179 ; CHECK-NEXT: %xlo:_(s64) = COPY $x11
180 ; CHECK-NEXT: %yhi:_(s64) = COPY $x12
181 ; CHECK-NEXT: %ylo:_(s64) = COPY $x13
182 ; CHECK-NEXT: %c0:_(s64) = COPY $x14
183 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
184 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %c0, [[C]]
185 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), %xhi, %yhi
186 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), %xlo, %ylo
187 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64)
188 ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s64)
189 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
190 %xhi:_(s64) = COPY $x10
191 %xlo:_(s64) = COPY $x11
192 %yhi:_(s64) = COPY $x12
193 %ylo:_(s64) = COPY $x13
194 %c0:_(s64) = COPY $x14
195 %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64)
196 %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64)
197 %c:_(s1) = G_TRUNC %c0(s64)
198 %z:_(s128) = G_SELECT %c(s1), %x(s128), %y
199 %zhi:_(s64), %zlo:_(s64) = G_UNMERGE_VALUES %z(s128)
200 $x10 = COPY %zhi(s64)
201 $x11 = COPY %zlo(s64)
202 PseudoRET implicit $x10, implicit $x11
209 ; CHECK-LABEL: name: select_i192
210 ; CHECK: %yhi:_(s64) = COPY $x13
211 ; CHECK-NEXT: %ymid:_(s64) = COPY $x14
212 ; CHECK-NEXT: %ylo:_(s64) = COPY $x15
213 ; CHECK-NEXT: $x10 = COPY %yhi(s64)
214 ; CHECK-NEXT: $x11 = COPY %ymid(s64)
215 ; CHECK-NEXT: $x12 = COPY %ylo(s64)
216 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
217 %xhi:_(s64) = COPY $x10
218 %xmid:_(s64) = COPY $x11
219 %xlo:_(s64) = COPY $x12
220 %yhi:_(s64) = COPY $x13
221 %ymid:_(s64) = COPY $x14
222 %ylo:_(s64) = COPY $x15
223 %c0:_(s64) = COPY $x16
224 %x:_(s192) = G_MERGE_VALUES %xhi(s64), %xmid(s64), %xlo(s64)
225 %y:_(s192) = G_MERGE_VALUES %yhi(s64), %ymid(s64), %ylo(s64)
226 %c:_(s1) = G_TRUNC %c0(s64)
227 %z:_(s192) = G_SELECT %c(s1), %x(s192), %y
228 %zhi:_(s64), %zmid:_(s64), %zlo:_(s64) = G_UNMERGE_VALUES %y(s192)
229 $x10 = COPY %zhi(s64)
230 $x11 = COPY %zmid(s64)
231 $x12 = COPY %zlo(s64)
232 PseudoRET implicit $x10, implicit $x11, implicit $x12
239 ; CHECK-LABEL: name: select_ptr
240 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
241 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
242 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
243 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
244 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
245 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[AND]](s64), [[COPY]], [[COPY1]]
246 ; CHECK-NEXT: $x10 = COPY [[SELECT]](p0)
247 ; CHECK-NEXT: PseudoRET implicit $x10
250 %2:_(s64) = COPY $x12
251 %3:_(s1) = G_TRUNC %2(s64)
252 %4:_(p0) = G_SELECT %3(s1), %0(p0), %1(p0)
254 PseudoRET implicit $x10