1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; Test loads of byte-swapped vector elements.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z15 | FileCheck %s
6 declare <8 x i16> @llvm.bswap.v8i16(<8 x i16>)
7 declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>)
8 declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
11 define <8 x i16> @f1(ptr %ptr) {
14 ; CHECK-NEXT: vlbrh %v24, 0(%r2)
16 %load = load <8 x i16>, ptr %ptr
17 %ret = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %load)
22 define <4 x i32> @f2(ptr %ptr) {
25 ; CHECK-NEXT: vlbrf %v24, 0(%r2)
27 %load = load <4 x i32>, ptr %ptr
28 %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %load)
33 define <2 x i64> @f3(ptr %ptr) {
36 ; CHECK-NEXT: vlbrg %v24, 0(%r2)
38 %load = load <2 x i64>, ptr %ptr
39 %ret = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %load)
43 ; Test the highest aligned in-range offset.
44 define <4 x i32> @f4(ptr %base) {
47 ; CHECK-NEXT: vlbrf %v24, 4080(%r2)
49 %ptr = getelementptr <4 x i32>, ptr %base, i64 255
50 %load = load <4 x i32>, ptr %ptr
51 %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %load)
55 ; Test the highest unaligned in-range offset.
56 define <4 x i32> @f5(ptr %base) {
59 ; CHECK-NEXT: vlbrf %v24, 4095(%r2)
61 %addr = getelementptr i8, ptr %base, i64 4095
62 %load = load <4 x i32>, ptr %addr
63 %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %load)
67 ; Test the next offset up, which requires separate address logic,
68 define <4 x i32> @f6(ptr %base) {
71 ; CHECK-NEXT: aghi %r2, 4096
72 ; CHECK-NEXT: vlbrf %v24, 0(%r2)
74 %ptr = getelementptr <4 x i32>, ptr %base, i64 256
75 %load = load <4 x i32>, ptr %ptr
76 %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %load)
80 ; Test negative offsets, which also require separate address logic,
81 define <4 x i32> @f7(ptr %base) {
84 ; CHECK-NEXT: aghi %r2, -16
85 ; CHECK-NEXT: vlbrf %v24, 0(%r2)
87 %ptr = getelementptr <4 x i32>, ptr %base, i64 -1
88 %load = load <4 x i32>, ptr %ptr
89 %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %load)
93 ; Check that indexes are allowed.
94 define <4 x i32> @f8(ptr %base, i64 %index) {
97 ; CHECK-NEXT: vlbrf %v24, 0(%r3,%r2)
99 %addr = getelementptr i8, ptr %base, i64 %index
100 %load = load <4 x i32>, ptr %addr
101 %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %load)