1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2 ; Test insertions of byte-swapped memory values into a nonzero index of an undef.
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>)
13 ; Test v8i16 insertion into an undef, with an arbitrary index.
14 define <8 x i16> @f1(ptr %ptr) {
17 ; CHECK-NEXT: vlbrreph %v24, 0(%r2)
19 %val = load i16, ptr %ptr
20 %swap = call i16 @llvm.bswap.i16(i16 %val)
21 %ret = insertelement <8 x i16> undef, i16 %swap, i32 5
25 ; Test v8i16 insertion into an undef, using a vector bswap.
26 define <8 x i16> @f2(ptr %ptr) {
29 ; CHECK-NEXT: vlbrreph %v24, 0(%r2)
31 %val = load i16, ptr %ptr
32 %insert = insertelement <8 x i16> undef, i16 %val, i32 5
33 %ret = call <8 x i16> @llvm.bswap.v8i16(<8 x i16> %insert)
37 ; Test v4i32 insertion into an undef, with an arbitrary index.
38 define <4 x i32> @f3(ptr %ptr) {
41 ; CHECK-NEXT: vlbrrepf %v24, 0(%r2)
43 %val = load i32, ptr %ptr
44 %swap = call i32 @llvm.bswap.i32(i32 %val)
45 %ret = insertelement <4 x i32> undef, i32 %swap, i32 2
49 ; Test v4i32 insertion into an undef, using a vector bswap.
50 define <4 x i32> @f4(ptr %ptr) {
53 ; CHECK-NEXT: vlbrrepf %v24, 0(%r2)
55 %val = load i32, ptr %ptr
56 %insert = insertelement <4 x i32> undef, i32 %val, i32 2
57 %ret = call <4 x i32> @llvm.bswap.v4i32(<4 x i32> %insert)
61 ; Test v2i64 insertion into an undef, with an arbitrary index.
62 define <2 x i64> @f5(ptr %ptr) {
65 ; CHECK-NEXT: vlbrrepg %v24, 0(%r2)
67 %val = load i64, ptr %ptr
68 %swap = call i64 @llvm.bswap.i64(i64 %val)
69 %ret = insertelement <2 x i64> undef, i64 %swap, i32 1
73 ; Test v2i64 insertion into an undef, using a vector bwap.
74 define <2 x i64> @f6(ptr %ptr) {
77 ; CHECK-NEXT: vlbrrepg %v24, 0(%r2)
79 %val = load i64, ptr %ptr
80 %insert = insertelement <2 x i64> undef, i64 %val, i32 1
81 %ret = call <2 x i64> @llvm.bswap.v2i64(<2 x i64> %insert)