1 ; Test that DAGCombiner gets helped by ComputeNumSignBitsForTargetNode() with
4 ; RUN: llc -mtriple=s390x-linux-gnu -mcpu=z13 < %s | FileCheck %s
6 declare {<16 x i8>, i32} @llvm.s390.vpkshs(<8 x i16>, <8 x i16>)
7 declare {<8 x i16>, i32} @llvm.s390.vpksfs(<4 x i32>, <4 x i32>)
8 declare {<4 x i32>, i32} @llvm.s390.vpksgs(<2 x i64>, <2 x i64>)
10 ; PACKS_CC: i64 -> i32
11 define <4 x i32> @f0() {
13 ; CHECK-LABEL: # %bb.0:
14 ; CHECK: vpksgs %v24, %v0, %v0
16 %call = call {<4 x i32>, i32} @llvm.s390.vpksgs(<2 x i64> <i64 0, i64 1>, <2 x i64> <i64 0, i64 1>)
17 %extr = extractvalue {<4 x i32>, i32} %call, 0
18 %trunc = trunc <4 x i32> %extr to <4 x i16>
19 %ret = sext <4 x i16> %trunc to <4 x i32>
23 ; PACKS_CC: i32 -> i16
24 define <8 x i16> @f1() {
26 ; CHECK-LABEL: # %bb.0:
27 ; CHECK: vpksfs %v24, %v0, %v0
29 %call = call {<8 x i16>, i32} @llvm.s390.vpksfs(<4 x i32> <i32 0, i32 1, i32 1, i32 0>,
30 <4 x i32> <i32 0, i32 1, i32 1, i32 0>)
31 %extr = extractvalue {<8 x i16>, i32} %call, 0
32 %trunc = trunc <8 x i16> %extr to <8 x i8>
33 %ret = sext <8 x i8> %trunc to <8 x i16>
38 define <16 x i8> @f2() {
40 ; CHECK-LABEL: # %bb.0:
41 ; CHECK: vpkshs %v24, %v0, %v0
43 %call = call {<16 x i8>, i32} @llvm.s390.vpkshs(
44 <8 x i16> <i16 0, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 1>,
45 <8 x i16> <i16 0, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 1>)
46 %extr = extractvalue {<16 x i8>, i32} %call, 0
47 %trunc = trunc <16 x i8> %extr to <16 x i4>
48 %ret = sext <16 x i4> %trunc to <16 x i8>
52 declare {<16 x i8>, i32} @llvm.s390.vpklshs(<8 x i16>, <8 x i16>)
53 declare {<8 x i16>, i32} @llvm.s390.vpklsfs(<4 x i32>, <4 x i32>)
54 declare {<4 x i32>, i32} @llvm.s390.vpklsgs(<2 x i64>, <2 x i64>)
56 ; PACKLS_CC: i64 -> i32
57 define <4 x i32> @f3() {
59 ; CHECK-LABEL: # %bb.0:
60 ; CHECK: vpklsgs %v24, %v1, %v0
62 %call = call {<4 x i32>, i32} @llvm.s390.vpklsgs(<2 x i64> <i64 0, i64 1>, <2 x i64> <i64 1, i64 0>)
63 %extr = extractvalue {<4 x i32>, i32} %call, 0
64 %trunc = trunc <4 x i32> %extr to <4 x i16>
65 %ret = sext <4 x i16> %trunc to <4 x i32>
69 ; PACKLS_CC: i32 -> i16
70 define <8 x i16> @f4() {
72 ; CHECK-LABEL: # %bb.0:
73 ; CHECK: vpklsfs %v24, %v0, %v0
75 %call = call {<8 x i16>, i32} @llvm.s390.vpklsfs(<4 x i32> <i32 0, i32 1, i32 1, i32 0>,
76 <4 x i32> <i32 0, i32 1, i32 1, i32 0>)
77 %extr = extractvalue {<8 x i16>, i32} %call, 0
78 %trunc = trunc <8 x i16> %extr to <8 x i8>
79 %ret = sext <8 x i8> %trunc to <8 x i16>
83 ; PACKLS_CC: i16 -> i8
84 define <16 x i8> @f5() {
86 ; CHECK-LABEL: # %bb.0:
87 ; CHECK: vpklshs %v24, %v0, %v0
89 %call = call {<16 x i8>, i32} @llvm.s390.vpklshs(
90 <8 x i16> <i16 0, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 1>,
91 <8 x i16> <i16 0, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 1>)
92 %extr = extractvalue {<16 x i8>, i32} %call, 0
93 %trunc = trunc <16 x i8> %extr to <16 x i4>
94 %ret = sext <16 x i4> %trunc to <16 x i8>
98 declare <16 x i8> @llvm.s390.vpksh(<8 x i16>, <8 x i16>)
99 declare <8 x i16> @llvm.s390.vpksf(<4 x i32>, <4 x i32>)
100 declare <4 x i32> @llvm.s390.vpksg(<2 x i64>, <2 x i64>)
103 define <4 x i32> @f6() {
105 ; CHECK-LABEL: # %bb.0:
106 ; CHECK: vpksg %v24, %v1, %v0
107 ; CHECK-NEXT: br %r14
108 %call = call <4 x i32> @llvm.s390.vpksg(<2 x i64> <i64 0, i64 1>, <2 x i64> <i64 1, i64 0>)
109 %trunc = trunc <4 x i32> %call to <4 x i16>
110 %ret = sext <4 x i16> %trunc to <4 x i32>
115 define <8 x i16> @f7() {
117 ; CHECK-LABEL: # %bb.0:
118 ; CHECK: vpksf %v24, %v0, %v0
119 ; CHECK-NEXT: br %r14
120 %call = call <8 x i16> @llvm.s390.vpksf(<4 x i32> <i32 0, i32 1, i32 1, i32 0>,
121 <4 x i32> <i32 0, i32 1, i32 1, i32 0>)
122 %trunc = trunc <8 x i16> %call to <8 x i8>
123 %ret = sext <8 x i8> %trunc to <8 x i16>
128 define <16 x i8> @f8() {
130 ; CHECK-LABEL: # %bb.0:
131 ; CHECK: vpksh %v24, %v0, %v0
132 ; CHECK-NEXT: br %r14
133 %call = call <16 x i8> @llvm.s390.vpksh(
134 <8 x i16> <i16 0, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 1>,
135 <8 x i16> <i16 0, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 1>)
136 %trunc = trunc <16 x i8> %call to <16 x i4>
137 %ret = sext <16 x i4> %trunc to <16 x i8>
141 declare <16 x i8> @llvm.s390.vpklsh(<8 x i16>, <8 x i16>)
142 declare <8 x i16> @llvm.s390.vpklsf(<4 x i32>, <4 x i32>)
143 declare <4 x i32> @llvm.s390.vpklsg(<2 x i64>, <2 x i64>)
146 define <4 x i32> @f9() {
148 ; CHECK-LABEL: # %bb.0:
149 ; CHECK: vpklsg %v24, %v1, %v0
150 ; CHECK-NEXT: br %r14
151 %call = call <4 x i32> @llvm.s390.vpklsg(<2 x i64> <i64 0, i64 1>, <2 x i64> <i64 1, i64 0>)
152 %trunc = trunc <4 x i32> %call to <4 x i16>
153 %ret = sext <4 x i16> %trunc to <4 x i32>
158 define <8 x i16> @f10() {
160 ; CHECK-LABEL: # %bb.0:
161 ; CHECK: vpklsf %v24, %v0, %v0
162 ; CHECK-NEXT: br %r14
163 %call = call <8 x i16> @llvm.s390.vpklsf(<4 x i32> <i32 0, i32 1, i32 1, i32 0>,
164 <4 x i32> <i32 0, i32 1, i32 1, i32 0>)
165 %trunc = trunc <8 x i16> %call to <8 x i8>
166 %ret = sext <8 x i8> %trunc to <8 x i16>
171 define <16 x i8> @f11() {
173 ; CHECK-LABEL: # %bb.0:
174 ; CHECK: vpklsh %v24, %v0, %v0
175 ; CHECK-NEXT: br %r14
176 %call = call <16 x i8> @llvm.s390.vpklsh(
177 <8 x i16> <i16 0, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 1>,
178 <8 x i16> <i16 0, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 1>)
179 %trunc = trunc <16 x i8> %call to <16 x i4>
180 %ret = sext <16 x i4> %trunc to <16 x i8>
184 declare <2 x i64> @llvm.s390.vpdi(<2 x i64>, <2 x i64>, i32)
187 define <2 x i64> @f12() {
189 ; CHECK-LABEL: # %bb.0:
190 ; CHECK: vpdi %v24, %v1, %v0, 0
191 ; CHECK-NEXT: br %r14
192 %perm = call <2 x i64> @llvm.s390.vpdi(<2 x i64> <i64 0, i64 1>,
193 <2 x i64> <i64 1, i64 0>, i32 0)
194 %trunc = trunc <2 x i64> %perm to <2 x i32>
195 %ret = sext <2 x i32> %trunc to <2 x i64>
199 declare <16 x i8> @llvm.s390.vsldb(<16 x i8>, <16 x i8>, i32)
202 define <16 x i8> @f13() {
204 ; CHECK-LABEL: # %bb.0:
205 ; CHECK: vsldb %v24, %v0, %v0, 1
206 ; CHECK-NEXT: br %r14
207 %shfd = call <16 x i8> @llvm.s390.vsldb(<16 x i8>
208 <i8 0, i8 0, i8 1, i8 1, i8 0, i8 1, i8 1, i8 1,
209 i8 0, i8 0, i8 1, i8 1, i8 0, i8 1, i8 1, i8 1>, <16 x i8>
210 <i8 0, i8 0, i8 1, i8 1, i8 0, i8 1, i8 1, i8 1,
211 i8 0, i8 0, i8 1, i8 1, i8 0, i8 1, i8 1, i8 1>,
213 %trunc = trunc <16 x i8> %shfd to <16 x i4>
214 %ret = sext <16 x i4> %trunc to <16 x i8>
218 declare <16 x i8> @llvm.s390.vperm(<16 x i8>, <16 x i8>, <16 x i8>)
221 define <16 x i8> @f14() {
223 ; CHECK-LABEL: # %bb.0:
224 ; CHECK: vperm %v24, %v0, %v0, %v0
225 ; CHECK-NEXT: br %r14
226 %perm = call <16 x i8> @llvm.s390.vperm(
227 <16 x i8> <i8 0, i8 0, i8 1, i8 1, i8 0, i8 1, i8 1, i8 1,
228 i8 0, i8 0, i8 1, i8 1, i8 0, i8 1, i8 1, i8 1>,
229 <16 x i8> <i8 0, i8 0, i8 1, i8 1, i8 0, i8 1, i8 1, i8 1,
230 i8 0, i8 0, i8 1, i8 1, i8 0, i8 1, i8 1, i8 1>,
231 <16 x i8> <i8 0, i8 0, i8 1, i8 1, i8 0, i8 1, i8 1, i8 1,
232 i8 0, i8 0, i8 1, i8 1, i8 0, i8 1, i8 1, i8 1>)
233 %trunc = trunc <16 x i8> %perm to <16 x i4>
234 %ret = sext <16 x i4> %trunc to <16 x i8>