1*ce4c1095SUlrich Weigand; Test vector arithmetic shift right with scalar shift amount. 2*ce4c1095SUlrich Weigand; 3*ce4c1095SUlrich Weigand; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s 4*ce4c1095SUlrich Weigand 5*ce4c1095SUlrich Weigand; Test a v16i8 shift by a variable. 6*ce4c1095SUlrich Weiganddefine <16 x i8> @f1(<16 x i8> %dummy, <16 x i8> %val1, i32 %shift) { 7*ce4c1095SUlrich Weigand; CHECK-LABEL: f1: 8*ce4c1095SUlrich Weigand; CHECK: vesrab %v24, %v26, 0(%r2) 9*ce4c1095SUlrich Weigand; CHECK: br %r14 10*ce4c1095SUlrich Weigand %truncshift = trunc i32 %shift to i8 11*ce4c1095SUlrich Weigand %shiftvec = insertelement <16 x i8> undef, i8 %truncshift, i32 0 12*ce4c1095SUlrich Weigand %val2 = shufflevector <16 x i8> %shiftvec, <16 x i8> undef, 13*ce4c1095SUlrich Weigand <16 x i32> zeroinitializer 14*ce4c1095SUlrich Weigand %ret = ashr <16 x i8> %val1, %val2 15*ce4c1095SUlrich Weigand ret <16 x i8> %ret 16*ce4c1095SUlrich Weigand} 17*ce4c1095SUlrich Weigand 18*ce4c1095SUlrich Weigand; Test a v16i8 shift by the lowest useful constant. 19*ce4c1095SUlrich Weiganddefine <16 x i8> @f2(<16 x i8> %dummy, <16 x i8> %val) { 20*ce4c1095SUlrich Weigand; CHECK-LABEL: f2: 21*ce4c1095SUlrich Weigand; CHECK: vesrab %v24, %v26, 1 22*ce4c1095SUlrich Weigand; CHECK: br %r14 23*ce4c1095SUlrich Weigand %ret = ashr <16 x i8> %val, <i8 1, i8 1, i8 1, i8 1, 24*ce4c1095SUlrich Weigand i8 1, i8 1, i8 1, i8 1, 25*ce4c1095SUlrich Weigand i8 1, i8 1, i8 1, i8 1, 26*ce4c1095SUlrich Weigand i8 1, i8 1, i8 1, i8 1> 27*ce4c1095SUlrich Weigand ret <16 x i8> %ret 28*ce4c1095SUlrich Weigand} 29*ce4c1095SUlrich Weigand 30*ce4c1095SUlrich Weigand; Test a v16i8 shift by the highest useful constant. 31*ce4c1095SUlrich Weiganddefine <16 x i8> @f3(<16 x i8> %dummy, <16 x i8> %val) { 32*ce4c1095SUlrich Weigand; CHECK-LABEL: f3: 33*ce4c1095SUlrich Weigand; CHECK: vesrab %v24, %v26, 7 34*ce4c1095SUlrich Weigand; CHECK: br %r14 35*ce4c1095SUlrich Weigand %ret = ashr <16 x i8> %val, <i8 7, i8 7, i8 7, i8 7, 36*ce4c1095SUlrich Weigand i8 7, i8 7, i8 7, i8 7, 37*ce4c1095SUlrich Weigand i8 7, i8 7, i8 7, i8 7, 38*ce4c1095SUlrich Weigand i8 7, i8 7, i8 7, i8 7> 39*ce4c1095SUlrich Weigand ret <16 x i8> %ret 40*ce4c1095SUlrich Weigand} 41*ce4c1095SUlrich Weigand 42*ce4c1095SUlrich Weigand; Test a v8i16 shift by a variable. 43*ce4c1095SUlrich Weiganddefine <8 x i16> @f4(<8 x i16> %dummy, <8 x i16> %val1, i32 %shift) { 44*ce4c1095SUlrich Weigand; CHECK-LABEL: f4: 45*ce4c1095SUlrich Weigand; CHECK: vesrah %v24, %v26, 0(%r2) 46*ce4c1095SUlrich Weigand; CHECK: br %r14 47*ce4c1095SUlrich Weigand %truncshift = trunc i32 %shift to i16 48*ce4c1095SUlrich Weigand %shiftvec = insertelement <8 x i16> undef, i16 %truncshift, i32 0 49*ce4c1095SUlrich Weigand %val2 = shufflevector <8 x i16> %shiftvec, <8 x i16> undef, 50*ce4c1095SUlrich Weigand <8 x i32> zeroinitializer 51*ce4c1095SUlrich Weigand %ret = ashr <8 x i16> %val1, %val2 52*ce4c1095SUlrich Weigand ret <8 x i16> %ret 53*ce4c1095SUlrich Weigand} 54*ce4c1095SUlrich Weigand 55*ce4c1095SUlrich Weigand; Test a v8i16 shift by the lowest useful constant. 56*ce4c1095SUlrich Weiganddefine <8 x i16> @f5(<8 x i16> %dummy, <8 x i16> %val) { 57*ce4c1095SUlrich Weigand; CHECK-LABEL: f5: 58*ce4c1095SUlrich Weigand; CHECK: vesrah %v24, %v26, 1 59*ce4c1095SUlrich Weigand; CHECK: br %r14 60*ce4c1095SUlrich Weigand %ret = ashr <8 x i16> %val, <i16 1, i16 1, i16 1, i16 1, 61*ce4c1095SUlrich Weigand i16 1, i16 1, i16 1, i16 1> 62*ce4c1095SUlrich Weigand ret <8 x i16> %ret 63*ce4c1095SUlrich Weigand} 64*ce4c1095SUlrich Weigand 65*ce4c1095SUlrich Weigand; Test a v8i16 shift by the highest useful constant. 66*ce4c1095SUlrich Weiganddefine <8 x i16> @f6(<8 x i16> %dummy, <8 x i16> %val) { 67*ce4c1095SUlrich Weigand; CHECK-LABEL: f6: 68*ce4c1095SUlrich Weigand; CHECK: vesrah %v24, %v26, 15 69*ce4c1095SUlrich Weigand; CHECK: br %r14 70*ce4c1095SUlrich Weigand %ret = ashr <8 x i16> %val, <i16 15, i16 15, i16 15, i16 15, 71*ce4c1095SUlrich Weigand i16 15, i16 15, i16 15, i16 15> 72*ce4c1095SUlrich Weigand ret <8 x i16> %ret 73*ce4c1095SUlrich Weigand} 74*ce4c1095SUlrich Weigand 75*ce4c1095SUlrich Weigand; Test a v4i32 shift by a variable. 76*ce4c1095SUlrich Weiganddefine <4 x i32> @f7(<4 x i32> %dummy, <4 x i32> %val1, i32 %shift) { 77*ce4c1095SUlrich Weigand; CHECK-LABEL: f7: 78*ce4c1095SUlrich Weigand; CHECK: vesraf %v24, %v26, 0(%r2) 79*ce4c1095SUlrich Weigand; CHECK: br %r14 80*ce4c1095SUlrich Weigand %shiftvec = insertelement <4 x i32> undef, i32 %shift, i32 0 81*ce4c1095SUlrich Weigand %val2 = shufflevector <4 x i32> %shiftvec, <4 x i32> undef, 82*ce4c1095SUlrich Weigand <4 x i32> zeroinitializer 83*ce4c1095SUlrich Weigand %ret = ashr <4 x i32> %val1, %val2 84*ce4c1095SUlrich Weigand ret <4 x i32> %ret 85*ce4c1095SUlrich Weigand} 86*ce4c1095SUlrich Weigand 87*ce4c1095SUlrich Weigand; Test a v4i32 shift by the lowest useful constant. 88*ce4c1095SUlrich Weiganddefine <4 x i32> @f8(<4 x i32> %dummy, <4 x i32> %val) { 89*ce4c1095SUlrich Weigand; CHECK-LABEL: f8: 90*ce4c1095SUlrich Weigand; CHECK: vesraf %v24, %v26, 1 91*ce4c1095SUlrich Weigand; CHECK: br %r14 92*ce4c1095SUlrich Weigand %ret = ashr <4 x i32> %val, <i32 1, i32 1, i32 1, i32 1> 93*ce4c1095SUlrich Weigand ret <4 x i32> %ret 94*ce4c1095SUlrich Weigand} 95*ce4c1095SUlrich Weigand 96*ce4c1095SUlrich Weigand; Test a v4i32 shift by the highest useful constant. 97*ce4c1095SUlrich Weiganddefine <4 x i32> @f9(<4 x i32> %dummy, <4 x i32> %val) { 98*ce4c1095SUlrich Weigand; CHECK-LABEL: f9: 99*ce4c1095SUlrich Weigand; CHECK: vesraf %v24, %v26, 31 100*ce4c1095SUlrich Weigand; CHECK: br %r14 101*ce4c1095SUlrich Weigand %ret = ashr <4 x i32> %val, <i32 31, i32 31, i32 31, i32 31> 102*ce4c1095SUlrich Weigand ret <4 x i32> %ret 103*ce4c1095SUlrich Weigand} 104*ce4c1095SUlrich Weigand 105*ce4c1095SUlrich Weigand; Test a v2i64 shift by a variable. 106*ce4c1095SUlrich Weiganddefine <2 x i64> @f10(<2 x i64> %dummy, <2 x i64> %val1, i32 %shift) { 107*ce4c1095SUlrich Weigand; CHECK-LABEL: f10: 108*ce4c1095SUlrich Weigand; CHECK: vesrag %v24, %v26, 0(%r2) 109*ce4c1095SUlrich Weigand; CHECK: br %r14 110*ce4c1095SUlrich Weigand %extshift = sext i32 %shift to i64 111*ce4c1095SUlrich Weigand %shiftvec = insertelement <2 x i64> undef, i64 %extshift, i32 0 112*ce4c1095SUlrich Weigand %val2 = shufflevector <2 x i64> %shiftvec, <2 x i64> undef, 113*ce4c1095SUlrich Weigand <2 x i32> zeroinitializer 114*ce4c1095SUlrich Weigand %ret = ashr <2 x i64> %val1, %val2 115*ce4c1095SUlrich Weigand ret <2 x i64> %ret 116*ce4c1095SUlrich Weigand} 117*ce4c1095SUlrich Weigand 118*ce4c1095SUlrich Weigand; Test a v2i64 shift by the lowest useful constant. 119*ce4c1095SUlrich Weiganddefine <2 x i64> @f11(<2 x i64> %dummy, <2 x i64> %val) { 120*ce4c1095SUlrich Weigand; CHECK-LABEL: f11: 121*ce4c1095SUlrich Weigand; CHECK: vesrag %v24, %v26, 1 122*ce4c1095SUlrich Weigand; CHECK: br %r14 123*ce4c1095SUlrich Weigand %ret = ashr <2 x i64> %val, <i64 1, i64 1> 124*ce4c1095SUlrich Weigand ret <2 x i64> %ret 125*ce4c1095SUlrich Weigand} 126*ce4c1095SUlrich Weigand 127*ce4c1095SUlrich Weigand; Test a v2i64 shift by the highest useful constant. 128*ce4c1095SUlrich Weiganddefine <2 x i64> @f12(<2 x i64> %dummy, <2 x i64> %val) { 129*ce4c1095SUlrich Weigand; CHECK-LABEL: f12: 130*ce4c1095SUlrich Weigand; CHECK: vesrag %v24, %v26, 63 131*ce4c1095SUlrich Weigand; CHECK: br %r14 132*ce4c1095SUlrich Weigand %ret = ashr <2 x i64> %val, <i64 63, i64 63> 133*ce4c1095SUlrich Weigand ret <2 x i64> %ret 134*ce4c1095SUlrich Weigand} 135