1; Test vector byte masks, v8i16 version.
2;
3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
4
5; Test an all-zeros vector.
6define <8 x i16> @f1() {
7; CHECK-LABEL: f1:
8; CHECK: vgbm %v24, 0
9; CHECK: br %r14
10  ret <8 x i16> zeroinitializer
11}
12
13; Test an all-ones vector.
14define <8 x i16> @f2() {
15; CHECK-LABEL: f2:
16; CHECK: vgbm %v24, 65535
17; CHECK: br %r14
18  ret <8 x i16> <i16 -1, i16 -1, i16 -1, i16 -1,
19                 i16 -1, i16 -1, i16 -1, i16 -1>
20}
21
22; Test a mixed vector (mask 0x8c76).
23define <8 x i16> @f3() {
24; CHECK-LABEL: f3:
25; CHECK: vgbm %v24, 35958
26; CHECK: br %r14
27  ret <8 x i16> <i16 65280, i16 0, i16 65535, i16 0,
28                 i16 255, i16 65535, i16 255, i16 65280>
29}
30
31; Test that undefs are treated as zero.
32define <8 x i16> @f4() {
33; CHECK-LABEL: f4:
34; CHECK: vgbm %v24, 35958
35; CHECK: br %r14
36  ret <8 x i16> <i16 65280, i16 undef, i16 65535, i16 undef,
37                 i16 255, i16 65535, i16 255, i16 65280>
38}
39
40; Test that we don't use VGBM if one of the bytes is not 0 or 0xff.
41define <8 x i16> @f5() {
42; CHECK-LABEL: f5:
43; CHECK-NOT: vgbm
44; CHECK: br %r14
45  ret <8 x i16> <i16 65280, i16 0, i16 65535, i16 0,
46                 i16 255, i16 65535, i16 256, i16 65280>
47}
48
49; Test an all-zeros v2i16 that gets promoted to v8i16.
50define <2 x i16> @f6() {
51; CHECK-LABEL: f6:
52; CHECK: vgbm %v24, 0
53; CHECK: br %r14
54  ret <2 x i16> zeroinitializer
55}
56
57; Test a mixed v2i16 that gets promoted to v8i16 (mask 0xc000).
58define <2 x i16> @f7() {
59; CHECK-LABEL: f7:
60; CHECK: vgbm %v24, 49152
61; CHECK: br %r14
62  ret <2 x i16> <i16 65535, i16 0>
63}
64
65; Test an all-zeros v4i16 that gets promoted to v8i16.
66define <4 x i16> @f8() {
67; CHECK-LABEL: f8:
68; CHECK: vgbm %v24, 0
69; CHECK: br %r14
70  ret <4 x i16> zeroinitializer
71}
72
73; Test a mixed v4i16 that gets promoted to v8i16 (mask 0x7200).
74define <4 x i16> @f9() {
75; CHECK-LABEL: f9:
76; CHECK: vgbm %v24, 29184
77; CHECK: br %r14
78  ret <4 x i16> <i16 255, i16 65535, i16 0, i16 65280>
79}
80