Debian Codegraph @

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

raw
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \
3 # RUN: | FileCheck %s
4 ---
5 name: select_i7
6 body: |
7 bb.0.entry:
8 ; CHECK-LABEL: name: select_i7
9 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
11 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
12 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
13 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
14 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]]
15 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32)
16 ; CHECK-NEXT: PseudoRET implicit $x10
17 %0:_(s32) = COPY $x10
18 %1:_(s32) = COPY $x11
19 %2:_(s32) = COPY $x12
20 %3:_(s7) = G_TRUNC %0(s32)
21 %4:_(s7) = G_TRUNC %1(s32)
22 %5:_(s1) = G_TRUNC %2(s32)
23 %6:_(s7) = G_SELECT %5(s1), %3(s7), %4
24 %7:_(s32) = G_ANYEXT %6(s7)
25 $x10 = COPY %7(s32)
26 PseudoRET implicit $x10
27
28 ...
29 ---
30 name: select_i8
31 body: |
32 bb.0.entry:
33 ; CHECK-LABEL: name: select_i8
34 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
35 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
36 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
37 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
38 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
39 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]]
40 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32)
41 ; CHECK-NEXT: PseudoRET implicit $x10
42 %0:_(s32) = COPY $x10
43 %1:_(s32) = COPY $x11
44 %2:_(s32) = COPY $x12
45 %3:_(s8) = G_TRUNC %0(s32)
46 %4:_(s8) = G_TRUNC %1(s32)
47 %5:_(s1) = G_TRUNC %2(s32)
48 %6:_(s8) = G_SELECT %5(s1), %3(s8), %4
49 %7:_(s32) = G_ANYEXT %6(s8)
50 $x10 = COPY %7(s32)
51 PseudoRET implicit $x10
52
53 ...
54 ---
55 name: select_i16
56 body: |
57 bb.0.entry:
58 ; CHECK-LABEL: name: select_i16
59 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
60 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
61 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
62 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
63 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
64 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]]
65 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32)
66 ; CHECK-NEXT: PseudoRET implicit $x10
67 %0:_(s32) = COPY $x10
68 %1:_(s32) = COPY $x11
69 %2:_(s32) = COPY $x12
70 %3:_(s16) = G_TRUNC %0(s32)
71 %4:_(s16) = G_TRUNC %1(s32)
72 %5:_(s1) = G_TRUNC %2(s32)
73 %6:_(s16) = G_SELECT %5(s1), %3(s16), %4
74 %7:_(s32) = G_ANYEXT %6(s16)
75 $x10 = COPY %7(s32)
76 PseudoRET implicit $x10
77
78 ...
79 ---
80 name: select_i32
81 body: |
82 bb.0.entry:
83 ; CHECK-LABEL: name: select_i32
84 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
85 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
86 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
87 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
88 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
89 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]]
90 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32)
91 ; CHECK-NEXT: PseudoRET implicit $x10
92 %0:_(s32) = COPY $x10
93 %1:_(s32) = COPY $x11
94 %2:_(s32) = COPY $x12
95 %3:_(s1) = G_TRUNC %2(s32)
96 %4:_(s32) = G_SELECT %3(s1), %0(s32), %1(s32)
97 $x10 = COPY %4(s32)
98 PseudoRET implicit $x10
99
100 ...
101 ---
102 name: select_i48
103 body: |
104 bb.0.entry:
105 ; CHECK-LABEL: name: select_i48
106 ; CHECK: %xhi:_(s32) = COPY $x10
107 ; CHECK-NEXT: %xlo:_(s32) = COPY $x11
108 ; CHECK-NEXT: %yhi:_(s32) = COPY $x12
109 ; CHECK-NEXT: %ylo:_(s32) = COPY $x13
110 ; CHECK-NEXT: %c0:_(s32) = COPY $x14
111 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
112 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %c0, [[C]]
113 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), %xhi, %yhi
114 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
115 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %c0, [[C1]]
116 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[AND1]](s32), %xlo, %ylo
117 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32)
118 ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s32)
119 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
120 %xhi:_(s32) = COPY $x10
121 %xlo:_(s32) = COPY $x11
122 %yhi:_(s32) = COPY $x12
123 %ylo:_(s32) = COPY $x13
124 %c0:_(s32) = COPY $x14
125 %x0:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32)
126 %y0:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32)
127 %x:_(s48) = G_TRUNC %x0(s64)
128 %y:_(s48) = G_TRUNC %y0(s64)
129 %c:_(s1) = G_TRUNC %c0(s32)
130 %z:_(s48) = G_SELECT %c(s1), %x(s48), %y
131 %z0:_(s64) = G_ANYEXT %z(s48)
132 %zhi:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %z0(s64)
133 $x10 = COPY %zhi(s32)
134 $x11 = COPY %zlo(s32)
135 PseudoRET implicit $x10, implicit $x11
136
137 ...
138 ---
139 name: select_i64
140 body: |
141 bb.0.entry:
142 ; CHECK-LABEL: name: select_i64
143 ; CHECK: %xhi:_(s32) = COPY $x10
144 ; CHECK-NEXT: %xlo:_(s32) = COPY $x11
145 ; CHECK-NEXT: %yhi:_(s32) = COPY $x12
146 ; CHECK-NEXT: %ylo:_(s32) = COPY $x13
147 ; CHECK-NEXT: %c0:_(s32) = COPY $x14
148 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
149 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND %c0, [[C]]
150 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[AND]](s32), %xhi, %yhi
151 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
152 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND %c0, [[C1]]
153 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[AND1]](s32), %xlo, %ylo
154 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32)
155 ; CHECK-NEXT: $x11 = COPY [[SELECT1]](s32)
156 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
157 %xhi:_(s32) = COPY $x10
158 %xlo:_(s32) = COPY $x11
159 %yhi:_(s32) = COPY $x12
160 %ylo:_(s32) = COPY $x13
161 %c0:_(s32) = COPY $x14
162 %x:_(s64) = G_MERGE_VALUES %xhi(s32), %xlo(s32)
163 %y:_(s64) = G_MERGE_VALUES %yhi(s32), %ylo(s32)
164 %c:_(s1) = G_TRUNC %c0(s32)
165 %z:_(s64) = G_SELECT %c(s1), %x(s64), %y
166 %zhi:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %z(s64)
167 $x10 = COPY %zhi(s32)
168 $x11 = COPY %zlo(s32)
169 PseudoRET implicit $x10, implicit $x11
170
171 ...
172 ---
173 name: select_i96
174 body: |
175 bb.0.entry:
176 ; CHECK-LABEL: name: select_i96
177 ; CHECK: %yhi:_(s32) = COPY $x13
178 ; CHECK-NEXT: %ymid:_(s32) = COPY $x14
179 ; CHECK-NEXT: %ylo:_(s32) = COPY $x15
180 ; CHECK-NEXT: $x10 = COPY %yhi(s32)
181 ; CHECK-NEXT: $x11 = COPY %ymid(s32)
182 ; CHECK-NEXT: $x12 = COPY %ylo(s32)
183 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
184 %xhi:_(s32) = COPY $x10
185 %xmid:_(s32) = COPY $x11
186 %xlo:_(s32) = COPY $x12
187 %yhi:_(s32) = COPY $x13
188 %ymid:_(s32) = COPY $x14
189 %ylo:_(s32) = COPY $x15
190 %c0:_(s32) = COPY $x16
191 %x:_(s96) = G_MERGE_VALUES %xhi(s32), %xmid(s32), %xlo(s32)
192 %y:_(s96) = G_MERGE_VALUES %yhi(s32), %ymid(s32), %ylo(s32)
193 %c:_(s1) = G_TRUNC %c0(s32)
194 %z:_(s96) = G_SELECT %c(s1), %x(s96), %y
195 %zhi:_(s32), %zmid:_(s32), %zlo:_(s32) = G_UNMERGE_VALUES %y(s96)
196 $x10 = COPY %zhi(s32)
197 $x11 = COPY %zmid(s32)
198 $x12 = COPY %zlo(s32)
199 PseudoRET implicit $x10, implicit $x11, implicit $x12
200
201 ...
202 ---
203 name: select_ptr
204 body: |
205 bb.0.entry:
206 ; CHECK-LABEL: name: select_ptr
207 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
208 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
209 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
210 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
211 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
212 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(p0) = G_SELECT [[AND]](s32), [[COPY]], [[COPY1]]
213 ; CHECK-NEXT: $x10 = COPY [[SELECT]](p0)
214 ; CHECK-NEXT: PseudoRET implicit $x10
215 %0:_(p0) = COPY $x10
216 %1:_(p0) = COPY $x11
217 %2:_(s32) = COPY $x12
218 %3:_(s1) = G_TRUNC %2(s32)
219 %4:_(p0) = G_SELECT %3(s1), %0(p0), %1(p0)
220 $x10 = COPY %4(p0)
221 PseudoRET implicit $x10
222
223 ...