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_s80
119 ; CHECK: liveins: $x0
121 ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
122 ; CHECK-NEXT: [[BSWAP:%[0-9]+]]:_(s64) = G_BSWAP [[DEF]]
123 ; CHECK-NEXT: [[BSWAP1:%[0-9]+]]:_(s64) = G_BSWAP [[DEF]]
124 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 48
125 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s64) = G_LSHR [[BSWAP]], [[C]](s64)
126 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 16
127 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[BSWAP1]], [[C1]](s64)
128 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[LSHR]], [[SHL]]
129 ; CHECK-NEXT: $x0 = COPY [[OR]](s64)
130 ; CHECK-NEXT: RET_ReallyLR implicit $x0
131 %val:_(s80) = G_IMPLICIT_DEF
132 %bswap:_(s80) = G_BSWAP %val
133 %trunc:_(s64) = G_TRUNC %bswap
134 $x0 = COPY %trunc(s64)
135 RET_ReallyLR implicit $x0