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: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[LSHR2]], [[C]](s32)
102 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[LSHR1]], [[SHL]]
103 ; CHECK-NEXT: [[BITCAST1:%[0-9]+]]:_(<2 x s16>) = G_BITCAST [[OR]](s32)
104 ; CHECK-NEXT: $vgpr0 = COPY [[BITCAST1]](<2 x s16>)
105 %0:_(<2 x s16>) = COPY $vgpr0
106 %1:_(<2 x s16>) = G_BITREVERSE %0
111 name: bitreverse_v2s32
115 liveins: $vgpr0_vgpr1
116 ; CHECK-LABEL: name: bitreverse_v2s32
117 ; CHECK: liveins: $vgpr0_vgpr1
119 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s32>) = COPY $vgpr0_vgpr1
120 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s32), [[UV1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[COPY]](<2 x s32>)
121 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV]]
122 ; CHECK-NEXT: [[BITREVERSE1:%[0-9]+]]:_(s32) = G_BITREVERSE [[UV1]]
123 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[BITREVERSE]](s32), [[BITREVERSE1]](s32)
124 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BUILD_VECTOR]](<2 x s32>)
125 %0:_(<2 x s32>) = COPY $vgpr0_vgpr1
126 %1:_(<2 x s32>) = G_BITREVERSE %0
127 $vgpr0_vgpr1 = COPY %1
135 liveins: $vgpr0_vgpr1
136 ; CHECK-LABEL: name: bitreverse_s64
137 ; CHECK: liveins: $vgpr0_vgpr1
139 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
140 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s64) = G_BITREVERSE [[COPY]]
141 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY [[BITREVERSE]](s64)
142 %0:_(s64) = COPY $vgpr0_vgpr1
143 %1:_(s64) = G_BITREVERSE %0
144 $vgpr0_vgpr1 = COPY %1
148 name: bitreverse_v2s64
152 liveins: $vgpr0_vgpr1_vgpr2_vgpr3
153 ; CHECK-LABEL: name: bitreverse_v2s64
154 ; CHECK: liveins: $vgpr0_vgpr1_vgpr2_vgpr3
156 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
157 ; CHECK-NEXT: [[UV:%[0-9]+]]:_(s64), [[UV1:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[COPY]](<2 x s64>)
158 ; CHECK-NEXT: [[BITREVERSE:%[0-9]+]]:_(s64) = G_BITREVERSE [[UV]]
159 ; CHECK-NEXT: [[BITREVERSE1:%[0-9]+]]:_(s64) = G_BITREVERSE [[UV1]]
160 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[BITREVERSE]](s64), [[BITREVERSE1]](s64)
161 ; CHECK-NEXT: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[BUILD_VECTOR]](<2 x s64>)
162 %0:_(<2 x s64>) = COPY $vgpr0_vgpr1_vgpr2_vgpr3
163 %1:_(<2 x s64>) = G_BITREVERSE %0
164 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1