1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; Test vector insertions of byte-swapped memory values into 0.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z15 | FileCheck %s
6 declare i16 @llvm.bswap.i16(i16)
7 declare i32 @llvm.bswap.i32(i32)
8 declare i64 @llvm.bswap.i64(i64)
9 declare <8 x i16> @llvm.bswap.v8i16(<8 x i16>)
10 declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>)
11 declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
14 define <8 x i16> @f1(ptr %ptr) {
17 ; CHECK-NEXT: vllebrzh %v24, 0(%r2)
19 %val = load i16, ptr %ptr
20 %swap = call i16 @llvm.bswap.i16(i16 %val)
21 %ret = insertelement <8 x i16> zeroinitializer, i16 %swap, i32 3
25 ; Test VLLEBRZH using a vector bswap.
26 define <8 x i16> @f2(ptr %ptr) {
29 ; CHECK-NEXT: vllebrzh %v24, 0(%r2)
31 %val = load i16, ptr %ptr
32 %insert = insertelement <8 x i16> zeroinitializer, i16 %val, i32 3
33 %ret = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %insert)
38 define <4 x i32> @f3(ptr %ptr) {
41 ; CHECK-NEXT: vllebrzf %v24, 0(%r2)
43 %val = load i32, ptr %ptr
44 %swap = call i32 @llvm.bswap.i32(i32 %val)
45 %ret = insertelement <4 x i32> zeroinitializer, i32 %swap, i32 1
49 ; Test VLLEBRZF using a vector bswap.
50 define <4 x i32> @f4(ptr %ptr) {
53 ; CHECK-NEXT: vllebrzf %v24, 0(%r2)
55 %val = load i32, ptr %ptr
56 %insert = insertelement <4 x i32> zeroinitializer, i32 %val, i32 1
57 %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %insert)
62 define <2 x i64> @f5(ptr %ptr) {
65 ; CHECK-NEXT: vllebrzg %v24, 0(%r2)
67 %val = load i64, ptr %ptr
68 %swap = call i64 @llvm.bswap.i64(i64 %val)
69 %ret = insertelement <2 x i64> zeroinitializer, i64 %swap, i32 0
73 ; Test VLLEBRZG using a vector bswap.
74 define <2 x i64> @f6(ptr %ptr) {
77 ; CHECK-NEXT: vllebrzg %v24, 0(%r2)
79 %val = load i64, ptr %ptr
80 %insert = insertelement <2 x i64> zeroinitializer, i64 %val, i32 0
81 %ret = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %insert)
86 define <4 x i32> @f7(ptr %ptr) {
89 ; CHECK-NEXT: vllebrze %v24, 0(%r2)
91 %val = load i32, ptr %ptr
92 %swap = call i32 @llvm.bswap.i32(i32 %val)
93 %ret = insertelement <4 x i32> zeroinitializer, i32 %swap, i32 0
97 ; Test VLLEBRZE using a vector bswap.
98 define <4 x i32> @f8(ptr %ptr) {
101 ; CHECK-NEXT: vllebrze %v24, 0(%r2)
102 ; CHECK-NEXT: br %r14
103 %val = load i32, ptr %ptr
104 %insert = insertelement <4 x i32> zeroinitializer, i32 %val, i32 0
105 %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %insert)
109 ; Test VLLEBRZH with the highest in-range offset.
110 define <8 x i16> @f9(ptr %base) {
113 ; CHECK-NEXT: vllebrzh %v24, 4094(%r2)
114 ; CHECK-NEXT: br %r14
115 %ptr = getelementptr i16, ptr %base, i64 2047
116 %val = load i16, ptr %ptr
117 %swap = call i16 @llvm.bswap.i16(i16 %val)
118 %ret = insertelement <8 x i16> zeroinitializer, i16 %swap, i32 3
122 ; Test VLLEBRZH with the next highest offset.
123 define <8 x i16> @f10(ptr %base) {
126 ; CHECK-NEXT: aghi %r2, 4096
127 ; CHECK-NEXT: vllebrzh %v24, 0(%r2)
128 ; CHECK-NEXT: br %r14
129 %ptr = getelementptr i16, ptr %base, i64 2048
130 %val = load i16, ptr %ptr
131 %swap = call i16 @llvm.bswap.i16(i16 %val)
132 %ret = insertelement <8 x i16> zeroinitializer, i16 %swap, i32 3
136 ; Test that VLLEBRZH allows an index.
137 define <8 x i16> @f11(ptr %base, i64 %index) {
140 ; CHECK-NEXT: sllg %r1, %r3, 1
141 ; CHECK-NEXT: vllebrzh %v24, 0(%r1,%r2)
142 ; CHECK-NEXT: br %r14
143 %ptr = getelementptr i16, ptr %base, i64 %index
144 %val = load i16, ptr %ptr
145 %swap = call i16 @llvm.bswap.i16(i16 %val)
146 %ret = insertelement <8 x i16> zeroinitializer, i16 %swap, i32 3