1 ; Test insertions of byte-swapped memory values into a nonzero index of an undef.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=arch13 | FileCheck %s
5 declare i16 @llvm.bswap.i16(i16)
6 declare i32 @llvm.bswap.i32(i32)
7 declare i64 @llvm.bswap.i64(i64)
8 declare <8 x i16> @llvm.bswap.v8i16(<8 x i16>)
9 declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>)
10 declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>)
12 ; Test v8i16 insertion into an undef, with an arbitrary index.
13 define <8 x i16> @f1(i16 *%ptr) {
15 ; CHECK: vlbrreph %v24, 0(%r2)
17 %val = load i16, i16 *%ptr
18 %swap = call i16 @llvm.bswap.i16(i16 %val)
19 %ret = insertelement <8 x i16> undef, i16 %swap, i32 5
23 ; Test v8i16 insertion into an undef, using a vector bswap.
24 define <8 x i16> @f2(i16 *%ptr) {
26 ; CHECK: vlbrreph %v24, 0(%r2)
28 %val = load i16, i16 *%ptr
29 %insert = insertelement <8 x i16> undef, i16 %val, i32 5
30 %ret = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %insert)
34 ; Test v4i32 insertion into an undef, with an arbitrary index.
35 define <4 x i32> @f3(i32 *%ptr) {
37 ; CHECK: vlbrrepf %v24, 0(%r2)
39 %val = load i32, i32 *%ptr
40 %swap = call i32 @llvm.bswap.i32(i32 %val)
41 %ret = insertelement <4 x i32> undef, i32 %swap, i32 2
45 ; Test v4i32 insertion into an undef, using a vector bswap.
46 define <4 x i32> @f4(i32 *%ptr) {
48 ; CHECK: vlbrrepf %v24, 0(%r2)
50 %val = load i32, i32 *%ptr
51 %insert = insertelement <4 x i32> undef, i32 %val, i32 2
52 %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %insert)
56 ; Test v2i64 insertion into an undef, with an arbitrary index.
57 define <2 x i64> @f5(i64 *%ptr) {
59 ; CHECK: vlbrrepg %v24, 0(%r2)
61 %val = load i64, i64 *%ptr
62 %swap = call i64 @llvm.bswap.i64(i64 %val)
63 %ret = insertelement <2 x i64> undef, i64 %swap, i32 1
67 ; Test v2i64 insertion into an undef, using a vector bwap.
68 define <2 x i64> @f6(i64 *%ptr) {
70 ; CHECK: vlbrrepg %v24, 0(%r2)
72 %val = load i64, i64 *%ptr
73 %insert = insertelement <2 x i64> undef, i64 %val, i32 1
74 %ret = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %insert)