• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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; CHECK-LABEL: f7:
66; CHECK:       # %bb.0:
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)
73; CHECK-NEXT:    br %r14
74  %trunc = trunc <2 x i64> %val to <2 x i1>
75  store <2 x i1> %trunc, <2 x i1> *%ptr
76  ret void
77}
78
79; Test a v2i64->v2i8 truncation.  At the moment we use a VPERM rather than
80; a chain of packs.
81define void @f8(<2 x i64> %val, <2 x i8> *%ptr) {
82; CHECK-LABEL: f8:
83; CHECK: vperm [[REG:%v[0-9]+]],
84; CHECK: vsteh [[REG]], 0(%r2)
85; CHECK: br %r14
86  %trunc = trunc <2 x i64> %val to <2 x i8>
87  store <2 x i8> %trunc, <2 x i8> *%ptr
88  ret void
89}
90
91; Test a v2i64->v2i16 truncation.  At the moment we use a VPERM rather than
92; a chain of packs.
93define void @f9(<2 x i64> %val, <2 x i16> *%ptr) {
94; CHECK-LABEL: f9:
95; CHECK: vperm [[REG:%v[0-9]+]],
96; CHECK: vstef [[REG]], 0(%r2)
97; CHECK: br %r14
98  %trunc = trunc <2 x i64> %val to <2 x i16>
99  store <2 x i16> %trunc, <2 x i16> *%ptr
100  ret void
101}
102
103; Test a v2i64->v2i32 truncation.
104define void @f10(<2 x i64> %val, <2 x i32> *%ptr) {
105; CHECK-LABEL: f10:
106; CHECK: vpkg [[REG1:%v[0-9]+]], %v24, %v24
107; CHECK: vsteg [[REG1]], 0(%r2)
108; CHECK: br %r14
109  %trunc = trunc <2 x i64> %val to <2 x i32>
110  store <2 x i32> %trunc, <2 x i32> *%ptr
111  ret void
112}
113