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