1 ; Test replications of a scalar memory value, represented as splats. 2 ; 3 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s 4 5 ; Test a v16i8 replicating load with no offset. 6 define <16 x i8> @f1(i8 *%ptr) { 7 ; CHECK-LABEL: f1: 8 ; CHECK: vlrepb %v24, 0(%r2) 9 ; CHECK: br %r14 10 %scalar = load i8, i8 *%ptr 11 %val = insertelement <16 x i8> undef, i8 %scalar, i32 0 12 %ret = shufflevector <16 x i8> %val, <16 x i8> undef, 13 <16 x i32> zeroinitializer 14 ret <16 x i8> %ret 15 } 16 17 ; Test a v16i8 replicating load with the maximum in-range offset. 18 define <16 x i8> @f2(i8 *%base) { 19 ; CHECK-LABEL: f2: 20 ; CHECK: vlrepb %v24, 4095(%r2) 21 ; CHECK: br %r14 22 %ptr = getelementptr i8, i8 *%base, i64 4095 23 %scalar = load i8, i8 *%ptr 24 %val = insertelement <16 x i8> undef, i8 %scalar, i32 0 25 %ret = shufflevector <16 x i8> %val, <16 x i8> undef, 26 <16 x i32> zeroinitializer 27 ret <16 x i8> %ret 28 } 29 30 ; Test a v16i8 replicating load with the first out-of-range offset. 31 define <16 x i8> @f3(i8 *%base) { 32 ; CHECK-LABEL: f3: 33 ; CHECK: aghi %r2, 4096 34 ; CHECK: vlrepb %v24, 0(%r2) 35 ; CHECK: br %r14 36 %ptr = getelementptr i8, i8 *%base, i64 4096 37 %scalar = load i8, i8 *%ptr 38 %val = insertelement <16 x i8> undef, i8 %scalar, i32 0 39 %ret = shufflevector <16 x i8> %val, <16 x i8> undef, 40 <16 x i32> zeroinitializer 41 ret <16 x i8> %ret 42 } 43 44 ; Test a v8i16 replicating load with no offset. 45 define <8 x i16> @f4(i16 *%ptr) { 46 ; CHECK-LABEL: f4: 47 ; CHECK: vlreph %v24, 0(%r2) 48 ; CHECK: br %r14 49 %scalar = load i16, i16 *%ptr 50 %val = insertelement <8 x i16> undef, i16 %scalar, i32 0 51 %ret = shufflevector <8 x i16> %val, <8 x i16> undef, 52 <8 x i32> zeroinitializer 53 ret <8 x i16> %ret 54 } 55 56 ; Test a v8i16 replicating load with the maximum in-range offset. 57 define <8 x i16> @f5(i16 *%base) { 58 ; CHECK-LABEL: f5: 59 ; CHECK: vlreph %v24, 4094(%r2) 60 ; CHECK: br %r14 61 %ptr = getelementptr i16, i16 *%base, i64 2047 62 %scalar = load i16, i16 *%ptr 63 %val = insertelement <8 x i16> undef, i16 %scalar, i32 0 64 %ret = shufflevector <8 x i16> %val, <8 x i16> undef, 65 <8 x i32> zeroinitializer 66 ret <8 x i16> %ret 67 } 68 69 ; Test a v8i16 replicating load with the first out-of-range offset. 70 define <8 x i16> @f6(i16 *%base) { 71 ; CHECK-LABEL: f6: 72 ; CHECK: aghi %r2, 4096 73 ; CHECK: vlreph %v24, 0(%r2) 74 ; CHECK: br %r14 75 %ptr = getelementptr i16, i16 *%base, i64 2048 76 %scalar = load i16, i16 *%ptr 77 %val = insertelement <8 x i16> undef, i16 %scalar, i32 0 78 %ret = shufflevector <8 x i16> %val, <8 x i16> undef, 79 <8 x i32> zeroinitializer 80 ret <8 x i16> %ret 81 } 82 83 ; Test a v4i32 replicating load with no offset. 84 define <4 x i32> @f7(i32 *%ptr) { 85 ; CHECK-LABEL: f7: 86 ; CHECK: vlrepf %v24, 0(%r2) 87 ; CHECK: br %r14 88 %scalar = load i32, i32 *%ptr 89 %val = insertelement <4 x i32> undef, i32 %scalar, i32 0 90 %ret = shufflevector <4 x i32> %val, <4 x i32> undef, 91 <4 x i32> zeroinitializer 92 ret <4 x i32> %ret 93 } 94 95 ; Test a v4i32 replicating load with the maximum in-range offset. 96 define <4 x i32> @f8(i32 *%base) { 97 ; CHECK-LABEL: f8: 98 ; CHECK: vlrepf %v24, 4092(%r2) 99 ; CHECK: br %r14 100 %ptr = getelementptr i32, i32 *%base, i64 1023 101 %scalar = load i32, i32 *%ptr 102 %val = insertelement <4 x i32> undef, i32 %scalar, i32 0 103 %ret = shufflevector <4 x i32> %val, <4 x i32> undef, 104 <4 x i32> zeroinitializer 105 ret <4 x i32> %ret 106 } 107 108 ; Test a v4i32 replicating load with the first out-of-range offset. 109 define <4 x i32> @f9(i32 *%base) { 110 ; CHECK-LABEL: f9: 111 ; CHECK: aghi %r2, 4096 112 ; CHECK: vlrepf %v24, 0(%r2) 113 ; CHECK: br %r14 114 %ptr = getelementptr i32, i32 *%base, i64 1024 115 %scalar = load i32, i32 *%ptr 116 %val = insertelement <4 x i32> undef, i32 %scalar, i32 0 117 %ret = shufflevector <4 x i32> %val, <4 x i32> undef, 118 <4 x i32> zeroinitializer 119 ret <4 x i32> %ret 120 } 121 122 ; Test a v2i64 replicating load with no offset. 123 define <2 x i64> @f10(i64 *%ptr) { 124 ; CHECK-LABEL: f10: 125 ; CHECK: vlrepg %v24, 0(%r2) 126 ; CHECK: br %r14 127 %scalar = load i64, i64 *%ptr 128 %val = insertelement <2 x i64> undef, i64 %scalar, i32 0 129 %ret = shufflevector <2 x i64> %val, <2 x i64> undef, 130 <2 x i32> zeroinitializer 131 ret <2 x i64> %ret 132 } 133 134 ; Test a v2i64 replicating load with the maximum in-range offset. 135 define <2 x i64> @f11(i64 *%base) { 136 ; CHECK-LABEL: f11: 137 ; CHECK: vlrepg %v24, 4088(%r2) 138 ; CHECK: br %r14 139 %ptr = getelementptr i64, i64 *%base, i32 511 140 %scalar = load i64, i64 *%ptr 141 %val = insertelement <2 x i64> undef, i64 %scalar, i32 0 142 %ret = shufflevector <2 x i64> %val, <2 x i64> undef, 143 <2 x i32> zeroinitializer 144 ret <2 x i64> %ret 145 } 146 147 ; Test a v2i64 replicating load with the first out-of-range offset. 148 define <2 x i64> @f12(i64 *%base) { 149 ; CHECK-LABEL: f12: 150 ; CHECK: aghi %r2, 4096 151 ; CHECK: vlrepg %v24, 0(%r2) 152 ; CHECK: br %r14 153 %ptr = getelementptr i64, i64 *%base, i32 512 154 %scalar = load i64, i64 *%ptr 155 %val = insertelement <2 x i64> undef, i64 %scalar, i32 0 156 %ret = shufflevector <2 x i64> %val, <2 x i64> undef, 157 <2 x i32> zeroinitializer 158 ret <2 x i64> %ret 159 } 160 161 ; Test a v4f32 replicating load with no offset. 162 define <4 x float> @f13(float *%ptr) { 163 ; CHECK-LABEL: f13: 164 ; CHECK: vlrepf %v24, 0(%r2) 165 ; CHECK: br %r14 166 %scalar = load float, float *%ptr 167 %val = insertelement <4 x float> undef, float %scalar, i32 0 168 %ret = shufflevector <4 x float> %val, <4 x float> undef, 169 <4 x i32> zeroinitializer 170 ret <4 x float> %ret 171 } 172 173 ; Test a v4f32 replicating load with the maximum in-range offset. 174 define <4 x float> @f14(float *%base) { 175 ; CHECK-LABEL: f14: 176 ; CHECK: vlrepf %v24, 4092(%r2) 177 ; CHECK: br %r14 178 %ptr = getelementptr float, float *%base, i64 1023 179 %scalar = load float, float *%ptr 180 %val = insertelement <4 x float> undef, float %scalar, i32 0 181 %ret = shufflevector <4 x float> %val, <4 x float> undef, 182 <4 x i32> zeroinitializer 183 ret <4 x float> %ret 184 } 185 186 ; Test a v4f32 replicating load with the first out-of-range offset. 187 define <4 x float> @f15(float *%base) { 188 ; CHECK-LABEL: f15: 189 ; CHECK: aghi %r2, 4096 190 ; CHECK: vlrepf %v24, 0(%r2) 191 ; CHECK: br %r14 192 %ptr = getelementptr float, float *%base, i64 1024 193 %scalar = load float, float *%ptr 194 %val = insertelement <4 x float> undef, float %scalar, i32 0 195 %ret = shufflevector <4 x float> %val, <4 x float> undef, 196 <4 x i32> zeroinitializer 197 ret <4 x float> %ret 198 } 199 200 ; Test a v2f64 replicating load with no offset. 201 define <2 x double> @f16(double *%ptr) { 202 ; CHECK-LABEL: f16: 203 ; CHECK: vlrepg %v24, 0(%r2) 204 ; CHECK: br %r14 205 %scalar = load double, double *%ptr 206 %val = insertelement <2 x double> undef, double %scalar, i32 0 207 %ret = shufflevector <2 x double> %val, <2 x double> undef, 208 <2 x i32> zeroinitializer 209 ret <2 x double> %ret 210 } 211 212 ; Test a v2f64 replicating load with the maximum in-range offset. 213 define <2 x double> @f17(double *%base) { 214 ; CHECK-LABEL: f17: 215 ; CHECK: vlrepg %v24, 4088(%r2) 216 ; CHECK: br %r14 217 %ptr = getelementptr double, double *%base, i32 511 218 %scalar = load double, double *%ptr 219 %val = insertelement <2 x double> undef, double %scalar, i32 0 220 %ret = shufflevector <2 x double> %val, <2 x double> undef, 221 <2 x i32> zeroinitializer 222 ret <2 x double> %ret 223 } 224 225 ; Test a v2f64 replicating load with the first out-of-range offset. 226 define <2 x double> @f18(double *%base) { 227 ; CHECK-LABEL: f18: 228 ; CHECK: aghi %r2, 4096 229 ; CHECK: vlrepg %v24, 0(%r2) 230 ; CHECK: br %r14 231 %ptr = getelementptr double, double *%base, i32 512 232 %scalar = load double, double *%ptr 233 %val = insertelement <2 x double> undef, double %scalar, i32 0 234 %ret = shufflevector <2 x double> %val, <2 x double> undef, 235 <2 x i32> zeroinitializer 236 ret <2 x double> %ret 237 } 238 239 ; Test a v16i8 replicating load with an index. 240 define <16 x i8> @f19(i8 *%base, i64 %index) { 241 ; CHECK-LABEL: f19: 242 ; CHECK: vlrepb %v24, 1023(%r3,%r2) 243 ; CHECK: br %r14 244 %ptr1 = getelementptr i8, i8 *%base, i64 %index 245 %ptr = getelementptr i8, i8 *%ptr1, i64 1023 246 %scalar = load i8, i8 *%ptr 247 %val = insertelement <16 x i8> undef, i8 %scalar, i32 0 248 %ret = shufflevector <16 x i8> %val, <16 x i8> undef, 249 <16 x i32> zeroinitializer 250 ret <16 x i8> %ret 251 } 252