1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \
8 ; CHECK-LABEL: name: shl_i7
9 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
11 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 127
12 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
13 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[AND]](s32)
14 ; CHECK-NEXT: $x10 = COPY [[SHL]](s32)
15 ; CHECK-NEXT: PseudoRET implicit $x10
18 %2:_(s7) = G_TRUNC %0(s32)
19 %3:_(s7) = G_TRUNC %1(s32)
20 %4:_(s7) = G_SHL %2, %3
21 %5:_(s32) = G_ANYEXT %4(s7)
23 PseudoRET implicit $x10
30 ; CHECK-LABEL: name: shl_i8
31 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
32 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
33 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
34 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
35 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[AND]](s32)
36 ; CHECK-NEXT: $x10 = COPY [[SHL]](s32)
37 ; CHECK-NEXT: PseudoRET implicit $x10
40 %2:_(s8) = G_TRUNC %0(s32)
41 %3:_(s8) = G_TRUNC %1(s32)
42 %4:_(s8) = G_SHL %2, %3
43 %5:_(s32) = G_ANYEXT %4(s8)
45 PseudoRET implicit $x10
52 ; CHECK-LABEL: name: shl_i16
53 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
54 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
55 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
56 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY1]], [[C]]
57 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[AND]](s32)
58 ; CHECK-NEXT: $x10 = COPY [[SHL]](s32)
59 ; CHECK-NEXT: PseudoRET implicit $x10
62 %2:_(s16) = G_TRUNC %0(s32)
63 %3:_(s16) = G_TRUNC %1(s32)
64 %4:_(s16) = G_SHL %2, %3
65 %5:_(s32) = G_ANYEXT %4(s16)
67 PseudoRET implicit $x10
74 ; CHECK-LABEL: name: shl_i32
75 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
76 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
77 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[COPY1]](s32)
78 ; CHECK-NEXT: $x10 = COPY [[SHL]](s32)
79 ; CHECK-NEXT: PseudoRET implicit $x10
82 %2:_(s32) = G_SHL %0, %1
84 PseudoRET implicit $x10
91 ; CHECK-LABEL: name: shl_i48
92 ; CHECK: %xlo:_(s32) = COPY $x10
93 ; CHECK-NEXT: %xhi:_(s32) = COPY $x11
94 ; CHECK-NEXT: %ylo:_(s32) = COPY $x12
95 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
96 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB %ylo, [[C]]
97 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[C]], %ylo
98 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
99 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %ylo(s32), [[C]]
100 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %ylo(s32), [[C1]]
101 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %xlo, %ylo(s32)
102 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %xlo, [[SUB1]](s32)
103 ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %xhi, %ylo(s32)
104 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[LSHR]], [[SHL1]]
105 ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL %xlo, [[SUB]](s32)
106 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[SHL]], [[C1]]
107 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[OR]], [[SHL2]]
108 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s32), %xhi, [[SELECT1]]
109 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32)
110 ; CHECK-NEXT: $x11 = COPY [[SELECT2]](s32)
111 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
112 %xlo:_(s32) = COPY $x10
113 %xhi:_(s32) = COPY $x11
114 %ylo:_(s32) = COPY $x12
115 %yhi:_(s32) = COPY $x13
116 %x0:_(s64) = G_MERGE_VALUES %xlo(s32), %xhi(s32)
117 %y0:_(s64) = G_MERGE_VALUES %ylo(s32), %yhi(s32)
118 %x:_(s48) = G_TRUNC %x0(s64)
119 %y:_(s48) = G_TRUNC %y0(s64)
120 %z:_(s48) = G_SHL %x, %y
121 %z0:_(s64) = G_ANYEXT %z(s48)
122 %zlo:_(s32), %zhi:_(s32) = G_UNMERGE_VALUES %z0(s64)
123 $x10 = COPY %zlo(s32)
124 $x11 = COPY %zhi(s32)
125 PseudoRET implicit $x10, implicit $x11
132 ; CHECK-LABEL: name: shl_i64
133 ; CHECK: %lo1:_(s32) = COPY $x10
134 ; CHECK-NEXT: %hi1:_(s32) = COPY $x11
135 ; CHECK-NEXT: %lo2:_(s32) = COPY $x12
136 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
137 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB %lo2, [[C]]
138 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[C]], %lo2
139 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
140 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %lo2(s32), [[C]]
141 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %lo2(s32), [[C1]]
142 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %lo1, %lo2(s32)
143 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %lo1, [[SUB1]](s32)
144 ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %hi1, %lo2(s32)
145 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[LSHR]], [[SHL1]]
146 ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL %lo1, [[SUB]](s32)
147 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[SHL]], [[C1]]
148 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[OR]], [[SHL2]]
149 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s32), %hi1, [[SELECT1]]
150 ; CHECK-NEXT: $x10 = COPY [[SELECT]](s32)
151 ; CHECK-NEXT: $x11 = COPY [[SELECT2]](s32)
152 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
153 %lo1:_(s32) = COPY $x10
154 %hi1:_(s32) = COPY $x11
155 %lo2:_(s32) = COPY $x12
156 %hi2:_(s32) = COPY $x13
157 %x1:_(s64) = G_MERGE_VALUES %lo1(s32), %hi1(s32)
158 %x2:_(s64) = G_MERGE_VALUES %lo2(s32), %hi2(s32)
159 %y:_(s64) = G_SHL %x1, %x2
160 %loy:_(s32), %hiy:_(s32) = G_UNMERGE_VALUES %y(s64)
161 $x10 = COPY %loy(s32)
162 $x11 = COPY %hiy(s32)
163 PseudoRET implicit $x10, implicit $x11
170 ; CHECK-LABEL: name: shl_i96
171 ; CHECK: %lo1:_(s32) = COPY $x10
172 ; CHECK-NEXT: %mid1:_(s32) = COPY $x11
173 ; CHECK-NEXT: %hi1:_(s32) = COPY $x12
174 ; CHECK-NEXT: %lo2:_(s32) = COPY $x13
175 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 64
176 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB %lo2, [[C]]
177 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB [[C]], %lo2
178 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
179 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %lo2(s32), [[C]]
180 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %lo2(s32), [[C1]]
181 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 32
182 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB %lo2, [[C2]]
183 ; CHECK-NEXT: [[SUB3:%[0-9]+]]:_(s32) = G_SUB [[C2]], %lo2
184 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %lo2(s32), [[C2]]
185 ; CHECK-NEXT: [[ICMP3:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), %lo2(s32), [[C1]]
186 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL %lo1, %lo2(s32)
187 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR %lo1, [[SUB3]](s32)
188 ; CHECK-NEXT: [[SHL1:%[0-9]+]]:_(s32) = G_SHL %mid1, %lo2(s32)
189 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[LSHR]], [[SHL1]]
190 ; CHECK-NEXT: [[SHL2:%[0-9]+]]:_(s32) = G_SHL %lo1, [[SUB2]](s32)
191 ; CHECK-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s32), [[SHL]], [[C1]]
192 ; CHECK-NEXT: [[SELECT1:%[0-9]+]]:_(s32) = G_SELECT [[ICMP2]](s32), [[OR]], [[SHL2]]
193 ; CHECK-NEXT: [[SELECT2:%[0-9]+]]:_(s32) = G_SELECT [[ICMP3]](s32), %mid1, [[SELECT1]]
194 ; CHECK-NEXT: [[SUB4:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[C2]]
195 ; CHECK-NEXT: [[SUB5:%[0-9]+]]:_(s32) = G_SUB [[C2]], [[SUB1]]
196 ; CHECK-NEXT: [[ICMP4:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[SUB1]](s32), [[C2]]
197 ; CHECK-NEXT: [[ICMP5:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[SUB1]](s32), [[C1]]
198 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR %lo1, [[SUB1]](s32)
199 ; CHECK-NEXT: [[SHL3:%[0-9]+]]:_(s32) = G_SHL %mid1, [[SUB5]](s32)
200 ; CHECK-NEXT: [[OR1:%[0-9]+]]:_(s32) = G_OR [[LSHR1]], [[SHL3]]
201 ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR %mid1, [[SUB4]](s32)
202 ; CHECK-NEXT: [[SELECT3:%[0-9]+]]:_(s32) = G_SELECT [[ICMP4]](s32), [[OR1]], [[LSHR2]]
203 ; CHECK-NEXT: [[SELECT4:%[0-9]+]]:_(s32) = G_SELECT [[ICMP5]](s32), %lo1, [[SELECT3]]
204 ; CHECK-NEXT: [[ICMP6:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %lo2(s32), [[C2]]
205 ; CHECK-NEXT: [[SHL4:%[0-9]+]]:_(s32) = G_SHL %hi1, %lo2(s32)
206 ; CHECK-NEXT: [[SELECT5:%[0-9]+]]:_(s32) = G_SELECT [[ICMP6]](s32), [[SHL4]], [[C1]]
207 ; CHECK-NEXT: [[OR2:%[0-9]+]]:_(s32) = G_OR [[SELECT4]], [[SELECT5]]
208 ; CHECK-NEXT: [[ICMP7:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[SUB]](s32), [[C2]]
209 ; CHECK-NEXT: [[SHL5:%[0-9]+]]:_(s32) = G_SHL %lo1, [[SUB]](s32)
210 ; CHECK-NEXT: [[SELECT6:%[0-9]+]]:_(s32) = G_SELECT [[ICMP7]](s32), [[SHL5]], [[C1]]
211 ; CHECK-NEXT: [[SELECT7:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[SELECT]], [[C1]]
212 ; CHECK-NEXT: [[SELECT8:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[SELECT2]], [[C1]]
213 ; CHECK-NEXT: [[SELECT9:%[0-9]+]]:_(s32) = G_SELECT [[ICMP]](s32), [[OR2]], [[SELECT6]]
214 ; CHECK-NEXT: [[SELECT10:%[0-9]+]]:_(s32) = G_SELECT [[ICMP1]](s32), %hi1, [[SELECT9]]
215 ; CHECK-NEXT: $x10 = COPY [[SELECT7]](s32)
216 ; CHECK-NEXT: $x11 = COPY [[SELECT8]](s32)
217 ; CHECK-NEXT: $x12 = COPY [[SELECT10]](s32)
218 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
219 %lo1:_(s32) = COPY $x10
220 %mid1:_(s32) = COPY $x11
221 %hi1:_(s32) = COPY $x12
222 %lo2:_(s32) = COPY $x13
223 %mid2:_(s32) = COPY $x14
224 %hi2:_(s32) = COPY $x15
225 %x1:_(s96) = G_MERGE_VALUES %lo1(s32), %mid1(s32), %hi1(s32)
226 %x2:_(s96) = G_MERGE_VALUES %lo2(s32), %mid2(s32), %hi2(s32)
227 %y:_(s96) = G_SHL %x1, %x2
228 %lo:_(s32), %mid:_(s32), %hi:_(s32) = G_UNMERGE_VALUES %y(s96)
230 $x11 = COPY %mid(s32)
232 PseudoRET implicit $x10, implicit $x11, implicit $x12