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: v2s16_trunc_same_bitcast_lshr16
6 tracksRegLiveness: true
11 ; CHECK-LABEL: name: v2s16_trunc_same_bitcast_lshr16
12 ; CHECK: liveins: $vgpr0
14 ; CHECK-NEXT: %src:_(<2 x s16>) = COPY $vgpr0
15 ; CHECK-NEXT: $vgpr0 = COPY %src(<2 x s16>)
16 %src:_(<2 x s16>) = COPY $vgpr0
17 %bitcast:_(s32) = G_BITCAST %src
18 %lshr_amount:_(s32) = G_CONSTANT i32 16
19 %lshr:_(s32) = G_LSHR %bitcast, %lshr_amount
20 %root:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %bitcast, %lshr
25 name: v2s16_trunc_different_bitcast_lshr16
26 tracksRegLiveness: true
31 ; CHECK-LABEL: name: v2s16_trunc_different_bitcast_lshr16
32 ; CHECK: liveins: $vgpr0
34 ; CHECK-NEXT: %src:_(<2 x s16>) = COPY $vgpr0
35 ; CHECK-NEXT: $vgpr0 = COPY %src(<2 x s16>)
36 %src:_(<2 x s16>) = COPY $vgpr0
37 %bitcast0:_(s32) = G_BITCAST %src
38 %bitcast1:_(s32) = G_BITCAST %src
39 %lshr_amount:_(s32) = G_CONSTANT i32 16
40 %lshr:_(s32) = G_LSHR %bitcast1, %lshr_amount
41 %root:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %bitcast0, %lshr
46 name: v2s16_trunc_same_bitcast_lshr8_nocombine
47 tracksRegLiveness: true
52 ; CHECK-LABEL: name: v2s16_trunc_same_bitcast_lshr8_nocombine
53 ; CHECK: liveins: $vgpr0
55 ; CHECK-NEXT: %src:_(<2 x s16>) = COPY $vgpr0
56 ; CHECK-NEXT: %bitcast:_(s32) = G_BITCAST %src(<2 x s16>)
57 ; CHECK-NEXT: %lshr_amount:_(s32) = G_CONSTANT i32 8
58 ; CHECK-NEXT: %lshr:_(s32) = G_LSHR %bitcast, %lshr_amount(s32)
59 ; CHECK-NEXT: %root:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %bitcast(s32), %lshr(s32)
60 ; CHECK-NEXT: $vgpr0 = COPY %root(<2 x s16>)
61 %src:_(<2 x s16>) = COPY $vgpr0
62 %bitcast:_(s32) = G_BITCAST %src
63 %lshr_amount:_(s32) = G_CONSTANT i32 8
64 %lshr:_(s32) = G_LSHR %bitcast, %lshr_amount
65 %root:_(<2 x s16>) = G_BUILD_VECTOR_TRUNC %bitcast, %lshr
70 name: v2s16_same_bitcast_lshr16
71 tracksRegLiveness: true
76 ; CHECK-LABEL: name: v2s16_same_bitcast_lshr16
77 ; CHECK: liveins: $vgpr0
79 ; CHECK-NEXT: %src:_(<2 x s16>) = COPY $vgpr0
80 ; CHECK-NEXT: $vgpr0 = COPY %src(<2 x s16>)
81 %src:_(<2 x s16>) = COPY $vgpr0
82 %bitcast:_(s32) = G_BITCAST %src
83 %lshr_amount:_(s32) = G_CONSTANT i32 16
84 %lshr:_(s32) = G_LSHR %bitcast, %lshr_amount
85 %trunclo:_(s16) = G_TRUNC %bitcast
86 %trunchi:_(s16) = G_TRUNC %lshr
87 %root:_(<2 x s16>) = G_BUILD_VECTOR %trunclo, %trunchi
92 name: v2s16_same_bitcast_lshr8_nocombine
93 tracksRegLiveness: true
98 ; CHECK-LABEL: name: v2s16_same_bitcast_lshr8_nocombine
99 ; CHECK: liveins: $vgpr0
101 ; CHECK-NEXT: %src:_(<2 x s16>) = COPY $vgpr0
102 ; CHECK-NEXT: %bitcast:_(s32) = G_BITCAST %src(<2 x s16>)
103 ; CHECK-NEXT: %lshr_amount:_(s32) = G_CONSTANT i32 8
104 ; CHECK-NEXT: %lshr:_(s32) = G_LSHR %bitcast, %lshr_amount(s32)
105 ; CHECK-NEXT: %trunclo:_(s16) = G_TRUNC %bitcast(s32)
106 ; CHECK-NEXT: %trunchi:_(s16) = G_TRUNC %lshr(s32)
107 ; CHECK-NEXT: %root:_(<2 x s16>) = G_BUILD_VECTOR %trunclo(s16), %trunchi(s16)
108 ; CHECK-NEXT: $vgpr0 = COPY %root(<2 x s16>)
109 %src:_(<2 x s16>) = COPY $vgpr0
110 %bitcast:_(s32) = G_BITCAST %src
111 %lshr_amount:_(s32) = G_CONSTANT i32 8
112 %lshr:_(s32) = G_LSHR %bitcast, %lshr_amount
113 %trunclo:_(s16) = G_TRUNC %bitcast
114 %trunchi:_(s16) = G_TRUNC %lshr
115 %root:_(<2 x s16>) = G_BUILD_VECTOR %trunclo, %trunchi
121 tracksRegLiveness: true
126 ; CHECK-LABEL: name: v2s16_undefhi
127 ; CHECK: liveins: $vgpr0
129 ; CHECK-NEXT: %src:_(<2 x s16>) = COPY $vgpr0
130 ; CHECK-NEXT: $vgpr0 = COPY %src(<2 x s16>)
131 %src:_(<2 x s16>) = COPY $vgpr0
132 %bitcast:_(s32) = G_BITCAST %src
133 %trunc:_(s16) = G_TRUNC %bitcast
134 %undef:_(s16) = G_IMPLICIT_DEF
135 %root:_(<2 x s16>) = G_BUILD_VECTOR %trunc, %undef
141 tracksRegLiveness: true
145 liveins: $vgpr0_vgpr1
146 ; CHECK-LABEL: name: v2s32_undefhi
147 ; CHECK: liveins: $vgpr0_vgpr1
149 ; CHECK-NEXT: %src:_(<2 x s32>) = COPY $vgpr0_vgpr1
150 ; CHECK-NEXT: $vgpr0_vgpr1 = COPY %src(<2 x s32>)
151 %src:_(<2 x s32>) = COPY $vgpr0_vgpr1
152 %bitcast:_(s64) = G_BITCAST %src
153 %trunc:_(s32) = G_TRUNC %bitcast
154 %undef:_(s32) = G_IMPLICIT_DEF
155 %root:_(<2 x s32>) = G_BUILD_VECTOR %trunc, %undef
156 $vgpr0_vgpr1 = COPY %root