1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -march=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
7 ; CHECK-LABEL: name: test_shift
8 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
9 ; CHECK: [[COPY1:%[0-9]+]]:_(s64) = COPY $x1
10 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
11 ; CHECK: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
12 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[TRUNC]], [[C]]
13 ; CHECK: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
14 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
15 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC1]], [[C1]](s32)
16 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C1]](s32)
17 ; CHECK: [[ASHR1:%[0-9]+]]:_(s32) = G_ASHR [[ASHR]], [[AND]](s32)
18 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[ASHR1]](s32)
19 ; CHECK: $w0 = COPY [[COPY2]](s32)
20 ; CHECK: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
21 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
22 ; CHECK: [[AND1:%[0-9]+]]:_(s32) = G_AND [[TRUNC2]], [[C2]]
23 ; CHECK: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
24 ; CHECK: [[TRUNC3:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
25 ; CHECK: [[AND2:%[0-9]+]]:_(s32) = G_AND [[TRUNC3]], [[C3]]
26 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[AND2]], [[AND1]](s32)
27 ; CHECK: [[COPY3:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32)
28 ; CHECK: $w0 = COPY [[COPY3]](s32)
29 ; CHECK: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
30 ; CHECK: [[TRUNC4:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
31 ; CHECK: [[AND3:%[0-9]+]]:_(s32) = G_AND [[TRUNC4]], [[C4]]
32 ; CHECK: [[TRUNC5:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
33 ; CHECK: [[SHL1:%[0-9]+]]:_(s32) = G_SHL [[TRUNC5]], [[AND3]](s32)
34 ; CHECK: [[COPY4:%[0-9]+]]:_(s32) = COPY [[SHL1]](s32)
35 ; CHECK: $w0 = COPY [[COPY4]](s32)
38 %2:_(s8) = G_TRUNC %0(s64)
39 %3:_(s8) = G_TRUNC %1(s64)
40 %4:_(s8) = G_ASHR %2, %3
41 %7:_(s32) = G_ANYEXT %4(s8)
43 %5:_(s8) = G_LSHR %2, %3
44 %8:_(s32) = G_ANYEXT %5(s8)
46 %6:_(s8) = G_SHL %2, %3
47 %9:_(s32) = G_ANYEXT %6(s8)
52 name: test_shl_i64_i32
55 ; CHECK-LABEL: name: test_shl_i64_i32
56 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
57 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
58 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
59 ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[ZEXT]](s64)
60 ; CHECK: $x0 = COPY [[SHL]](s64)
63 %2:_(s64) = G_SHL %0, %1
68 name: test_ashr_i64_i32
71 ; CHECK-LABEL: name: test_ashr_i64_i32
72 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
73 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
74 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
75 ; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[COPY]], [[ZEXT]](s64)
76 ; CHECK: $x0 = COPY [[ASHR]](s64)
79 %2:_(s64) = G_ASHR %0, %1
84 name: test_lshr_i64_i32
87 ; CHECK-LABEL: name: test_lshr_i64_i32
88 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x0
89 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
90 ; CHECK: [[ZEXT:%[0-9]+]]:_(s64) = G_ZEXT [[COPY1]](s32)
91 ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[COPY]], [[ZEXT]](s64)
92 ; CHECK: $x0 = COPY [[LSHR]](s64)
95 %2:_(s64) = G_LSHR %0, %1
101 name: test_shl_s128_s128
104 ; CHECK-LABEL: name: test_shl_s128_s128
105 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $q0
106 ; CHECK: [[COPY1:%[0-9]+]]:_(s128) = COPY $q1
107 ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s128)
108 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
109 ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](s128)
110 ; CHECK: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[TRUNC]], [[C]]
111 ; CHECK: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C]], [[TRUNC]]
112 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
113 ; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[TRUNC]](s64), [[C]]
114 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP]](s32)
115 ; CHECK: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[TRUNC]](s64), [[C1]]
116 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP1]](s32)
117 ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[TRUNC]](s64)
118 ; CHECK: [[SHL1:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[TRUNC]](s64)
119 ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[UV]], [[SUB1]](s64)
120 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[SHL1]], [[LSHR]]
121 ; CHECK: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
122 ; CHECK: [[SHL2:%[0-9]+]]:_(s64) = G_SHL [[UV]], [[SUB]](s64)
123 ; CHECK: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[SHL]], [[C2]]
124 ; CHECK: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[OR]], [[SHL2]]
125 ; CHECK: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC2]](s1), [[UV1]], [[SELECT1]]
126 ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[SELECT]](s64), [[SELECT2]](s64)
127 ; CHECK: $q0 = COPY [[MV]](s128)
128 %0:_(s128) = COPY $q0
129 %1:_(s128) = COPY $q1
130 %2:_(s128) = G_SHL %0, %1
136 name: test_lshr_s128_s128
139 ; CHECK-LABEL: name: test_lshr_s128_s128
140 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $q0
141 ; CHECK: [[COPY1:%[0-9]+]]:_(s128) = COPY $q1
142 ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s128)
143 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
144 ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](s128)
145 ; CHECK: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[TRUNC]], [[C]]
146 ; CHECK: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C]], [[TRUNC]]
147 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
148 ; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[TRUNC]](s64), [[C]]
149 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP]](s32)
150 ; CHECK: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[TRUNC]](s64), [[C1]]
151 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP1]](s32)
152 ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[UV1]], [[TRUNC]](s64)
153 ; CHECK: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[UV]], [[TRUNC]](s64)
154 ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[UV1]], [[SUB1]](s64)
155 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR1]], [[SHL]]
156 ; CHECK: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
157 ; CHECK: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR [[UV1]], [[SUB]](s64)
158 ; CHECK: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[OR]], [[LSHR2]]
159 ; CHECK: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC2]](s1), [[UV]], [[SELECT]]
160 ; CHECK: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[LSHR]], [[C2]]
161 ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[SELECT1]](s64), [[SELECT2]](s64)
162 ; CHECK: $q0 = COPY [[MV]](s128)
163 %0:_(s128) = COPY $q0
164 %1:_(s128) = COPY $q1
165 %2:_(s128) = G_LSHR %0, %1
171 name: test_ashr_s128_s128
174 ; CHECK-LABEL: name: test_ashr_s128_s128
175 ; CHECK: [[COPY:%[0-9]+]]:_(s128) = COPY $q0
176 ; CHECK: [[COPY1:%[0-9]+]]:_(s128) = COPY $q1
177 ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s128)
178 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 64
179 ; CHECK: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](s128)
180 ; CHECK: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[TRUNC]], [[C]]
181 ; CHECK: [[SUB1:%[0-9]+]]:_(s64) = G_SUB [[C]], [[TRUNC]]
182 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
183 ; CHECK: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), [[TRUNC]](s64), [[C]]
184 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP]](s32)
185 ; CHECK: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[TRUNC]](s64), [[C1]]
186 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s1) = G_TRUNC [[ICMP1]](s32)
187 ; CHECK: [[ASHR:%[0-9]+]]:_(s64) = G_ASHR [[UV1]], [[TRUNC]](s64)
188 ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[UV]], [[TRUNC]](s64)
189 ; CHECK: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[UV1]], [[SUB1]](s64)
190 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[LSHR1]]
191 ; CHECK: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 63
192 ; CHECK: [[ASHR1:%[0-9]+]]:_(s64) = G_ASHR [[UV1]], [[C2]](s64)
193 ; CHECK: [[ASHR2:%[0-9]+]]:_(s64) = G_ASHR [[UV1]], [[SUB]](s64)
194 ; CHECK: [[SELECT:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[OR]], [[ASHR2]]
195 ; CHECK: [[SELECT1:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC2]](s1), [[UV]], [[SELECT]]
196 ; CHECK: [[SELECT2:%[0-9]+]]:_(s64) = G_SELECT [[TRUNC1]](s1), [[ASHR]], [[ASHR1]]
197 ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[SELECT1]](s64), [[SELECT2]](s64)
198 ; CHECK: $q0 = COPY [[MV]](s128)
199 %0:_(s128) = COPY $q0
200 %1:_(s128) = COPY $q1
201 %2:_(s128) = G_ASHR %0, %1