1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -mattr=+v,+m -run-pass=legalizer %s -o - | FileCheck %s
9 ; CHECK-LABEL: name: test_1_s32
10 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
11 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
12 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
13 ; CHECK-NEXT: $x10 = COPY [[LSHR]](s32)
14 ; CHECK-NEXT: PseudoRET implicit $x10
15 %0:_(s32) = G_VSCALE i32 1
17 PseudoRET implicit $x10
24 ; CHECK-LABEL: name: test_2_s32
25 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
26 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
27 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
28 ; CHECK-NEXT: $x10 = COPY [[LSHR]](s32)
29 ; CHECK-NEXT: PseudoRET implicit $x10
30 %0:_(s32) = G_VSCALE i32 2
32 PseudoRET implicit $x10
39 ; CHECK-LABEL: name: test_3_s32
40 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
41 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
42 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
43 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[LSHR]], [[C]]
44 ; CHECK-NEXT: $x10 = COPY [[MUL]](s32)
45 ; CHECK-NEXT: PseudoRET implicit $x10
46 %0:_(s32) = G_VSCALE i32 3
48 PseudoRET implicit $x10
55 ; CHECK-LABEL: name: test_4_s32
56 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
57 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
58 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
59 ; CHECK-NEXT: $x10 = COPY [[LSHR]](s32)
60 ; CHECK-NEXT: PseudoRET implicit $x10
61 %0:_(s32) = G_VSCALE i32 4
63 PseudoRET implicit $x10
70 ; CHECK-LABEL: name: test_8_s32
71 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
72 ; CHECK-NEXT: $x10 = COPY [[READ_VLENB]](s32)
73 ; CHECK-NEXT: PseudoRET implicit $x10
74 %0:_(s32) = G_VSCALE i32 8
76 PseudoRET implicit $x10
83 ; CHECK-LABEL: name: test_16_s32
84 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
85 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
86 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[READ_VLENB]], [[C]](s32)
87 ; CHECK-NEXT: $x10 = COPY [[SHL]](s32)
88 ; CHECK-NEXT: PseudoRET implicit $x10
89 %0:_(s32) = G_VSCALE i32 16
91 PseudoRET implicit $x10
98 ; CHECK-LABEL: name: test_40_s32
99 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
100 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
101 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[READ_VLENB]], [[C]]
102 ; CHECK-NEXT: $x10 = COPY [[MUL]](s32)
103 ; CHECK-NEXT: PseudoRET implicit $x10
104 %0:_(s32) = G_VSCALE i32 40
106 PseudoRET implicit $x10
113 ; CHECK-LABEL: name: test_1_s64
114 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
115 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
116 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
117 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
118 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[LSHR]], [[C1]]
119 ; CHECK-NEXT: $x10 = COPY [[MUL]](s32)
120 ; CHECK-NEXT: PseudoRET implicit $x10
121 %0:_(s64) = G_VSCALE i64 1
122 %1:_(s32) = G_TRUNC %0
124 PseudoRET implicit $x10
130 ; CHECK-LABEL: name: test_2_s64
131 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
132 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
133 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
134 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 2
135 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[LSHR]], [[C1]]
136 ; CHECK-NEXT: $x10 = COPY [[MUL]](s32)
137 ; CHECK-NEXT: PseudoRET implicit $x10
138 %0:_(s64) = G_VSCALE i64 2
139 %1:_(s32) = G_TRUNC %0
141 PseudoRET implicit $x10
147 ; CHECK-LABEL: name: test_3_s64
148 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
149 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
150 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
151 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[LSHR]], [[C]]
152 ; CHECK-NEXT: $x10 = COPY [[MUL]](s32)
153 ; CHECK-NEXT: PseudoRET implicit $x10
154 %0:_(s64) = G_VSCALE i64 3
155 %1:_(s32) = G_TRUNC %0
157 PseudoRET implicit $x10
163 ; CHECK-LABEL: name: test_4_s64
164 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
165 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
166 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
167 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
168 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[LSHR]], [[C1]]
169 ; CHECK-NEXT: $x10 = COPY [[MUL]](s32)
170 ; CHECK-NEXT: PseudoRET implicit $x10
171 %0:_(s64) = G_VSCALE i64 4
172 %1:_(s32) = G_TRUNC %0
174 PseudoRET implicit $x10
180 ; CHECK-LABEL: name: test_8_s64
181 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
182 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
183 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
184 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
185 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[LSHR]], [[C1]]
186 ; CHECK-NEXT: $x10 = COPY [[MUL]](s32)
187 ; CHECK-NEXT: PseudoRET implicit $x10
188 %0:_(s64) = G_VSCALE i64 8
189 %1:_(s32) = G_TRUNC %0
191 PseudoRET implicit $x10
197 ; CHECK-LABEL: name: test_16_s64
198 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
199 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
200 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
201 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
202 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[LSHR]], [[C1]]
203 ; CHECK-NEXT: $x10 = COPY [[MUL]](s32)
204 ; CHECK-NEXT: PseudoRET implicit $x10
205 %0:_(s64) = G_VSCALE i64 16
206 %1:_(s32) = G_TRUNC %0
208 PseudoRET implicit $x10
214 ; CHECK-LABEL: name: test_40_s64
215 ; CHECK: [[READ_VLENB:%[0-9]+]]:_(s32) = G_READ_VLENB
216 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 3
217 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[READ_VLENB]], [[C]](s32)
218 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 40
219 ; CHECK-NEXT: [[MUL:%[0-9]+]]:_(s32) = G_MUL [[LSHR]], [[C1]]
220 ; CHECK-NEXT: $x10 = COPY [[MUL]](s32)
221 ; CHECK-NEXT: PseudoRET implicit $x10
222 %0:_(s64) = G_VSCALE i64 40
223 %1:_(s32) = G_TRUNC %0
225 PseudoRET implicit $x10