1 ; Test vector replicates that use VECTOR GENERATE MASK, v16i8 version.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
5 ; Test a word-granularity replicate with the lowest value that cannot use
7 define <16 x i8> @f1() {
9 ; CHECK: vgmf %v24, 16, 16
11 ret <16 x i8> <i8 0, i8 0, i8 128, i8 0,
12 i8 0, i8 0, i8 128, i8 0,
13 i8 0, i8 0, i8 128, i8 0,
14 i8 0, i8 0, i8 128, i8 0>
17 ; Test a word-granularity replicate that has the lower 17 bits set.
18 define <16 x i8> @f2() {
20 ; CHECK: vgmf %v24, 15, 31
22 ret <16 x i8> <i8 0, i8 1, i8 255, i8 255,
23 i8 0, i8 1, i8 255, i8 255,
24 i8 0, i8 1, i8 255, i8 255,
25 i8 0, i8 1, i8 255, i8 255>
28 ; Test a word-granularity replicate that has the upper 15 bits set.
29 define <16 x i8> @f3() {
31 ; CHECK: vgmf %v24, 0, 14
33 ret <16 x i8> <i8 255, i8 254, i8 0, i8 0,
34 i8 255, i8 254, i8 0, i8 0,
35 i8 255, i8 254, i8 0, i8 0,
36 i8 255, i8 254, i8 0, i8 0>
39 ; Test a word-granularity replicate that has middle bits set.
40 define <16 x i8> @f4() {
42 ; CHECK: vgmf %v24, 12, 17
44 ret <16 x i8> <i8 0, i8 15, i8 192, i8 0,
45 i8 0, i8 15, i8 192, i8 0,
46 i8 0, i8 15, i8 192, i8 0,
47 i8 0, i8 15, i8 192, i8 0>
50 ; Test a word-granularity replicate with a wrap-around mask.
51 define <16 x i8> @f5() {
53 ; CHECK: vgmf %v24, 17, 15
55 ret <16 x i8> <i8 255, i8 255, i8 127, i8 255,
56 i8 255, i8 255, i8 127, i8 255,
57 i8 255, i8 255, i8 127, i8 255,
58 i8 255, i8 255, i8 127, i8 255>
61 ; Test a doubleword-granularity replicate with the lowest value that cannot
63 define <16 x i8> @f6() {
65 ; CHECK: vgmg %v24, 48, 48
67 ret <16 x i8> <i8 0, i8 0, i8 0, i8 0,
68 i8 0, i8 0, i8 128, i8 0,
69 i8 0, i8 0, i8 0, i8 0,
70 i8 0, i8 0, i8 128, i8 0>
73 ; Test a doubleword-granularity replicate that has the lower 22 bits set.
74 define <16 x i8> @f7() {
76 ; CHECK: vgmg %v24, 42, 63
78 ret <16 x i8> <i8 0, i8 0, i8 0, i8 0,
79 i8 0, i8 63, i8 255, i8 255,
80 i8 0, i8 0, i8 0, i8 0,
81 i8 0, i8 63, i8 255, i8 255>
84 ; Test a doubleword-granularity replicate that has the upper 45 bits set.
85 define <16 x i8> @f8() {
87 ; CHECK: vgmg %v24, 0, 44
89 ret <16 x i8> <i8 255, i8 255, i8 255, i8 255,
90 i8 255, i8 248, i8 0, i8 0,
91 i8 255, i8 255, i8 255, i8 255,
92 i8 255, i8 248, i8 0, i8 0>
95 ; Test a doubleword-granularity replicate that has middle bits set.
96 define <16 x i8> @f9() {
98 ; CHECK: vgmg %v24, 31, 42
100 ret <16 x i8> <i8 0, i8 0, i8 0, i8 1,
101 i8 255, i8 224, i8 0, i8 0,
102 i8 0, i8 0, i8 0, i8 1,
103 i8 255, i8 224, i8 0, i8 0>
106 ; Test a doubleword-granularity replicate with a wrap-around mask.
107 define <16 x i8> @f10() {
109 ; CHECK: vgmg %v24, 18, 0
111 ret <16 x i8> <i8 128, i8 0, i8 63, i8 255,
112 i8 255, i8 255, i8 255, i8 255,
113 i8 128, i8 0, i8 63, i8 255,
114 i8 255, i8 255, i8 255, i8 255>
117 ; Retest f1 with arbitrary undefs instead of 0s.
118 define <16 x i8> @f11() {
120 ; CHECK: vgmf %v24, 16, 16
122 ret <16 x i8> <i8 0, i8 undef, i8 128, i8 0,
123 i8 0, i8 0, i8 128, i8 undef,
124 i8 undef, i8 0, i8 128, i8 0,
125 i8 undef, i8 undef, i8 128, i8 0>
128 ; Try a case where we want consistent undefs to be treated as 0.
129 define <16 x i8> @f12() {
131 ; CHECK: vgmf %v24, 15, 23
133 ret <16 x i8> <i8 undef, i8 1, i8 255, i8 0,
134 i8 undef, i8 1, i8 255, i8 0,
135 i8 undef, i8 1, i8 255, i8 0,
136 i8 undef, i8 1, i8 255, i8 0>
139 ; ...and again with the lower bits of the replicated constant.
140 define <16 x i8> @f13() {
142 ; CHECK: vgmf %v24, 15, 22
144 ret <16 x i8> <i8 0, i8 1, i8 254, i8 undef,
145 i8 0, i8 1, i8 254, i8 undef,
146 i8 0, i8 1, i8 254, i8 undef,
147 i8 0, i8 1, i8 254, i8 undef>
150 ; Try a case where we want consistent undefs to be treated as -1.
151 define <16 x i8> @f14() {
153 ; CHECK: vgmf %v24, 28, 8
155 ret <16 x i8> <i8 undef, i8 128, i8 0, i8 15,
156 i8 undef, i8 128, i8 0, i8 15,
157 i8 undef, i8 128, i8 0, i8 15,
158 i8 undef, i8 128, i8 0, i8 15>
161 ; ...and again with the lower bits of the replicated constant.
162 define <16 x i8> @f15() {
164 ; CHECK: vgmf %v24, 18, 3
166 ret <16 x i8> <i8 240, i8 0, i8 63, i8 undef,
167 i8 240, i8 0, i8 63, i8 undef,
168 i8 240, i8 0, i8 63, i8 undef,
169 i8 240, i8 0, i8 63, i8 undef>
172 ; Repeat f9 with arbitrary undefs.
173 define <16 x i8> @f16() {
175 ; CHECK: vgmg %v24, 31, 42
177 ret <16 x i8> <i8 undef, i8 0, i8 undef, i8 1,
178 i8 255, i8 undef, i8 0, i8 0,
179 i8 0, i8 0, i8 0, i8 1,
180 i8 undef, i8 224, i8 undef, i8 undef>
183 ; Try a case where we want some consistent undefs to be treated as 0
184 ; and some to be treated as 255.
185 define <16 x i8> @f17() {
187 ; CHECK: vgmg %v24, 23, 35
189 ret <16 x i8> <i8 0, i8 undef, i8 1, i8 undef,
190 i8 240, i8 undef, i8 0, i8 0,
191 i8 0, i8 undef, i8 1, i8 undef,
192 i8 240, i8 undef, i8 0, i8 0>