Debian Codegraph @

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-select-rv64.mir

raw
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \
3 # RUN: | FileCheck %s
4 ---
5 name: select_i8
6 body: |
7 bb.0.entry:
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
20 %0:_(s64) = COPY $x10
21 %1:_(s64) = COPY $x11
22 %2:_(s64) = COPY $x12
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)
28 $x10 = COPY %7(s64)
29 PseudoRET implicit $x10
30
31 ...
32 ---
33 name: select_i15
34 body: |
35 bb.0.entry:
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
48 %0:_(s64) = COPY $x10
49 %1:_(s64) = COPY $x11
50 %2:_(s64) = COPY $x12
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)
56 $x10 = COPY %7(s64)
57 PseudoRET implicit $x10
58
59 ...
60 ---
61 name: select_i16
62 body: |
63 bb.0.entry:
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
76 %0:_(s64) = COPY $x10
77 %1:_(s64) = COPY $x11
78 %2:_(s64) = COPY $x12
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)
84 $x10 = COPY %7(s64)
85 PseudoRET implicit $x10
86
87 ...
88 ---
89 name: select_i32
90 body: |
91 bb.0.entry:
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)
112 $x10 = COPY %7(s64)
113 PseudoRET implicit $x10
114
115 ...
116 ---
117 name: select_i64
118 body: |
119 bb.0.entry:
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)
134 $x10 = COPY %4(s64)
135 PseudoRET implicit $x10
136
137 ...
138 ---
139 name: select_i72
140 body: |
141 bb.0.entry:
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: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
152 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %c0, [[C1]]
153 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND1]](s64), %xlo, %ylo
154 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64)
155 ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s64)
156 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
157 %xhi:_(s64) = COPY $x10
158 %xlo:_(s64) = COPY $x11
159 %yhi:_(s64) = COPY $x12
160 %ylo:_(s64) = COPY $x13
161 %c0:_(s64) = COPY $x14
162 %x0:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64)
163 %y0:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64)
164 %x:_(s72) = G_TRUNC %x0(s128)
165 %y:_(s72) = G_TRUNC %y0(s128)
166 %c:_(s1) = G_TRUNC %c0(s64)
167 %z:_(s72) = G_SELECT %c(s1), %x(s72), %y
168 %z0:_(s128) = G_ANYEXT %z(s72)
169 %zhi:_(s64), %zlo:_(s64) = G_UNMERGE_VALUES %z0(s128)
170 $x10 = COPY %zhi(s64)
171 $x11 = COPY %zlo(s64)
172 PseudoRET implicit $x10, implicit $x11
173
174 ...
175 ---
176 name: select_i128
177 body: |
178 bb.0.entry:
179 ; CHECK-LABEL: name: select_i128
180 ; CHECK: %xhi:_(s64) = COPY $x10
181 ; CHECK-NEXT: %xlo:_(s64) = COPY $x11
182 ; CHECK-NEXT: %yhi:_(s64) = COPY $x12
183 ; CHECK-NEXT: %ylo:_(s64) = COPY $x13
184 ; CHECK-NEXT: %c0:_(s64) = COPY $x14
185 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
186 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND %c0, [[C]]
187 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[AND]](s64), %xhi, %yhi
188 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
189 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s64) = G_AND %c0, [[C1]]
190 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[AND1]](s64), %xlo, %ylo
191 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s64)
192 ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s64)
193 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
194 %xhi:_(s64) = COPY $x10
195 %xlo:_(s64) = COPY $x11
196 %yhi:_(s64) = COPY $x12
197 %ylo:_(s64) = COPY $x13
198 %c0:_(s64) = COPY $x14
199 %x:_(s128) = G_MERGE_VALUES %xhi(s64), %xlo(s64)
200 %y:_(s128) = G_MERGE_VALUES %yhi(s64), %ylo(s64)
201 %c:_(s1) = G_TRUNC %c0(s64)
202 %z:_(s128) = G_SELECT %c(s1), %x(s128), %y
203 %zhi:_(s64), %zlo:_(s64) = G_UNMERGE_VALUES %z(s128)
204 $x10 = COPY %zhi(s64)
205 $x11 = COPY %zlo(s64)
206 PseudoRET implicit $x10, implicit $x11
207
208 ...
209 ---
210 name: select_i192
211 body: |
212 bb.0.entry:
213 ; CHECK-LABEL: name: select_i192
214 ; CHECK: %yhi:_(s64) = COPY $x13
215 ; CHECK-NEXT: %ymid:_(s64) = COPY $x14
216 ; CHECK-NEXT: %ylo:_(s64) = COPY $x15
217 ; CHECK-NEXT: $x10 = COPY %yhi(s64)
218 ; CHECK-NEXT: $x11 = COPY %ymid(s64)
219 ; CHECK-NEXT: $x12 = COPY %ylo(s64)
220 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
221 %xhi:_(s64) = COPY $x10
222 %xmid:_(s64) = COPY $x11
223 %xlo:_(s64) = COPY $x12
224 %yhi:_(s64) = COPY $x13
225 %ymid:_(s64) = COPY $x14
226 %ylo:_(s64) = COPY $x15
227 %c0:_(s64) = COPY $x16
228 %x:_(s192) = G_MERGE_VALUES %xhi(s64), %xmid(s64), %xlo(s64)
229 %y:_(s192) = G_MERGE_VALUES %yhi(s64), %ymid(s64), %ylo(s64)
230 %c:_(s1) = G_TRUNC %c0(s64)
231 %z:_(s192) = G_SELECT %c(s1), %x(s192), %y
232 %zhi:_(s64), %zmid:_(s64), %zlo:_(s64) = G_UNMERGE_VALUES %y(s192)
233 $x10 = COPY %zhi(s64)
234 $x11 = COPY %zmid(s64)
235 $x12 = COPY %zlo(s64)
236 PseudoRET implicit $x10, implicit $x11, implicit $x12
237
238 ...
239 ---
240 name: select_ptr
241 body: |
242 bb.0.entry:
243 ; CHECK-LABEL: name: select_ptr
244 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
245 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
246 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s64) = COPY $x12
247 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
248 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[COPY2]], [[C]]
249 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[AND]](s64), [[COPY]], [[COPY1]]
250 ; CHECK-NEXT: $x10 = COPY [[SELECT]](p0)
251 ; CHECK-NEXT: PseudoRET implicit $x10
252 %0:_(p0) = COPY $x10
253 %1:_(p0) = COPY $x11
254 %2:_(s64) = COPY $x12
255 %3:_(s1) = G_TRUNC %2(s64)
256 %4:_(p0) = G_SELECT %3(s1), %0(p0), %1(p0)
257 $x10 = COPY %4(p0)
258 PseudoRET implicit $x10
259
260 ...