1; Test vector truncating stores.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5; Test a v16i8->v16i1 truncation.
6define void @f1(<16 x i8> %val, <16 x i1> *%ptr) {
7; No expected output, but must compile.
8  %trunc = trunc <16 x i8> %val to <16 x i1>
9  store <16 x i1> %trunc, <16 x i1> *%ptr
10  ret void
11}
12
13; Test a v8i16->v8i1 truncation.
14define void @f2(<8 x i16> %val, <8 x i1> *%ptr) {
15; No expected output, but must compile.
16  %trunc = trunc <8 x i16> %val to <8 x i1>
17  store <8 x i1> %trunc, <8 x i1> *%ptr
18  ret void
19}
20
21; Test a v8i16->v8i8 truncation.
22define void @f3(<8 x i16> %val, <8 x i8> *%ptr) {
23; CHECK-LABEL: f3:
24; CHECK: vpkh [[REG1:%v[0-9]+]], %v24, %v24
25; CHECK: vsteg [[REG1]], 0(%r2)
26; CHECK: br %r14
27  %trunc = trunc <8 x i16> %val to <8 x i8>
28  store <8 x i8> %trunc, <8 x i8> *%ptr
29  ret void
30}
31
32; Test a v4i32->v4i1 truncation.
33define void @f4(<4 x i32> %val, <4 x i1> *%ptr) {
34; No expected output, but must compile.
35  %trunc = trunc <4 x i32> %val to <4 x i1>
36  store <4 x i1> %trunc, <4 x i1> *%ptr
37  ret void
38}
39
40; Test a v4i32->v4i8 truncation.  At the moment we use a VPERM rather than
41; a chain of packs.
42define void @f5(<4 x i32> %val, <4 x i8> *%ptr) {
43; CHECK-LABEL: f5:
44; CHECK: vperm [[REG:%v[0-9]+]],
45; CHECK: vstef [[REG]], 0(%r2)
46; CHECK: br %r14
47  %trunc = trunc <4 x i32> %val to <4 x i8>
48  store <4 x i8> %trunc, <4 x i8> *%ptr
49  ret void
50}
51
52; Test a v4i32->v4i16 truncation.
53define void @f6(<4 x i32> %val, <4 x i16> *%ptr) {
54; CHECK-LABEL: f6:
55; CHECK: vpkf [[REG1:%v[0-9]+]], %v24, %v24
56; CHECK: vsteg [[REG1]], 0(%r2)
57; CHECK: br %r14
58  %trunc = trunc <4 x i32> %val to <4 x i16>
59  store <4 x i16> %trunc, <4 x i16> *%ptr
60  ret void
61}
62
63; Test a v2i64->v2i1 truncation.
64define void @f7(<2 x i64> %val, <2 x i1> *%ptr) {
65; No expected output, but must compile.
66  %trunc = trunc <2 x i64> %val to <2 x i1>
67  store <2 x i1> %trunc, <2 x i1> *%ptr
68  ret void
69}
70
71; Test a v2i64->v2i8 truncation.  At the moment we use a VPERM rather than
72; a chain of packs.
73define void @f8(<2 x i64> %val, <2 x i8> *%ptr) {
74; CHECK-LABEL: f8:
75; CHECK: vperm [[REG:%v[0-9]+]],
76; CHECK: vsteh [[REG]], 0(%r2)
77; CHECK: br %r14
78  %trunc = trunc <2 x i64> %val to <2 x i8>
79  store <2 x i8> %trunc, <2 x i8> *%ptr
80  ret void
81}
82
83; Test a v2i64->v2i16 truncation.  At the moment we use a VPERM rather than
84; a chain of packs.
85define void @f9(<2 x i64> %val, <2 x i16> *%ptr) {
86; CHECK-LABEL: f9:
87; CHECK: vperm [[REG:%v[0-9]+]],
88; CHECK: vstef [[REG]], 0(%r2)
89; CHECK: br %r14
90  %trunc = trunc <2 x i64> %val to <2 x i16>
91  store <2 x i16> %trunc, <2 x i16> *%ptr
92  ret void
93}
94
95; Test a v2i64->v2i32 truncation.
96define void @f10(<2 x i64> %val, <2 x i32> *%ptr) {
97; CHECK-LABEL: f10:
98; CHECK: vpkg [[REG1:%v[0-9]+]], %v24, %v24
99; CHECK: vsteg [[REG1]], 0(%r2)
100; CHECK: br %r14
101  %trunc = trunc <2 x i64> %val to <2 x i32>
102  store <2 x i32> %trunc, <2 x i32> *%ptr
103  ret void
104}
105