1; Test insertions of byte-swapped memory values into a nonzero index of an undef. 2; 3; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z15 | FileCheck %s 4 5declare i16 @llvm.bswap.i16(i16) 6declare i32 @llvm.bswap.i32(i32) 7declare i64 @llvm.bswap.i64(i64) 8declare <8 x i16> @llvm.bswap.v8i16(<8 x i16>) 9declare <4 x i32> @llvm.bswap.v4i32(<4 x i32>) 10declare <2 x i64> @llvm.bswap.v2i64(<2 x i64>) 11 12; Test v8i16 insertion into an undef, with an arbitrary index. 13define <8 x i16> @f1(i16 *%ptr) { 14; CHECK-LABEL: f1: 15; CHECK: vlbrreph %v24, 0(%r2) 16; CHECK-NEXT: br %r14 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 20 ret <8 x i16> %ret 21} 22 23; Test v8i16 insertion into an undef, using a vector bswap. 24define <8 x i16> @f2(i16 *%ptr) { 25; CHECK-LABEL: f2: 26; CHECK: vlbrreph %v24, 0(%r2) 27; CHECK-NEXT: br %r14 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) 31 ret <8 x i16> %ret 32} 33 34; Test v4i32 insertion into an undef, with an arbitrary index. 35define <4 x i32> @f3(i32 *%ptr) { 36; CHECK-LABEL: f3: 37; CHECK: vlbrrepf %v24, 0(%r2) 38; CHECK-NEXT: br %r14 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 42 ret <4 x i32> %ret 43} 44 45; Test v4i32 insertion into an undef, using a vector bswap. 46define <4 x i32> @f4(i32 *%ptr) { 47; CHECK-LABEL: f4: 48; CHECK: vlbrrepf %v24, 0(%r2) 49; CHECK-NEXT: br %r14 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) 53 ret <4 x i32> %ret 54} 55 56; Test v2i64 insertion into an undef, with an arbitrary index. 57define <2 x i64> @f5(i64 *%ptr) { 58; CHECK-LABEL: f5: 59; CHECK: vlbrrepg %v24, 0(%r2) 60; CHECK-NEXT: br %r14 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 64 ret <2 x i64> %ret 65} 66 67; Test v2i64 insertion into an undef, using a vector bwap. 68define <2 x i64> @f6(i64 *%ptr) { 69; CHECK-LABEL: f6: 70; CHECK: vlbrrepg %v24, 0(%r2) 71; CHECK-NEXT: br %r14 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) 75 ret <2 x i64> %ret 76} 77 78