1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; Test stores 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 void @f1(<8 x i16> %val, ptr %ptr) {
14 ; CHECK-NEXT: vstbrh %v24, 0(%r2)
16 %swap = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %val)
17 store <8 x i16> %swap, ptr %ptr
22 define void @f2(<4 x i32> %val, ptr %ptr) {
25 ; CHECK-NEXT: vstbrf %v24, 0(%r2)
27 %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
28 store <4 x i32> %swap, ptr %ptr
33 define void @f3(<2 x i64> %val, ptr %ptr) {
36 ; CHECK-NEXT: vstbrg %v24, 0(%r2)
38 %swap = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %val)
39 store <2 x i64> %swap, ptr %ptr
43 ; Test the highest aligned in-range offset.
44 define void @f4(<4 x i32> %val, ptr %base) {
47 ; CHECK-NEXT: vstbrf %v24, 4080(%r2)
49 %ptr = getelementptr <4 x i32>, ptr %base, i64 255
50 %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
51 store <4 x i32> %swap, ptr %ptr
55 ; Test the highest unaligned in-range offset.
56 define void @f5(<4 x i32> %val, ptr %base) {
59 ; CHECK-NEXT: vstbrf %v24, 4095(%r2)
61 %addr = getelementptr i8, ptr %base, i64 4095
62 %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
63 store <4 x i32> %swap, ptr %addr, align 1
67 ; Test the next offset up, which requires separate address logic,
68 define void @f6(<4 x i32> %val, ptr %base) {
71 ; CHECK-NEXT: aghi %r2, 4096
72 ; CHECK-NEXT: vstbrf %v24, 0(%r2)
74 %ptr = getelementptr <4 x i32>, ptr %base, i64 256
75 %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
76 store <4 x i32> %swap, ptr %ptr
80 ; Test negative offsets, which also require separate address logic,
81 define void @f7(<4 x i32> %val, ptr %base) {
84 ; CHECK-NEXT: aghi %r2, -16
85 ; CHECK-NEXT: vstbrf %v24, 0(%r2)
87 %ptr = getelementptr <4 x i32>, ptr %base, i64 -1
88 %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
89 store <4 x i32> %swap, ptr %ptr
93 ; Check that indexes are allowed.
94 define void @f8(<4 x i32> %val, ptr %base, i64 %index) {
97 ; CHECK-NEXT: vstbrf %v24, 0(%r3,%r2)
99 %addr = getelementptr i8, ptr %base, i64 %index
100 %swap = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %val)
101 store <4 x i32> %swap, ptr %addr, align 1