1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=aarch64 -run-pass=legalizer %s -o - -verify-machineinstrs | FileCheck %s
7 tracksRegLiveness: true
12 ; CHECK-LABEL: name: bswap_s16
14 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
15 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
16 ; CHECK: [[BSWAP:%[0-9]+]]:_(s32) = G_BSWAP [[COPY1]]
17 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
18 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BSWAP]], [[C]](s64)
19 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[LSHR]](s32)
20 ; CHECK: $w0 = COPY [[COPY2]](s32)
21 ; CHECK: RET_ReallyLR implicit $w0
23 %0:_(s16) = G_TRUNC %1(s32)
24 %2:_(s16) = G_BSWAP %0
25 %3:_(s32) = G_ANYEXT %2(s16)
27 RET_ReallyLR implicit $w0
31 tracksRegLiveness: true
36 ; CHECK-LABEL: name: bswap_2xi16
38 ; CHECK: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $s0
39 ; CHECK: [[DEF:%[0-9]+]]:_(<8 x s8>) = G_IMPLICIT_DEF
40 ; CHECK: [[INSERT_SUBREG:%[0-9]+]]:_(<8 x s8>) = INSERT_SUBREG [[DEF]](<8 x s8>), [[COPY]](<2 x s16>), %subreg.ssub
41 ; CHECK: [[REV32_:%[0-9]+]]:_(<8 x s8>) = G_REV32 [[INSERT_SUBREG]]
42 ; CHECK: [[BITCAST:%[0-9]+]]:_(<2 x s32>) = G_BITCAST [[REV32_]](<8 x s8>)
43 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
44 ; CHECK: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[C]](s32), [[C]](s32)
45 ; CHECK: [[LSHR:%[0-9]+]]:_(<2 x s32>) = G_LSHR [[BITCAST]], [[BUILD_VECTOR]](<2 x s32>)
46 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
47 ; CHECK: [[EVEC:%[0-9]+]]:_(s32) = G_EXTRACT_VECTOR_ELT [[LSHR]](<2 x s32>), [[C1]](s64)
48 ; CHECK: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[EVEC]](s32)
49 ; CHECK: $s0 = COPY [[BITCAST1]](<2 x s16>)
51 %0:_(<2 x s16>) = COPY $s0
52 %1:_(<2 x s16>) = G_BSWAP %0
53 $s0 = COPY %1(<2 x s16>)
58 tracksRegLiveness: true
62 ; CHECK-LABEL: name: bswap_s32_legal
64 ; CHECK: %copy:_(s32) = COPY $w0
65 ; CHECK: %bswap:_(s32) = G_BSWAP %copy
66 ; CHECK: $w0 = COPY %bswap(s32)
67 ; CHECK: RET_ReallyLR implicit $w0
68 %copy:_(s32) = COPY $w0
69 %bswap:_(s32) = G_BSWAP %copy
70 $w0 = COPY %bswap(s32)
71 RET_ReallyLR implicit $w0
75 tracksRegLiveness: true
79 ; CHECK-LABEL: name: bswap_s64_legal
81 ; CHECK: %copy:_(s64) = COPY $x0
82 ; CHECK: %bswap:_(s64) = G_BSWAP %copy
83 ; CHECK: $x0 = COPY %bswap(s64)
84 ; CHECK: RET_ReallyLR implicit $x0
85 %copy:_(s64) = COPY $x0
86 %bswap:_(s64) = G_BSWAP %copy
87 $x0 = COPY %bswap(s64)
88 RET_ReallyLR implicit $x0
91 name: bswap_v4s32_legal
92 tracksRegLiveness: true
96 ; CHECK-LABEL: name: bswap_v4s32_legal
98 ; CHECK: %copy:_(<4 x s32>) = COPY $q0
99 ; CHECK: %bswap:_(<4 x s32>) = G_BSWAP %copy
100 ; CHECK: $q0 = COPY %bswap(<4 x s32>)
101 ; CHECK: RET_ReallyLR implicit $q0
102 %copy:_(<4 x s32>) = COPY $q0
103 %bswap:_(<4 x s32>) = G_BSWAP %copy
104 $q0 = COPY %bswap(<4 x s32>)
105 RET_ReallyLR implicit $q0
108 name: bswap_v2s32_legal
109 tracksRegLiveness: true
113 ; CHECK-LABEL: name: bswap_v2s32_legal
114 ; CHECK: liveins: $d0
115 ; CHECK: %copy:_(<2 x s32>) = COPY $d0
116 ; CHECK: %bswap:_(<2 x s32>) = G_BSWAP %copy
117 ; CHECK: $d0 = COPY %bswap(<2 x s32>)
118 ; CHECK: RET_ReallyLR implicit $d0
119 %copy:_(<2 x s32>) = COPY $d0
120 %bswap:_(<2 x s32>) = G_BSWAP %copy
121 $d0 = COPY %bswap(<2 x s32>)
122 RET_ReallyLR implicit $d0
125 name: bswap_v2s64_legal
126 tracksRegLiveness: true
130 ; CHECK-LABEL: name: bswap_v2s64_legal
131 ; CHECK: liveins: $q0
132 ; CHECK: %copy:_(<2 x s64>) = COPY $q0
133 ; CHECK: %bswap:_(<2 x s64>) = G_BSWAP %copy
134 ; CHECK: $q0 = COPY %bswap(<2 x s64>)
135 ; CHECK: RET_ReallyLR implicit $q0
136 %copy:_(<2 x s64>) = COPY $q0
137 %bswap:_(<2 x s64>) = G_BSWAP %copy
138 $q0 = COPY %bswap(<2 x s64>)
139 RET_ReallyLR implicit $q0
143 tracksRegLiveness: true
147 ; CHECK-LABEL: name: bswap_s88
148 ; CHECK: liveins: $x0
149 ; CHECK: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
150 ; CHECK: [[BSWAP:%[0-9]+]]:_(s64) = G_BSWAP [[DEF]]
151 ; CHECK: [[BSWAP1:%[0-9]+]]:_(s64) = G_BSWAP [[DEF]]
152 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 40
153 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
154 ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[BSWAP]], [[C]](s64)
155 ; CHECK: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
156 ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[BSWAP1]], [[C2]](s64)
157 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[SHL]]
158 ; CHECK: $x0 = COPY [[OR]](s64)
159 ; CHECK: RET_ReallyLR implicit $x0
160 %val:_(s88) = G_IMPLICIT_DEF
161 %bswap:_(s88) = G_BSWAP %val
162 %trunc:_(s64) = G_TRUNC %bswap
163 $x0 = COPY %trunc(s64)
164 RET_ReallyLR implicit $x0
168 tracksRegLiveness: true
172 ; CHECK-LABEL: name: bswap_s4
173 ; CHECK: liveins: $x0
174 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
175 ; CHECK: [[BSWAP:%[0-9]+]]:_(s32) = G_BSWAP [[DEF]]
176 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 28
177 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BSWAP]], [[C]](s64)
178 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 15
179 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[LSHR]](s32)
180 ; CHECK: %ext:_(s64) = G_AND [[ANYEXT]], [[C1]]
181 ; CHECK: $x0 = COPY %ext(s64)
182 ; CHECK: RET_ReallyLR implicit $x0
183 %val:_(s4) = G_IMPLICIT_DEF
184 %bswap:_(s4) = G_BSWAP %val
185 %ext:_(s64) = G_ZEXT %bswap
187 RET_ReallyLR implicit $x0