1 ; Test loads of byte-swapped vector elements.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z15 | FileCheck %s
6 define <16 x i8> @f1(ptr %ptr) {
8 ; CHECK: vlbrq %v24, 0(%r2)
10 %load = load <16 x i8>, ptr %ptr
11 %ret = shufflevector <16 x i8> %load, <16 x i8> undef,
12 <16 x i32> <i32 15, i32 14, i32 13, i32 12,
13 i32 11, i32 10, i32 9, i32 8,
14 i32 7, i32 6, i32 5, i32 4,
15 i32 3, i32 2, i32 1, i32 0>
20 define <8 x i16> @f2(ptr %ptr) {
22 ; CHECK: vlerh %v24, 0(%r2)
24 %load = load <8 x i16>, ptr %ptr
25 %ret = shufflevector <8 x i16> %load, <8 x i16> undef,
26 <8 x i32> <i32 7, i32 6, i32 5, i32 4,
27 i32 3, i32 2, i32 1, i32 0>
32 define <4 x i32> @f3(ptr %ptr) {
34 ; CHECK: vlerf %v24, 0(%r2)
36 %load = load <4 x i32>, ptr %ptr
37 %ret = shufflevector <4 x i32> %load, <4 x i32> undef,
38 <4 x i32> <i32 3, i32 2, i32 1, i32 0>
43 define <2 x i64> @f4(ptr %ptr) {
45 ; CHECK: vlerg %v24, 0(%r2)
47 %load = load <2 x i64>, ptr %ptr
48 %ret = shufflevector <2 x i64> %load, <2 x i64> undef,
49 <2 x i32> <i32 1, i32 0>
54 define <4 x float> @f5(ptr %ptr) {
56 ; CHECK: vlerf %v24, 0(%r2)
58 %load = load <4 x float>, ptr %ptr
59 %ret = shufflevector <4 x float> %load, <4 x float> undef,
60 <4 x i32> <i32 3, i32 2, i32 1, i32 0>
65 define <2 x double> @f6(ptr %ptr) {
67 ; CHECK: vlerg %v24, 0(%r2)
69 %load = load <2 x double>, ptr %ptr
70 %ret = shufflevector <2 x double> %load, <2 x double> undef,
71 <2 x i32> <i32 1, i32 0>
75 ; Test the highest aligned in-range offset.
76 define <4 x i32> @f7(ptr %base) {
78 ; CHECK: vlerf %v24, 4080(%r2)
80 %ptr = getelementptr <4 x i32>, ptr %base, i64 255
81 %load = load <4 x i32>, ptr %ptr
82 %ret = shufflevector <4 x i32> %load, <4 x i32> undef,
83 <4 x i32> <i32 3, i32 2, i32 1, i32 0>
87 ; Test the highest unaligned in-range offset.
88 define <4 x i32> @f8(ptr %base) {
90 ; CHECK: vlerf %v24, 4095(%r2)
92 %addr = getelementptr i8, ptr %base, i64 4095
93 %load = load <4 x i32>, ptr %addr
94 %ret = shufflevector <4 x i32> %load, <4 x i32> undef,
95 <4 x i32> <i32 3, i32 2, i32 1, i32 0>
99 ; Test the next offset up, which requires separate address logic,
100 define <4 x i32> @f9(ptr %base) {
102 ; CHECK: aghi %r2, 4096
103 ; CHECK: vlerf %v24, 0(%r2)
105 %ptr = getelementptr <4 x i32>, ptr %base, i64 256
106 %load = load <4 x i32>, ptr %ptr
107 %ret = shufflevector <4 x i32> %load, <4 x i32> undef,
108 <4 x i32> <i32 3, i32 2, i32 1, i32 0>
112 ; Test negative offsets, which also require separate address logic,
113 define <4 x i32> @f10(ptr %base) {
115 ; CHECK: aghi %r2, -16
116 ; CHECK: vlerf %v24, 0(%r2)
118 %ptr = getelementptr <4 x i32>, ptr %base, i64 -1
119 %load = load <4 x i32>, ptr %ptr
120 %ret = shufflevector <4 x i32> %load, <4 x i32> undef,
121 <4 x i32> <i32 3, i32 2, i32 1, i32 0>
125 ; Check that indexes are allowed.
126 define <4 x i32> @f11(ptr %base, i64 %index) {
128 ; CHECK: vlerf %v24, 0(%r3,%r2)
130 %addr = getelementptr i8, ptr %base, i64 %index
131 %load = load <4 x i32>, ptr %addr
132 %ret = shufflevector <4 x i32> %load, <4 x i32> undef,
133 <4 x i32> <i32 3, i32 2, i32 1, i32 0>