1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=fiji -O0 -run-pass=legalizer %s -o - | FileCheck %s
10 ; CHECK-LABEL: name: bitreverse_s8
11 ; CHECK: liveins: $vgpr0
13 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
14 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY]]
15 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
16 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32)
17 ; CHECK-NEXT: $vgpr0 = COPY [[LSHR]](s32)
18 %0:_(s32) = COPY $vgpr0
20 %2:_(s8) = G_BITREVERSE %1
21 %3:_(s32) = G_ANYEXT %2
31 ; CHECK-LABEL: name: bitreverse_s16
32 ; CHECK: liveins: $vgpr0
34 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
35 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY]]
36 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
37 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32)
38 ; CHECK-NEXT: $vgpr0 = COPY [[LSHR]](s32)
39 %0:_(s32) = COPY $vgpr0
40 %1:_(s16) = G_TRUNC %0
41 %2:_(s16) = G_BITREVERSE %1
42 %3:_(s32) = G_ANYEXT %2
52 ; CHECK-LABEL: name: bitreverse_s24
53 ; CHECK: liveins: $vgpr0
55 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
56 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY]]
57 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
58 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32)
59 ; CHECK-NEXT: $vgpr0 = COPY [[LSHR]](s32)
60 %0:_(s32) = COPY $vgpr0
61 %1:_(s24) = G_TRUNC %0
62 %2:_(s24) = G_BITREVERSE %1
63 %3:_(s32) = G_ANYEXT %2
73 ; CHECK-LABEL: name: bitreverse_s32
74 ; CHECK: liveins: $vgpr0
76 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
77 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[COPY]]
78 ; CHECK-NEXT: $vgpr0 = COPY [[BITREVERSE]](s32)
79 %0:_(s32) = COPY $vgpr0
80 %1:_(s32) = G_BITREVERSE %0
85 name: bitreverse_v2s16
90 ; CHECK-LABEL: name: bitreverse_v2s16
91 ; CHECK: liveins: $vgpr0
93 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s16>) = COPY $vgpr0
94 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[COPY]](<2 x s16>)
95 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
96 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITCAST]], [[C]](s32)
97 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[BITCAST]]
98 ; CHECK-NEXT: [[LSHR1:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE]], [[C]](s32)
99 ; CHECK-NEXT: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[LSHR]]
100 ; CHECK-NEXT: [[LSHR2:%[0-9]+]]:_(s32) = G_LSHR [[BITREVERSE1]], [[C]](s32)
101 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
102 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[LSHR1]], [[C1]]
103 ; CHECK-NEXT: [[AND1:%[0-9]+]]:_(s32) = G_AND [[LSHR2]], [[C1]]
104 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[AND1]], [[C]](s32)
105 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[AND]], [[SHL]]
106 ; CHECK-NEXT: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
107 ; CHECK-NEXT: $vgpr0 = COPY [[BITCAST1]](<2 x s16>)
108 %0:_(<2 x s16>) = COPY $vgpr0
109 %1:_(<2 x s16>) = G_BITREVERSE %0
114 name: bitreverse_v2s32
118 liveins: $vgpr0_vgpr1
119 ; CHECK-LABEL: name: bitreverse_v2s32
120 ; CHECK: liveins: $vgpr0_vgpr1
122 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
123 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
124 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV]]
125 ; CHECK-NEXT: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV1]]
126 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[BITREVERSE]](s32), [[BITREVERSE1]](s32)
127 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
128 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
129 %1:_(<2 x s32>) = G_BITREVERSE %0
130 $vgpr0_vgpr1 = COPY %1
138 liveins: $vgpr0_vgpr1
139 ; CHECK-LABEL: name: bitreverse_s64
140 ; CHECK: liveins: $vgpr0_vgpr1
142 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
143 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s64) = G_BITREVERSE [[COPY]]
144 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BITREVERSE]](s64)
145 %0:_(s64) = COPY $vgpr0_vgpr1
146 %1:_(s64) = G_BITREVERSE %0
147 $vgpr0_vgpr1 = COPY %1
151 name: bitreverse_v2s64
155 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
156 ; CHECK-LABEL: name: bitreverse_v2s64
157 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
159 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
160 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
161 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s64) = G_BITREVERSE [[UV]]
162 ; CHECK-NEXT: [[BITREVERSE1:%[0-9]+]]:_(s64) = G_BITREVERSE [[UV1]]
163 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[BITREVERSE]](s64), [[BITREVERSE1]](s64)
164 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x s64>)
165 %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
166 %1:_(<2 x s64>) = G_BITREVERSE %0
167 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1