1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -run-pass=amdgpu-postlegalizer-combiner -verify-machineinstrs -o - %s | FileCheck %s
5 name: s16_trunc_v2s16_buildvector
6 tracksRegLiveness: true
9 liveins: $vgpr0, $vgpr1
10 ; CHECK-LABEL: name: s16_trunc_v2s16_buildvector
11 ; CHECK: liveins: $vgpr0, $vgpr1
13 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
14 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
15 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 42
16 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s16) = G_OR [[TRUNC]], [[C]]
17 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[OR]](s16)
18 ; CHECK-NEXT: $vgpr0 = COPY [[ZEXT]](s32)
19 %0:_(s32) = COPY $vgpr0
20 %1:_(s32) = COPY $vgpr1
21 %2:_(s16) = G_TRUNC %0
22 %3:_(s16) = G_TRUNC %1
23 %4:_(<2 x s16>) = G_BUILD_VECTOR %2, %3
24 %5:_(s32) = G_BITCAST %4
25 %6:_(s16) = G_TRUNC %5
26 %7:_(s16) = G_CONSTANT i16 42
27 %8:_(s16) = G_OR %7, %6
33 name: s16_trunc_v2s16_buildvector_shift8_nofold
34 tracksRegLiveness: true
37 liveins: $vgpr0, $vgpr1
38 ; CHECK-LABEL: name: s16_trunc_v2s16_buildvector_shift8_nofold
39 ; CHECK: liveins: $vgpr0, $vgpr1
41 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
42 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
43 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
44 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
45 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR [[TRUNC]](s16), [[TRUNC1]](s16)
46 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(s32) = G_BITCAST [[BUILD_VECTOR]](<2 x s16>)
47 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
48 ; CHECK-NEXT: [[LSHR:%[0-9]+]]:_(s32) = G_LSHR [[BITCAST]], [[C]](s32)
49 ; CHECK-NEXT: [[TRUNC2:%[0-9]+]]:_(s16) = G_TRUNC [[LSHR]](s32)
50 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 42
51 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s16) = G_OR [[TRUNC2]], [[C1]]
52 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[OR]](s16)
53 ; CHECK-NEXT: $vgpr0 = COPY [[ZEXT]](s32)
54 %0:_(s32) = COPY $vgpr0
55 %1:_(s32) = COPY $vgpr1
56 %2:_(s16) = G_TRUNC %0
57 %3:_(s16) = G_TRUNC %1
58 %4:_(<2 x s16>) = G_BUILD_VECTOR %2, %3
59 %5:_(s32) = G_BITCAST %4
60 %6:_(s32) = G_CONSTANT i32 8
61 %7:_(s32) = G_LSHR %5, %6
62 %8:_(s16) = G_TRUNC %7
63 %9:_(s16) = G_CONSTANT i16 42
64 %10:_(s16) = G_OR %9, %8
65 %11:_(s32) = G_ZEXT %10
70 name: s16_trunc_v2s16_buildvector_shift16
71 tracksRegLiveness: true
74 liveins: $vgpr0, $vgpr1
75 ; CHECK-LABEL: name: s16_trunc_v2s16_buildvector_shift16
76 ; CHECK: liveins: $vgpr0, $vgpr1
78 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr1
79 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
80 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 42
81 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s16) = G_OR [[TRUNC]], [[C]]
82 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[OR]](s16)
83 ; CHECK-NEXT: $vgpr0 = COPY [[ZEXT]](s32)
84 %0:_(s32) = COPY $vgpr0
85 %1:_(s32) = COPY $vgpr1
86 %2:_(s16) = G_TRUNC %0
87 %3:_(s16) = G_TRUNC %1
88 %4:_(<2 x s16>) = G_BUILD_VECTOR %2, %3
89 %5:_(s32) = G_BITCAST %4
90 %6:_(s32) = G_CONSTANT i32 16
91 %7:_(s32) = G_LSHR %5, %6
92 %8:_(s16) = G_TRUNC %7
93 %9:_(s16) = G_CONSTANT i16 42
94 %10:_(s16) = G_OR %9, %8
95 %11:_(s32) = G_ZEXT %10
100 name: s16_trunc_v2s32_buildvector_nofold
101 tracksRegLiveness: true
104 liveins: $vgpr0, $vgpr1
105 ; CHECK-LABEL: name: s16_trunc_v2s32_buildvector_nofold
106 ; CHECK: liveins: $vgpr0, $vgpr1
108 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
109 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
110 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32)
111 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(s64) = G_BITCAST [[BUILD_VECTOR]](<2 x s32>)
112 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[BITCAST]](s64)
113 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 42
114 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s16) = G_OR [[TRUNC]], [[C]]
115 ; CHECK-NEXT: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[OR]](s16)
116 ; CHECK-NEXT: $vgpr0 = COPY [[ZEXT]](s32)
117 %0:_(s32) = COPY $vgpr0
118 %1:_(s32) = COPY $vgpr1
119 %2:_(<2 x s32>) = G_BUILD_VECTOR %0, %1
120 %3:_(s64) = G_BITCAST %2
121 %4:_(s16) = G_TRUNC %3
122 %5:_(s16) = G_CONSTANT i16 42
123 %6:_(s16) = G_OR %5, %4
124 %7:_(s32) = G_ZEXT %6
129 name: s32_trunc_v2s32_buildvector
130 tracksRegLiveness: true
133 liveins: $vgpr0, $vgpr1
134 ; CHECK-LABEL: name: s32_trunc_v2s32_buildvector
135 ; CHECK: liveins: $vgpr0, $vgpr1
137 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
138 ; CHECK-NEXT: $vgpr0 = COPY [[COPY]](s32)
139 %0:_(s32) = COPY $vgpr0
140 %1:_(s32) = COPY $vgpr1
141 %2:_(<2 x s32>) = G_BUILD_VECTOR %0, %1
142 %3:_(s64) = G_BITCAST %2
143 %4:_(s32) = G_TRUNC %3
148 name: s32_trunc_v2s32_buildvector_multiple_users
149 tracksRegLiveness: true
152 liveins: $vgpr0, $vgpr1
153 ; CHECK-LABEL: name: s32_trunc_v2s32_buildvector_multiple_users
154 ; CHECK: liveins: $vgpr0, $vgpr1
156 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $vgpr0
157 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $vgpr1
158 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s32>) = G_BUILD_VECTOR [[COPY]](s32), [[COPY1]](s32)
159 ; CHECK-NEXT: [[BITCAST:%[0-9]+]]:_(s64) = G_BITCAST [[BUILD_VECTOR]](<2 x s32>)
160 ; CHECK-NEXT: [[EVEC:%[0-9]+]]:_(s32) = G_EXTRACT_VECTOR_ELT [[BUILD_VECTOR]](<2 x s32>), [[COPY1]](s32)
161 ; CHECK-NEXT: $vgpr0 = COPY [[COPY]](s32)
162 ; CHECK-NEXT: $vgpr1 = COPY [[EVEC]](s32)
163 ; CHECK-NEXT: $vgpr2_vgpr3 = COPY [[BITCAST]](s64)
164 %0:_(s32) = COPY $vgpr0
165 %1:_(s32) = COPY $vgpr1
166 %2:_(<2 x s32>) = G_BUILD_VECTOR %0, %1
167 %3:_(s64) = G_BITCAST %2
168 %4:_(s32) = G_TRUNC %3
169 %5:_(s32) = G_EXTRACT_VECTOR_ELT %2, %1
172 $vgpr2_vgpr3 = COPY %3