xref: /llvm-project/llvm/test/CodeGen/SystemZ/vec-const-01.ll (revision cd2a1b5341a3c42b1a56f8f301bd0de0343b5e8e)
1ce4c1095SUlrich Weigand; Test vector byte masks, v16i8 version.
2ce4c1095SUlrich Weigand;
3ce4c1095SUlrich Weigand; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4ce4c1095SUlrich Weigand
5ce4c1095SUlrich Weigand; Test an all-zeros vector.
6ce4c1095SUlrich Weiganddefine <16 x i8> @f1() {
7ce4c1095SUlrich Weigand; CHECK-LABEL: f1:
8ce4c1095SUlrich Weigand; CHECK: vgbm %v24, 0
9ce4c1095SUlrich Weigand; CHECK: br %r14
10ce4c1095SUlrich Weigand  ret <16 x i8> zeroinitializer
11ce4c1095SUlrich Weigand}
12ce4c1095SUlrich Weigand
13ce4c1095SUlrich Weigand; Test an all-ones vector.
14ce4c1095SUlrich Weiganddefine <16 x i8> @f2() {
15ce4c1095SUlrich Weigand; CHECK-LABEL: f2:
16ce4c1095SUlrich Weigand; CHECK: vgbm %v24, 65535
17ce4c1095SUlrich Weigand; CHECK: br %r14
18ce4c1095SUlrich Weigand  ret <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1,
19ce4c1095SUlrich Weigand                 i8 -1, i8 -1, i8 -1, i8 -1,
20ce4c1095SUlrich Weigand                 i8 -1, i8 -1, i8 -1, i8 -1,
21ce4c1095SUlrich Weigand                 i8 -1, i8 -1, i8 -1, i8 -1>
22ce4c1095SUlrich Weigand}
23ce4c1095SUlrich Weigand
24ce4c1095SUlrich Weigand; Test a mixed vector (mask 0x8c75).
25ce4c1095SUlrich Weiganddefine <16 x i8> @f3() {
26ce4c1095SUlrich Weigand; CHECK-LABEL: f3:
27ce4c1095SUlrich Weigand; CHECK: vgbm %v24, 35957
28ce4c1095SUlrich Weigand; CHECK: br %r14
29ce4c1095SUlrich Weigand  ret <16 x i8> <i8 -1, i8 0, i8 0, i8 0,
30ce4c1095SUlrich Weigand                 i8 -1, i8 -1, i8 0, i8 0,
31ce4c1095SUlrich Weigand                 i8 0, i8 -1, i8 -1, i8 -1,
32ce4c1095SUlrich Weigand                 i8 0, i8 -1, i8 0, i8 -1>
33ce4c1095SUlrich Weigand}
34ce4c1095SUlrich Weigand
35ce4c1095SUlrich Weigand; Test that undefs are treated as zero.
36ce4c1095SUlrich Weiganddefine <16 x i8> @f4() {
37ce4c1095SUlrich Weigand; CHECK-LABEL: f4:
38ce4c1095SUlrich Weigand; CHECK: vgbm %v24, 35957
39ce4c1095SUlrich Weigand; CHECK: br %r14
40ce4c1095SUlrich Weigand  ret <16 x i8> <i8 -1, i8 undef, i8 undef, i8 undef,
41ce4c1095SUlrich Weigand                 i8 -1, i8 -1, i8 undef, i8 undef,
42ce4c1095SUlrich Weigand                 i8 undef, i8 -1, i8 -1, i8 -1,
43ce4c1095SUlrich Weigand                 i8 undef, i8 -1, i8 undef, i8 -1>
44ce4c1095SUlrich Weigand}
45ce4c1095SUlrich Weigand
46ce4c1095SUlrich Weigand; Test that we don't use VGBM if one of the bytes is not 0 or 0xff.
47ce4c1095SUlrich Weiganddefine <16 x i8> @f5() {
48ce4c1095SUlrich Weigand; CHECK-LABEL: f5:
49ce4c1095SUlrich Weigand; CHECK-NOT: vgbm
50ce4c1095SUlrich Weigand; CHECK: br %r14
51ce4c1095SUlrich Weigand  ret <16 x i8> <i8 -1, i8 0, i8 0, i8 0,
52ce4c1095SUlrich Weigand                 i8 -1, i8 -1, i8 0, i8 1,
53ce4c1095SUlrich Weigand                 i8 0, i8 -1, i8 -1, i8 -1,
54ce4c1095SUlrich Weigand                 i8 0, i8 -1, i8 0, i8 -1>
55ce4c1095SUlrich Weigand}
56*cd2a1b53SUlrich Weigand
57*cd2a1b53SUlrich Weigand; Test an all-zeros v2i8 that gets promoted to v16i8.
58*cd2a1b53SUlrich Weiganddefine <2 x i8> @f6() {
59*cd2a1b53SUlrich Weigand; CHECK-LABEL: f6:
60*cd2a1b53SUlrich Weigand; CHECK: vgbm %v24, 0
61*cd2a1b53SUlrich Weigand; CHECK: br %r14
62*cd2a1b53SUlrich Weigand  ret <2 x i8> zeroinitializer
63*cd2a1b53SUlrich Weigand}
64*cd2a1b53SUlrich Weigand
65*cd2a1b53SUlrich Weigand; Test a mixed v2i8 that gets promoted to v16i8 (mask 0x8000).
66*cd2a1b53SUlrich Weiganddefine <2 x i8> @f7() {
67*cd2a1b53SUlrich Weigand; CHECK-LABEL: f7:
68*cd2a1b53SUlrich Weigand; CHECK: vgbm %v24, 32768
69*cd2a1b53SUlrich Weigand; CHECK: br %r14
70*cd2a1b53SUlrich Weigand  ret <2 x i8> <i8 255, i8 0>
71*cd2a1b53SUlrich Weigand}
72*cd2a1b53SUlrich Weigand
73*cd2a1b53SUlrich Weigand; Test an all-zeros v4i8 that gets promoted to v16i8.
74*cd2a1b53SUlrich Weiganddefine <4 x i8> @f8() {
75*cd2a1b53SUlrich Weigand; CHECK-LABEL: f8:
76*cd2a1b53SUlrich Weigand; CHECK: vgbm %v24, 0
77*cd2a1b53SUlrich Weigand; CHECK: br %r14
78*cd2a1b53SUlrich Weigand  ret <4 x i8> zeroinitializer
79*cd2a1b53SUlrich Weigand}
80*cd2a1b53SUlrich Weigand
81*cd2a1b53SUlrich Weigand; Test a mixed v4i8 that gets promoted to v16i8 (mask 0x9000).
82*cd2a1b53SUlrich Weiganddefine <4 x i8> @f9() {
83*cd2a1b53SUlrich Weigand; CHECK-LABEL: f9:
84*cd2a1b53SUlrich Weigand; CHECK: vgbm %v24, 36864
85*cd2a1b53SUlrich Weigand; CHECK: br %r14
86*cd2a1b53SUlrich Weigand  ret <4 x i8> <i8 255, i8 0, i8 0, i8 255>
87*cd2a1b53SUlrich Weigand}
88*cd2a1b53SUlrich Weigand
89*cd2a1b53SUlrich Weigand; Test an all-zeros v8i8 that gets promoted to v16i8.
90*cd2a1b53SUlrich Weiganddefine <8 x i8> @f10() {
91*cd2a1b53SUlrich Weigand; CHECK-LABEL: f10:
92*cd2a1b53SUlrich Weigand; CHECK: vgbm %v24, 0
93*cd2a1b53SUlrich Weigand; CHECK: br %r14
94*cd2a1b53SUlrich Weigand  ret <8 x i8> zeroinitializer
95*cd2a1b53SUlrich Weigand}
96*cd2a1b53SUlrich Weigand
97*cd2a1b53SUlrich Weigand; Test a mixed v8i8 that gets promoted to v16i8 (mask 0xE500).
98*cd2a1b53SUlrich Weiganddefine <8 x i8> @f11() {
99*cd2a1b53SUlrich Weigand; CHECK-LABEL: f11:
100*cd2a1b53SUlrich Weigand; CHECK: vgbm %v24, 58624
101*cd2a1b53SUlrich Weigand; CHECK: br %r14
102*cd2a1b53SUlrich Weigand  ret <8 x i8> <i8 255, i8 255, i8 255, i8 0, i8 0, i8 255, i8 0, i8 255>
103*cd2a1b53SUlrich Weigand}
104