1*9880d681SAndroid Build Coastguard Worker; Test insertions of memory values into a nonzero index of an undef. 2*9880d681SAndroid Build Coastguard Worker; 3*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Worker; Test v16i8 insertion into an undef, with an arbitrary index. 6*9880d681SAndroid Build Coastguard Workerdefine <16 x i8> @f1(i8 *%ptr) { 7*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f1: 8*9880d681SAndroid Build Coastguard Worker; CHECK: vlrepb %v24, 0(%r2) 9*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br %r14 10*9880d681SAndroid Build Coastguard Worker %val = load i8, i8 *%ptr 11*9880d681SAndroid Build Coastguard Worker %ret = insertelement <16 x i8> undef, i8 %val, i32 12 12*9880d681SAndroid Build Coastguard Worker ret <16 x i8> %ret 13*9880d681SAndroid Build Coastguard Worker} 14*9880d681SAndroid Build Coastguard Worker 15*9880d681SAndroid Build Coastguard Worker; Test v16i8 insertion into an undef, with the first good index for VLVGP. 16*9880d681SAndroid Build Coastguard Workerdefine <16 x i8> @f2(i8 *%ptr) { 17*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f2: 18*9880d681SAndroid Build Coastguard Worker; CHECK: {{vlrepb|vllezb}} %v24, 0(%r2) 19*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br %r14 20*9880d681SAndroid Build Coastguard Worker %val = load i8, i8 *%ptr 21*9880d681SAndroid Build Coastguard Worker %ret = insertelement <16 x i8> undef, i8 %val, i32 7 22*9880d681SAndroid Build Coastguard Worker ret <16 x i8> %ret 23*9880d681SAndroid Build Coastguard Worker} 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard Worker; Test v16i8 insertion into an undef, with the second good index for VLVGP. 26*9880d681SAndroid Build Coastguard Workerdefine <16 x i8> @f3(i8 *%ptr) { 27*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f3: 28*9880d681SAndroid Build Coastguard Worker; CHECK: vlrepb %v24, 0(%r2) 29*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br %r14 30*9880d681SAndroid Build Coastguard Worker %val = load i8, i8 *%ptr 31*9880d681SAndroid Build Coastguard Worker %ret = insertelement <16 x i8> undef, i8 %val, i32 15 32*9880d681SAndroid Build Coastguard Worker ret <16 x i8> %ret 33*9880d681SAndroid Build Coastguard Worker} 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Worker; Test v8i16 insertion into an undef, with an arbitrary index. 36*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @f4(i16 *%ptr) { 37*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f4: 38*9880d681SAndroid Build Coastguard Worker; CHECK: vlreph %v24, 0(%r2) 39*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br %r14 40*9880d681SAndroid Build Coastguard Worker %val = load i16, i16 *%ptr 41*9880d681SAndroid Build Coastguard Worker %ret = insertelement <8 x i16> undef, i16 %val, i32 5 42*9880d681SAndroid Build Coastguard Worker ret <8 x i16> %ret 43*9880d681SAndroid Build Coastguard Worker} 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard Worker; Test v8i16 insertion into an undef, with the first good index for VLVGP. 46*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @f5(i16 *%ptr) { 47*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f5: 48*9880d681SAndroid Build Coastguard Worker; CHECK: {{vlreph|vllezh}} %v24, 0(%r2) 49*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br %r14 50*9880d681SAndroid Build Coastguard Worker %val = load i16, i16 *%ptr 51*9880d681SAndroid Build Coastguard Worker %ret = insertelement <8 x i16> undef, i16 %val, i32 3 52*9880d681SAndroid Build Coastguard Worker ret <8 x i16> %ret 53*9880d681SAndroid Build Coastguard Worker} 54*9880d681SAndroid Build Coastguard Worker 55*9880d681SAndroid Build Coastguard Worker; Test v8i16 insertion into an undef, with the second good index for VLVGP. 56*9880d681SAndroid Build Coastguard Workerdefine <8 x i16> @f6(i16 *%ptr) { 57*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f6: 58*9880d681SAndroid Build Coastguard Worker; CHECK: vlreph %v24, 0(%r2) 59*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br %r14 60*9880d681SAndroid Build Coastguard Worker %val = load i16, i16 *%ptr 61*9880d681SAndroid Build Coastguard Worker %ret = insertelement <8 x i16> undef, i16 %val, i32 7 62*9880d681SAndroid Build Coastguard Worker ret <8 x i16> %ret 63*9880d681SAndroid Build Coastguard Worker} 64*9880d681SAndroid Build Coastguard Worker 65*9880d681SAndroid Build Coastguard Worker; Test v4i32 insertion into an undef, with an arbitrary index. 66*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @f7(i32 *%ptr) { 67*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f7: 68*9880d681SAndroid Build Coastguard Worker; CHECK: vlrepf %v24, 0(%r2) 69*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br %r14 70*9880d681SAndroid Build Coastguard Worker %val = load i32, i32 *%ptr 71*9880d681SAndroid Build Coastguard Worker %ret = insertelement <4 x i32> undef, i32 %val, i32 2 72*9880d681SAndroid Build Coastguard Worker ret <4 x i32> %ret 73*9880d681SAndroid Build Coastguard Worker} 74*9880d681SAndroid Build Coastguard Worker 75*9880d681SAndroid Build Coastguard Worker; Test v4i32 insertion into an undef, with the first good index for VLVGP. 76*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @f8(i32 *%ptr) { 77*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f8: 78*9880d681SAndroid Build Coastguard Worker; CHECK: {{vlrepf|vllezf}} %v24, 0(%r2) 79*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br %r14 80*9880d681SAndroid Build Coastguard Worker %val = load i32, i32 *%ptr 81*9880d681SAndroid Build Coastguard Worker %ret = insertelement <4 x i32> undef, i32 %val, i32 1 82*9880d681SAndroid Build Coastguard Worker ret <4 x i32> %ret 83*9880d681SAndroid Build Coastguard Worker} 84*9880d681SAndroid Build Coastguard Worker 85*9880d681SAndroid Build Coastguard Worker; Test v4i32 insertion into an undef, with the second good index for VLVGP. 86*9880d681SAndroid Build Coastguard Workerdefine <4 x i32> @f9(i32 *%ptr) { 87*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f9: 88*9880d681SAndroid Build Coastguard Worker; CHECK: vlrepf %v24, 0(%r2) 89*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br %r14 90*9880d681SAndroid Build Coastguard Worker %val = load i32, i32 *%ptr 91*9880d681SAndroid Build Coastguard Worker %ret = insertelement <4 x i32> undef, i32 %val, i32 3 92*9880d681SAndroid Build Coastguard Worker ret <4 x i32> %ret 93*9880d681SAndroid Build Coastguard Worker} 94*9880d681SAndroid Build Coastguard Worker 95*9880d681SAndroid Build Coastguard Worker; Test v2i64 insertion into an undef. 96*9880d681SAndroid Build Coastguard Workerdefine <2 x i64> @f10(i64 *%ptr) { 97*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f10: 98*9880d681SAndroid Build Coastguard Worker; CHECK: vlrepg %v24, 0(%r2) 99*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: br %r14 100*9880d681SAndroid Build Coastguard Worker %val = load i64, i64 *%ptr 101*9880d681SAndroid Build Coastguard Worker %ret = insertelement <2 x i64> undef, i64 %val, i32 1 102*9880d681SAndroid Build Coastguard Worker ret <2 x i64> %ret 103*9880d681SAndroid Build Coastguard Worker} 104*9880d681SAndroid Build Coastguard Worker 105*9880d681SAndroid Build Coastguard Worker; Test v4f32 insertion into an undef. 106*9880d681SAndroid Build Coastguard Workerdefine <4 x float> @f11(float *%ptr) { 107*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f11: 108*9880d681SAndroid Build Coastguard Worker; CHECK: vlrepf %v24, 0(%r2) 109*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 110*9880d681SAndroid Build Coastguard Worker %val = load float, float *%ptr 111*9880d681SAndroid Build Coastguard Worker %ret = insertelement <4 x float> undef, float %val, i32 2 112*9880d681SAndroid Build Coastguard Worker ret <4 x float> %ret 113*9880d681SAndroid Build Coastguard Worker} 114*9880d681SAndroid Build Coastguard Worker 115*9880d681SAndroid Build Coastguard Worker; Test v2f64 insertion into an undef. 116*9880d681SAndroid Build Coastguard Workerdefine <2 x double> @f12(double *%ptr) { 117*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: f12: 118*9880d681SAndroid Build Coastguard Worker; CHECK: vlrepg %v24, 0(%r2) 119*9880d681SAndroid Build Coastguard Worker; CHECK: br %r14 120*9880d681SAndroid Build Coastguard Worker %val = load double, double *%ptr 121*9880d681SAndroid Build Coastguard Worker %ret = insertelement <2 x double> undef, double %val, i32 1 122*9880d681SAndroid Build Coastguard Worker ret <2 x double> %ret 123*9880d681SAndroid Build Coastguard Worker} 124