1 ; Test vector merge high.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s
5 ; Test a canonical v16i8 merge high.
6 define <16 x i8> @f1(<16 x i8> %val1, <16 x i8> %val2) {
8 ; CHECK: vmrhb %v24, %v24, %v26
10 %ret = shufflevector <16 x i8> %val1, <16 x i8> %val2,
11 <16 x i32> <i32 0, i32 16, i32 1, i32 17,
12 i32 2, i32 18, i32 3, i32 19,
13 i32 4, i32 20, i32 5, i32 21,
14 i32 6, i32 22, i32 7, i32 23>
18 ; Test a reversed v16i8 merge high.
19 define <16 x i8> @f2(<16 x i8> %val1, <16 x i8> %val2) {
21 ; CHECK: vmrhb %v24, %v26, %v24
23 %ret = shufflevector <16 x i8> %val1, <16 x i8> %val2,
24 <16 x i32> <i32 16, i32 0, i32 17, i32 1,
25 i32 18, i32 2, i32 19, i32 3,
26 i32 20, i32 4, i32 21, i32 5,
27 i32 22, i32 6, i32 23, i32 7>
31 ; Test a v16i8 merge high with only the first operand being used.
32 define <16 x i8> @f3(<16 x i8> %val1, <16 x i8> %val2) {
34 ; CHECK: vmrhb %v24, %v24, %v24
36 %ret = shufflevector <16 x i8> %val1, <16 x i8> %val2,
37 <16 x i32> <i32 0, i32 0, i32 1, i32 1,
38 i32 2, i32 2, i32 3, i32 3,
39 i32 4, i32 4, i32 5, i32 5,
40 i32 6, i32 6, i32 7, i32 7>
44 ; Test a v16i8 merge high with only the second operand being used.
45 ; This is converted into @f3 by target-independent code.
46 define <16 x i8> @f4(<16 x i8> %val1, <16 x i8> %val2) {
48 ; CHECK: vmrhb %v24, %v26, %v26
50 %ret = shufflevector <16 x i8> %val1, <16 x i8> %val2,
51 <16 x i32> <i32 16, i32 16, i32 17, i32 17,
52 i32 18, i32 18, i32 19, i32 19,
53 i32 20, i32 20, i32 21, i32 21,
54 i32 22, i32 22, i32 23, i32 23>
58 ; Test a v16i8 merge with both operands being the same. This too is
59 ; converted into @f3 by target-independent code.
60 define <16 x i8> @f5(<16 x i8> %val) {
62 ; CHECK: vmrhb %v24, %v24, %v24
64 %ret = shufflevector <16 x i8> %val, <16 x i8> %val,
65 <16 x i32> <i32 0, i32 16, i32 17, i32 17,
66 i32 18, i32 2, i32 3, i32 3,
67 i32 20, i32 20, i32 5, i32 5,
68 i32 6, i32 22, i32 23, i32 7>
72 ; Test a v16i8 merge in which some of the indices are don't care.
73 define <16 x i8> @f6(<16 x i8> %val1, <16 x i8> %val2) {
75 ; CHECK: vmrhb %v24, %v24, %v26
77 %ret = shufflevector <16 x i8> %val1, <16 x i8> %val2,
78 <16 x i32> <i32 0, i32 undef, i32 1, i32 17,
79 i32 undef, i32 18, i32 undef, i32 undef,
80 i32 undef, i32 20, i32 5, i32 21,
81 i32 undef, i32 22, i32 7, i32 undef>
85 ; Test a v16i8 merge in which one of the operands is undefined and where
86 ; indices for that operand are "don't care". Target-independent code
87 ; converts the indices themselves into "undef"s.
88 define <16 x i8> @f7(<16 x i8> %val) {
90 ; CHECK: vmrhb %v24, %v24, %v24
92 %ret = shufflevector <16 x i8> undef, <16 x i8> %val,
93 <16 x i32> <i32 11, i32 16, i32 17, i32 5,
94 i32 18, i32 10, i32 19, i32 19,
95 i32 20, i32 20, i32 21, i32 3,
96 i32 2, i32 22, i32 9, i32 23>
100 ; Test a canonical v8i16 merge high.
101 define <8 x i16> @f8(<8 x i16> %val1, <8 x i16> %val2) {
103 ; CHECK: vmrhh %v24, %v24, %v26
105 %ret = shufflevector <8 x i16> %val1, <8 x i16> %val2,
106 <8 x i32> <i32 0, i32 8, i32 1, i32 9,
107 i32 2, i32 10, i32 3, i32 11>
111 ; Test a reversed v8i16 merge high.
112 define <8 x i16> @f9(<8 x i16> %val1, <8 x i16> %val2) {
114 ; CHECK: vmrhh %v24, %v26, %v24
116 %ret = shufflevector <8 x i16> %val1, <8 x i16> %val2,
117 <8 x i32> <i32 8, i32 0, i32 9, i32 1,
118 i32 10, i32 2, i32 11, i32 3>
122 ; Test a canonical v4i32 merge high.
123 define <4 x i32> @f10(<4 x i32> %val1, <4 x i32> %val2) {
125 ; CHECK: vmrhf %v24, %v24, %v26
127 %ret = shufflevector <4 x i32> %val1, <4 x i32> %val2,
128 <4 x i32> <i32 0, i32 4, i32 1, i32 5>
132 ; Test a reversed v4i32 merge high.
133 define <4 x i32> @f11(<4 x i32> %val1, <4 x i32> %val2) {
135 ; CHECK: vmrhf %v24, %v26, %v24
137 %ret = shufflevector <4 x i32> %val1, <4 x i32> %val2,
138 <4 x i32> <i32 4, i32 0, i32 5, i32 1>
142 ; Test a canonical v2i64 merge high.
143 define <2 x i64> @f12(<2 x i64> %val1, <2 x i64> %val2) {
145 ; CHECK: vmrhg %v24, %v24, %v26
147 %ret = shufflevector <2 x i64> %val1, <2 x i64> %val2,
148 <2 x i32> <i32 0, i32 2>
152 ; Test a reversed v2i64 merge high.
153 define <2 x i64> @f13(<2 x i64> %val1, <2 x i64> %val2) {
155 ; CHECK: vmrhg %v24, %v26, %v24
157 %ret = shufflevector <2 x i64> %val1, <2 x i64> %val2,
158 <2 x i32> <i32 2, i32 0>
162 ; Test a canonical v4f32 merge high.
163 define <4 x float> @f14(<4 x float> %val1, <4 x float> %val2) {
165 ; CHECK: vmrhf %v24, %v24, %v26
167 %ret = shufflevector <4 x float> %val1, <4 x float> %val2,
168 <4 x i32> <i32 0, i32 4, i32 1, i32 5>
172 ; Test a reversed v4f32 merge high.
173 define <4 x float> @f15(<4 x float> %val1, <4 x float> %val2) {
175 ; CHECK: vmrhf %v24, %v26, %v24
177 %ret = shufflevector <4 x float> %val1, <4 x float> %val2,
178 <4 x i32> <i32 4, i32 0, i32 5, i32 1>
182 ; Test a canonical v2f64 merge high.
183 define <2 x double> @f16(<2 x double> %val1, <2 x double> %val2) {
185 ; CHECK: vmrhg %v24, %v24, %v26
187 %ret = shufflevector <2 x double> %val1, <2 x double> %val2,
188 <2 x i32> <i32 0, i32 2>
189 ret <2 x double> %ret
192 ; Test a reversed v2f64 merge high.
193 define <2 x double> @f17(<2 x double> %val1, <2 x double> %val2) {
195 ; CHECK: vmrhg %v24, %v26, %v24
197 %ret = shufflevector <2 x double> %val1, <2 x double> %val2,
198 <2 x i32> <i32 2, i32 0>
199 ret <2 x double> %ret