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
14 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $w0
15 ; CHECK: [[BSWAP:%[0-9]+]]:_(s32) = G_BSWAP [[COPY]]
16 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
17 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BSWAP]], [[C]](s64)
18 ; CHECK: $w0 = COPY [[LSHR]](s32)
19 ; CHECK: RET_ReallyLR implicit $w0
21 %0:_(s16) = G_TRUNC %1(s32)
22 %2:_(s16) = G_BSWAP %0
23 %3:_(s32) = G_ANYEXT %2(s16)
25 RET_ReallyLR implicit $w0
29 tracksRegLiveness: true
33 ; CHECK-LABEL: name: bswap_s32_legal
35 ; CHECK: %copy:_(s32) = COPY $w0
36 ; CHECK: %bswap:_(s32) = G_BSWAP %copy
37 ; CHECK: $w0 = COPY %bswap(s32)
38 ; CHECK: RET_ReallyLR implicit $w0
39 %copy:_(s32) = COPY $w0
40 %bswap:_(s32) = G_BSWAP %copy
41 $w0 = COPY %bswap(s32)
42 RET_ReallyLR implicit $w0
46 tracksRegLiveness: true
50 ; CHECK-LABEL: name: bswap_s64_legal
52 ; CHECK: %copy:_(s64) = COPY $x0
53 ; CHECK: %bswap:_(s64) = G_BSWAP %copy
54 ; CHECK: $x0 = COPY %bswap(s64)
55 ; CHECK: RET_ReallyLR implicit $x0
56 %copy:_(s64) = COPY $x0
57 %bswap:_(s64) = G_BSWAP %copy
58 $x0 = COPY %bswap(s64)
59 RET_ReallyLR implicit $x0
62 name: bswap_v4s32_legal
63 tracksRegLiveness: true
67 ; CHECK-LABEL: name: bswap_v4s32_legal
69 ; CHECK: %copy:_(<4 x s32>) = COPY $q0
70 ; CHECK: %bswap:_(<4 x s32>) = G_BSWAP %copy
71 ; CHECK: $q0 = COPY %bswap(<4 x s32>)
72 ; CHECK: RET_ReallyLR implicit $q0
73 %copy:_(<4 x s32>) = COPY $q0
74 %bswap:_(<4 x s32>) = G_BSWAP %copy
75 $q0 = COPY %bswap(<4 x s32>)
76 RET_ReallyLR implicit $q0
79 name: bswap_v2s32_legal
80 tracksRegLiveness: true
84 ; CHECK-LABEL: name: bswap_v2s32_legal
86 ; CHECK: %copy:_(<2 x s32>) = COPY $d0
87 ; CHECK: %bswap:_(<2 x s32>) = G_BSWAP %copy
88 ; CHECK: $d0 = COPY %bswap(<2 x s32>)
89 ; CHECK: RET_ReallyLR implicit $d0
90 %copy:_(<2 x s32>) = COPY $d0
91 %bswap:_(<2 x s32>) = G_BSWAP %copy
92 $d0 = COPY %bswap(<2 x s32>)
93 RET_ReallyLR implicit $d0
96 name: bswap_v2s64_legal
97 tracksRegLiveness: true
101 ; CHECK-LABEL: name: bswap_v2s64_legal
102 ; CHECK: liveins: $q0
103 ; CHECK: %copy:_(<2 x s64>) = COPY $q0
104 ; CHECK: %bswap:_(<2 x s64>) = G_BSWAP %copy
105 ; CHECK: $q0 = COPY %bswap(<2 x s64>)
106 ; CHECK: RET_ReallyLR implicit $q0
107 %copy:_(<2 x s64>) = COPY $q0
108 %bswap:_(<2 x s64>) = G_BSWAP %copy
109 $q0 = COPY %bswap(<2 x s64>)
110 RET_ReallyLR implicit $q0
114 tracksRegLiveness: true
118 ; CHECK-LABEL: name: bswap_s88
119 ; CHECK: liveins: $x0
120 ; CHECK: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
121 ; CHECK: [[BSWAP:%[0-9]+]]:_(s64) = G_BSWAP [[DEF]]
122 ; CHECK: [[BSWAP1:%[0-9]+]]:_(s64) = G_BSWAP [[DEF]]
123 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 40
124 ; CHECK: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[BSWAP]], [[C]](s64)
125 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 24
126 ; CHECK: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[BSWAP1]], [[C1]](s64)
127 ; CHECK: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[SHL]]
128 ; CHECK: $x0 = COPY [[OR]](s64)
129 ; CHECK: RET_ReallyLR implicit $x0
130 %val:_(s88) = G_IMPLICIT_DEF
131 %bswap:_(s88) = G_BSWAP %val
132 %trunc:_(s64) = G_TRUNC %bswap
133 $x0 = COPY %trunc(s64)
134 RET_ReallyLR implicit $x0
138 tracksRegLiveness: true
142 ; CHECK-LABEL: name: bswap_s4
143 ; CHECK: liveins: $x0
144 ; CHECK: [[DEF:%[0-9]+]]:_(s32) = G_IMPLICIT_DEF
145 ; CHECK: [[BSWAP:%[0-9]+]]:_(s32) = G_BSWAP [[DEF]]
146 ; CHECK: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 28
147 ; CHECK: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BSWAP]], [[C]](s64)
148 ; CHECK: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 15
149 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s64) = G_ANYEXT [[LSHR]](s32)
150 ; CHECK: %ext:_(s64) = G_AND [[ANYEXT]], [[C1]]
151 ; CHECK: $x0 = COPY %ext(s64)
152 ; CHECK: RET_ReallyLR implicit $x0
153 %val:_(s4) = G_IMPLICIT_DEF
154 %bswap:_(s4) = G_BSWAP %val
155 %ext:_(s64) = G_ZEXT %bswap
157 RET_ReallyLR implicit $x0