1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs %s -o - | FileCheck %s
5 name: trunc_s32_shl_s64_5
7 tracksRegLiveness: true
12 ; CHECK-LABEL: name: trunc_s32_shl_s64_5
13 ; CHECK: liveins: $vgpr0_vgpr1
15 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
16 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
17 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
18 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[TRUNC]], [[C]](s32)
19 ; CHECK-NEXT: $vgpr0 = COPY [[SHL]](s32)
20 %0:_(s64) = COPY $vgpr0_vgpr1
21 %1:_(s32) = G_CONSTANT i32 1
22 %2:_(s64) = G_SHL %0:_, %1
23 %3:_(s32) = G_TRUNC %2
28 name: trunc_s16_shl_s32_5
30 tracksRegLiveness: true
35 ; CHECK-LABEL: name: trunc_s16_shl_s32_5
36 ; CHECK: liveins: $vgpr0
38 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
39 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
40 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY]], [[C]](s32)
41 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[SHL]](s32)
42 ; CHECK-NEXT: S_ENDPGM 0, implicit [[TRUNC]](s16)
43 %0:_(s32) = COPY $vgpr0
44 %1:_(s32) = G_CONSTANT i32 1
45 %2:_(s32) = G_SHL %0:_, %1
46 %3:_(s16) = G_TRUNC %2
47 S_ENDPGM 0, implicit %3
52 name: trunc_s16_shl_s64_5
54 tracksRegLiveness: true
59 ; CHECK-LABEL: name: trunc_s16_shl_s64_5
60 ; CHECK: liveins: $vgpr0_vgpr1
62 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $vgpr0_vgpr1
63 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
64 ; CHECK-NEXT: [[SHL:%[0-9]+]]:_(s64) = G_SHL [[COPY]], [[C]](s32)
65 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[SHL]](s64)
66 ; CHECK-NEXT: S_ENDPGM 0, implicit [[TRUNC]](s16)
67 %0:_(s64) = COPY $vgpr0_vgpr1
68 %1:_(s32) = G_CONSTANT i32 1
69 %2:_(s64) = G_SHL %0:_, %1
70 %3:_(s16) = G_TRUNC %2
71 S_ENDPGM 0, implicit %3
76 name: s16_trunc_s64_lshr_16
77 tracksRegLiveness: true
81 ; CHECK-LABEL: name: s16_trunc_s64_lshr_16
82 ; CHECK: liveins: $vgpr0
84 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
85 ; CHECK-NEXT: %amt:_(s32) = G_CONSTANT i32 16
86 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY]], %amt(s32)
87 ; CHECK-NEXT: %trunc:_(s16) = G_TRUNC [[LSHR]](s32)
88 ; CHECK-NEXT: %foo:_(s16) = G_CONSTANT i16 55
89 ; CHECK-NEXT: %keep:_(s32) = G_MERGE_VALUES %trunc(s16), %foo(s16)
90 ; CHECK-NEXT: $vgpr0 = COPY %keep(s32)
91 %0:_(s32) = COPY $vgpr0
92 %src:_(s64) = G_ZEXT %0
93 %amt:_(s32) = G_CONSTANT i32 16
94 %shift:_(s64) = G_LSHR %src, %amt
95 %trunc:_(s16) = G_TRUNC %shift
96 %foo:_(s16) = G_CONSTANT i16 55
97 %keep:_(s32) = G_MERGE_VALUES %trunc, %foo
102 name: s16_trunc_s64_ashr_16
103 tracksRegLiveness: true
107 ; CHECK-LABEL: name: s16_trunc_s64_ashr_16
108 ; CHECK: liveins: $vgpr0
110 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
111 ; CHECK-NEXT: %amt:_(s32) = G_CONSTANT i32 16
112 ; CHECK-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[COPY]], %amt(s32)
113 ; CHECK-NEXT: %trunc:_(s16) = G_TRUNC [[ASHR]](s32)
114 ; CHECK-NEXT: %foo:_(s16) = G_CONSTANT i16 55
115 ; CHECK-NEXT: %keep:_(s32) = G_MERGE_VALUES %trunc(s16), %foo(s16)
116 ; CHECK-NEXT: $vgpr0 = COPY %keep(s32)
117 %0:_(s32) = COPY $vgpr0
118 %src:_(s64) = G_ZEXT %0
119 %amt:_(s32) = G_CONSTANT i32 16
120 %shift:_(s64) = G_ASHR %src, %amt
121 %trunc:_(s16) = G_TRUNC %shift
122 %foo:_(s16) = G_CONSTANT i16 55
123 %keep:_(s32) = G_MERGE_VALUES %trunc, %foo
128 name: s16_trunc_s64_lshr_17_nofold
129 tracksRegLiveness: true
133 ; CHECK-LABEL: name: s16_trunc_s64_lshr_17_nofold
134 ; CHECK: liveins: $vgpr0
136 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
137 ; CHECK-NEXT: %src:_(s64) = G_ZEXT [[COPY]](s32)
138 ; CHECK-NEXT: %amt:_(s32) = G_CONSTANT i32 17
139 ; CHECK-NEXT: %shift:_(s64) = G_LSHR %src, %amt(s32)
140 ; CHECK-NEXT: %trunc:_(s16) = G_TRUNC %shift(s64)
141 ; CHECK-NEXT: %foo:_(s16) = G_CONSTANT i16 55
142 ; CHECK-NEXT: %keep:_(s32) = G_MERGE_VALUES %trunc(s16), %foo(s16)
143 ; CHECK-NEXT: $vgpr0 = COPY %keep(s32)
144 %0:_(s32) = COPY $vgpr0
145 %src:_(s64) = G_ZEXT %0
146 %amt:_(s32) = G_CONSTANT i32 17
147 %shift:_(s64) = G_LSHR %src, %amt
148 %trunc:_(s16) = G_TRUNC %shift
149 %foo:_(s16) = G_CONSTANT i16 55
150 %keep:_(s32) = G_MERGE_VALUES %trunc, %foo
155 name: s26_trunc_s64_lshr_6
156 tracksRegLiveness: true
160 ; CHECK-LABEL: name: s26_trunc_s64_lshr_6
161 ; CHECK: liveins: $vgpr0
163 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
164 ; CHECK-NEXT: %amt:_(s32) = G_CONSTANT i32 6
165 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[COPY]], %amt(s32)
166 ; CHECK-NEXT: %trunc:_(s26) = G_TRUNC [[LSHR]](s32)
167 ; CHECK-NEXT: %foo:_(s26) = G_CONSTANT i26 55
168 ; CHECK-NEXT: %keep0:_(s26) = G_ADD %trunc, %foo
169 ; CHECK-NEXT: %keep1:_(s32) = G_ANYEXT %keep0(s26)
170 ; CHECK-NEXT: $vgpr0 = COPY %keep1(s32)
171 %0:_(s32) = COPY $vgpr0
172 %src:_(s64) = G_ZEXT %0
173 %amt:_(s32) = G_CONSTANT i32 6
174 %shift:_(s64) = G_LSHR %src, %amt
175 %trunc:_(s26) = G_TRUNC %shift
176 %foo:_(s26) = G_CONSTANT i26 55
177 %keep0:_(s26) = G_ADD %trunc, %foo
178 %keep1:_(s32) = G_ANYEXT %keep0
183 name: s26_trunc_s64_lshr_7_nofold
184 tracksRegLiveness: true
188 ; CHECK-LABEL: name: s26_trunc_s64_lshr_7_nofold
189 ; CHECK: liveins: $vgpr0
191 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
192 ; CHECK-NEXT: %src:_(s64) = G_ZEXT [[COPY]](s32)
193 ; CHECK-NEXT: %amt:_(s32) = G_CONSTANT i32 7
194 ; CHECK-NEXT: %shift:_(s64) = G_LSHR %src, %amt(s32)
195 ; CHECK-NEXT: %trunc:_(s26) = G_TRUNC %shift(s64)
196 ; CHECK-NEXT: %foo:_(s26) = G_CONSTANT i26 55
197 ; CHECK-NEXT: %keep0:_(s26) = G_ADD %trunc, %foo
198 ; CHECK-NEXT: %keep1:_(s32) = G_ANYEXT %keep0(s26)
199 ; CHECK-NEXT: $vgpr0 = COPY %keep1(s32)
200 %0:_(s32) = COPY $vgpr0
201 %src:_(s64) = G_ZEXT %0
202 %amt:_(s32) = G_CONSTANT i32 7
203 %shift:_(s64) = G_LSHR %src, %amt
204 %trunc:_(s26) = G_TRUNC %shift
205 %foo:_(s26) = G_CONSTANT i26 55
206 %keep0:_(s26) = G_ADD %trunc, %foo
207 %keep1:_(s32) = G_ANYEXT %keep0