1 ; Test vector truncating stores.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
5 ; Test a v16i8->v16i1 truncation.
6 define 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
13 ; Test a v8i16->v8i1 truncation.
14 define 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
21 ; Test a v8i16->v8i8 truncation.
22 define void @f3(<8 x i16> %val, <8 x i8> *%ptr) {
24 ; CHECK: vpkh [[REG1:%v[0-9]+]], %v24, %v24
25 ; CHECK: vsteg [[REG1]], 0(%r2)
27 %trunc = trunc <8 x i16> %val to <8 x i8>
28 store <8 x i8> %trunc, <8 x i8> *%ptr
32 ; Test a v4i32->v4i1 truncation.
33 define 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
40 ; Test a v4i32->v4i8 truncation. At the moment we use a VPERM rather than
42 define void @f5(<4 x i32> %val, <4 x i8> *%ptr) {
44 ; CHECK: vperm [[REG:%v[0-9]+]],
45 ; CHECK: vstef [[REG]], 0(%r2)
47 %trunc = trunc <4 x i32> %val to <4 x i8>
48 store <4 x i8> %trunc, <4 x i8> *%ptr
52 ; Test a v4i32->v4i16 truncation.
53 define void @f6(<4 x i32> %val, <4 x i16> *%ptr) {
55 ; CHECK: vpkf [[REG1:%v[0-9]+]], %v24, %v24
56 ; CHECK: vsteg [[REG1]], 0(%r2)
58 %trunc = trunc <4 x i32> %val to <4 x i16>
59 store <4 x i16> %trunc, <4 x i16> *%ptr
63 ; Test a v2i64->v2i1 truncation.
64 define void @f7(<2 x i64> %val, <2 x i1> *%ptr) {
67 ; CHECK-NEXT: vlgvg %r0, %v24, 0
68 ; CHECK-DAG: sll %r0, 1
69 ; CHECK-DAG: vlgvg %r1, %v24, 1
70 ; CHECK-NEXT: rosbg %r0, %r1, 63, 63, 0
71 ; CHECK-NEXT: nilf %r0, 3
72 ; CHECK-NEXT: stc %r0, 0(%r2)
74 %trunc = trunc <2 x i64> %val to <2 x i1>
75 store <2 x i1> %trunc, <2 x i1> *%ptr
79 ; Test a v2i64->v2i8 truncation. At the moment we use a VPERM rather than
81 define void @f8(<2 x i64> %val, <2 x i8> *%ptr) {
83 ; CHECK: vperm [[REG:%v[0-9]+]],
84 ; CHECK: vsteh [[REG]], 0(%r2)
86 %trunc = trunc <2 x i64> %val to <2 x i8>
87 store <2 x i8> %trunc, <2 x i8> *%ptr
91 ; Test a v2i64->v2i16 truncation. At the moment we use a VPERM rather than
93 define void @f9(<2 x i64> %val, <2 x i16> *%ptr) {
95 ; CHECK: vperm [[REG:%v[0-9]+]],
96 ; CHECK: vstef [[REG]], 0(%r2)
98 %trunc = trunc <2 x i64> %val to <2 x i16>
99 store <2 x i16> %trunc, <2 x i16> *%ptr
103 ; Test a v2i64->v2i32 truncation.
104 define void @f10(<2 x i64> %val, <2 x i32> *%ptr) {
106 ; CHECK: vpkg [[REG1:%v[0-9]+]], %v24, %v24
107 ; CHECK: vsteg [[REG1]], 0(%r2)
109 %trunc = trunc <2 x i64> %val to <2 x i32>
110 store <2 x i32> %trunc, <2 x i32> *%ptr