1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64 -run-pass=legalizer %s -o - -verify-machineinstrs | FileCheck %s
7 tracksRegLiveness: true
12 ; CHECK-LABEL: name: bswap_s16
15 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
16 ; CHECK-NEXT: [[BSWAP:%[0-9]+]]:_(s32) = G_BSWAP [[COPY]]
17 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
18 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BSWAP]], [[C]](s64)
19 ; CHECK-NEXT: $w0 = COPY [[LSHR]](s32)
20 ; CHECK-NEXT: RET_ReallyLR implicit $w0
22 %0:_(s16) = G_TRUNC %1(s32)
23 %2:_(s16) = G_BSWAP %0
24 %3:_(s32) = G_ANYEXT %2(s16)
26 RET_ReallyLR implicit $w0
30 tracksRegLiveness: true
34 ; CHECK-LABEL: name: bswap_s32_legal
37 ; CHECK-NEXT: %copy:_(s32) = COPY $w0
38 ; CHECK-NEXT: %bswap:_(s32) = G_BSWAP %copy
39 ; CHECK-NEXT: $w0 = COPY %bswap(s32)
40 ; CHECK-NEXT: RET_ReallyLR implicit $w0
41 %copy:_(s32) = COPY $w0
42 %bswap:_(s32) = G_BSWAP %copy
43 $w0 = COPY %bswap(s32)
44 RET_ReallyLR implicit $w0
48 tracksRegLiveness: true
52 ; CHECK-LABEL: name: bswap_s64_legal
55 ; CHECK-NEXT: %copy:_(s64) = COPY $x0
56 ; CHECK-NEXT: %bswap:_(s64) = G_BSWAP %copy
57 ; CHECK-NEXT: $x0 = COPY %bswap(s64)
58 ; CHECK-NEXT: RET_ReallyLR implicit $x0
59 %copy:_(s64) = COPY $x0
60 %bswap:_(s64) = G_BSWAP %copy
61 $x0 = COPY %bswap(s64)
62 RET_ReallyLR implicit $x0
65 name: bswap_v4s16_legal
66 tracksRegLiveness: true
70 ; CHECK-LABEL: name: bswap_v4s16_legal
73 ; CHECK-NEXT: %copy:_(<4 x s16>) = COPY $d0
74 ; CHECK-NEXT: %bswap:_(<4 x s16>) = G_BSWAP %copy
75 ; CHECK-NEXT: $d0 = COPY %bswap(<4 x s16>)
76 ; CHECK-NEXT: RET_ReallyLR implicit $d0
77 %copy:_(<4 x s16>) = COPY $d0
78 %bswap:_(<4 x s16>) = G_BSWAP %copy
79 $d0 = COPY %bswap(<4 x s16>)
80 RET_ReallyLR implicit $d0
83 name: bswap_v8s16_legal
84 tracksRegLiveness: true
88 ; CHECK-LABEL: name: bswap_v8s16_legal
91 ; CHECK-NEXT: %copy:_(<8 x s16>) = COPY $q0
92 ; CHECK-NEXT: %bswap:_(<8 x s16>) = G_BSWAP %copy
93 ; CHECK-NEXT: $q0 = COPY %bswap(<8 x s16>)
94 ; CHECK-NEXT: RET_ReallyLR implicit $q0
95 %copy:_(<8 x s16>) = COPY $q0
96 %bswap:_(<8 x s16>) = G_BSWAP %copy
97 $q0 = COPY %bswap(<8 x s16>)
98 RET_ReallyLR implicit $q0
101 name: bswap_v4s32_legal
102 tracksRegLiveness: true
106 ; CHECK-LABEL: name: bswap_v4s32_legal
107 ; CHECK: liveins: $q0
109 ; CHECK-NEXT: %copy:_(<4 x s32>) = COPY $q0
110 ; CHECK-NEXT: %bswap:_(<4 x s32>) = G_BSWAP %copy
111 ; CHECK-NEXT: $q0 = COPY %bswap(<4 x s32>)
112 ; CHECK-NEXT: RET_ReallyLR implicit $q0
113 %copy:_(<4 x s32>) = COPY $q0
114 %bswap:_(<4 x s32>) = G_BSWAP %copy
115 $q0 = COPY %bswap(<4 x s32>)
116 RET_ReallyLR implicit $q0
119 name: bswap_v2s32_legal
120 tracksRegLiveness: true
124 ; CHECK-LABEL: name: bswap_v2s32_legal
125 ; CHECK: liveins: $d0
127 ; CHECK-NEXT: %copy:_(<2 x s32>) = COPY $d0
128 ; CHECK-NEXT: %bswap:_(<2 x s32>) = G_BSWAP %copy
129 ; CHECK-NEXT: $d0 = COPY %bswap(<2 x s32>)
130 ; CHECK-NEXT: RET_ReallyLR implicit $d0
131 %copy:_(<2 x s32>) = COPY $d0
132 %bswap:_(<2 x s32>) = G_BSWAP %copy
133 $d0 = COPY %bswap(<2 x s32>)
134 RET_ReallyLR implicit $d0
137 name: bswap_v2s64_legal
138 tracksRegLiveness: true
142 ; CHECK-LABEL: name: bswap_v2s64_legal
143 ; CHECK: liveins: $q0
145 ; CHECK-NEXT: %copy:_(<2 x s64>) = COPY $q0
146 ; CHECK-NEXT: %bswap:_(<2 x s64>) = G_BSWAP %copy
147 ; CHECK-NEXT: $q0 = COPY %bswap(<2 x s64>)
148 ; CHECK-NEXT: RET_ReallyLR implicit $q0
149 %copy:_(<2 x s64>) = COPY $q0
150 %bswap:_(<2 x s64>) = G_BSWAP %copy
151 $q0 = COPY %bswap(<2 x s64>)
152 RET_ReallyLR implicit $q0
156 tracksRegLiveness: true
160 ; CHECK-LABEL: name: bswap_s80
161 ; CHECK: liveins: $x0
163 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
164 ; CHECK-NEXT: [[BSWAP:%[0-9]+]]:_(s64) = G_BSWAP [[DEF]]
165 ; CHECK-NEXT: [[BSWAP1:%[0-9]+]]:_(s64) = G_BSWAP [[DEF]]
166 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 48
167 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[BSWAP]], [[C]](s64)
168 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
169 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[BSWAP1]], [[C1]](s64)
170 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[SHL]]
171 ; CHECK-NEXT: $x0 = COPY [[OR]](s64)
172 ; CHECK-NEXT: RET_ReallyLR implicit $x0
173 %val:_(s80) = G_IMPLICIT_DEF
174 %bswap:_(s80) = G_BSWAP %val
175 %trunc:_(s64) = G_TRUNC %bswap
176 $x0 = COPY %trunc(s64)
177 RET_ReallyLR implicit $x0
181 tracksRegLiveness: true
185 ; CHECK-LABEL: name: bswap_v2s48
186 ; CHECK: liveins: $q0, $x8
188 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x8
189 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(<2 x s64>) = COPY $q0
190 ; CHECK-NEXT: [[BSWAP:%[0-9]+]]:_(<2 x s64>) = G_BSWAP [[COPY1]]
191 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
192 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[C]](s64), [[C]](s64)
193 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(<2 x s64>) = G_LSHR [[BSWAP]], [[BUILD_VECTOR]](<2 x s64>)
194 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[LSHR]](<2 x s64>)
195 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 32
196 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s64) = G_LSHR [[UV]], [[C1]](s64)
197 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
198 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C2]](s64)
199 ; CHECK-NEXT: G_STORE [[UV]](s64), [[COPY]](p0) :: (store (s32), align 16)
200 ; CHECK-NEXT: G_STORE [[LSHR1]](s64), [[PTR_ADD]](p0) :: (store (s16) into unknown-address + 4, align 4)
201 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 6
202 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C3]](s64)
203 ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s64) = G_LSHR [[UV1]], [[C1]](s64)
204 ; CHECK-NEXT: [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD [[PTR_ADD1]], [[C2]](s64)
205 ; CHECK-NEXT: G_STORE [[UV1]](s64), [[PTR_ADD1]](p0) :: (store (s32) into unknown-address + 6, align 2)
206 ; CHECK-NEXT: G_STORE [[LSHR2]](s64), [[PTR_ADD2]](p0) :: (store (s16) into unknown-address + 10)
207 ; CHECK-NEXT: RET_ReallyLR
209 %2:_(<2 x s64>) = COPY $q0
210 %0:_(<2 x s48>) = G_TRUNC %2:_(<2 x s64>)
211 %bswap:_(<2 x s48>) = G_BSWAP %0
212 G_STORE %bswap:_(<2 x s48>), %1:_(p0) :: (store (<2 x s48>), align 16)