1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple aarch64-none-linux-gnu -mattr=+sve | FileCheck %s 3 4define <vscale x 2 x i16> @dupsext_v2i8_v2i16(i8 %src, <vscale x 2 x i16> %b) { 5; CHECK-LABEL: dupsext_v2i8_v2i16: 6; CHECK: // %bb.0: // %entry 7; CHECK-NEXT: sxtb w8, w0 8; CHECK-NEXT: ptrue p0.d 9; CHECK-NEXT: mov z1.d, x8 10; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 11; CHECK-NEXT: ret 12entry: 13 %in = sext i8 %src to i16 14 %broadcast.splatinsert = insertelement <vscale x 2 x i16> undef, i16 %in, i16 0 15 %broadcast.splat = shufflevector <vscale x 2 x i16> %broadcast.splatinsert, <vscale x 2 x i16> undef, <vscale x 2 x i32> zeroinitializer 16 %out = mul nsw <vscale x 2 x i16> %broadcast.splat, %b 17 ret <vscale x 2 x i16> %out 18} 19 20define <vscale x 4 x i16> @dupsext_v4i8_v4i16(i8 %src, <vscale x 4 x i16> %b) { 21; CHECK-LABEL: dupsext_v4i8_v4i16: 22; CHECK: // %bb.0: // %entry 23; CHECK-NEXT: sxtb w8, w0 24; CHECK-NEXT: ptrue p0.s 25; CHECK-NEXT: mov z1.s, w8 26; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s 27; CHECK-NEXT: ret 28entry: 29 %in = sext i8 %src to i16 30 %broadcast.splatinsert = insertelement <vscale x 4 x i16> undef, i16 %in, i16 0 31 %broadcast.splat = shufflevector <vscale x 4 x i16> %broadcast.splatinsert, <vscale x 4 x i16> undef, <vscale x 4 x i32> zeroinitializer 32 %out = mul nsw <vscale x 4 x i16> %broadcast.splat, %b 33 ret <vscale x 4 x i16> %out 34} 35 36define <vscale x 8 x i16> @dupsext_v8i8_v8i16(i8 %src, <vscale x 8 x i16> %b) { 37; CHECK-LABEL: dupsext_v8i8_v8i16: 38; CHECK: // %bb.0: // %entry 39; CHECK-NEXT: sxtb w8, w0 40; CHECK-NEXT: ptrue p0.h 41; CHECK-NEXT: mov z1.h, w8 42; CHECK-NEXT: mul z0.h, p0/m, z0.h, z1.h 43; CHECK-NEXT: ret 44entry: 45 %in = sext i8 %src to i16 46 %broadcast.splatinsert = insertelement <vscale x 8 x i16> undef, i16 %in, i16 0 47 %broadcast.splat = shufflevector <vscale x 8 x i16> %broadcast.splatinsert, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer 48 %out = mul nsw <vscale x 8 x i16> %broadcast.splat, %b 49 ret <vscale x 8 x i16> %out 50} 51 52define <vscale x 2 x i32> @dupsext_v2i8_v2i32(i8 %src, <vscale x 2 x i32> %b) { 53; CHECK-LABEL: dupsext_v2i8_v2i32: 54; CHECK: // %bb.0: // %entry 55; CHECK-NEXT: sxtb w8, w0 56; CHECK-NEXT: ptrue p0.d 57; CHECK-NEXT: mov z1.d, x8 58; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 59; CHECK-NEXT: ret 60entry: 61 %in = sext i8 %src to i32 62 %broadcast.splatinsert = insertelement <vscale x 2 x i32> undef, i32 %in, i32 0 63 %broadcast.splat = shufflevector <vscale x 2 x i32> %broadcast.splatinsert, <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer 64 %out = mul nsw <vscale x 2 x i32> %broadcast.splat, %b 65 ret <vscale x 2 x i32> %out 66} 67 68define <vscale x 4 x i32> @dupsext_v4i8_v4i32(i8 %src, <vscale x 4 x i32> %b) { 69; CHECK-LABEL: dupsext_v4i8_v4i32: 70; CHECK: // %bb.0: // %entry 71; CHECK-NEXT: sxtb w8, w0 72; CHECK-NEXT: ptrue p0.s 73; CHECK-NEXT: mov z1.s, w8 74; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s 75; CHECK-NEXT: ret 76entry: 77 %in = sext i8 %src to i32 78 %broadcast.splatinsert = insertelement <vscale x 4 x i32> undef, i32 %in, i32 0 79 %broadcast.splat = shufflevector <vscale x 4 x i32> %broadcast.splatinsert, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer 80 %out = mul nsw <vscale x 4 x i32> %broadcast.splat, %b 81 ret <vscale x 4 x i32> %out 82} 83 84define <vscale x 2 x i64> @dupsext_v2i8_v2i64(i8 %src, <vscale x 2 x i64> %b) { 85; CHECK-LABEL: dupsext_v2i8_v2i64: 86; CHECK: // %bb.0: // %entry 87; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 88; CHECK-NEXT: sxtb x8, w0 89; CHECK-NEXT: ptrue p0.d 90; CHECK-NEXT: mov z1.d, x8 91; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 92; CHECK-NEXT: ret 93entry: 94 %in = sext i8 %src to i64 95 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0 96 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer 97 %out = mul nsw <vscale x 2 x i64> %broadcast.splat, %b 98 ret <vscale x 2 x i64> %out 99} 100 101define <vscale x 2 x i32> @dupsext_v2i16_v2i32(i16 %src, <vscale x 2 x i32> %b) { 102; CHECK-LABEL: dupsext_v2i16_v2i32: 103; CHECK: // %bb.0: // %entry 104; CHECK-NEXT: sxth w8, w0 105; CHECK-NEXT: ptrue p0.d 106; CHECK-NEXT: mov z1.d, x8 107; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 108; CHECK-NEXT: ret 109entry: 110 %in = sext i16 %src to i32 111 %broadcast.splatinsert = insertelement <vscale x 2 x i32> undef, i32 %in, i32 0 112 %broadcast.splat = shufflevector <vscale x 2 x i32> %broadcast.splatinsert, <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer 113 %out = mul nsw <vscale x 2 x i32> %broadcast.splat, %b 114 ret <vscale x 2 x i32> %out 115} 116 117define <vscale x 4 x i32> @dupsext_v4i16_v4i32(i16 %src, <vscale x 4 x i32> %b) { 118; CHECK-LABEL: dupsext_v4i16_v4i32: 119; CHECK: // %bb.0: // %entry 120; CHECK-NEXT: sxth w8, w0 121; CHECK-NEXT: ptrue p0.s 122; CHECK-NEXT: mov z1.s, w8 123; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s 124; CHECK-NEXT: ret 125entry: 126 %in = sext i16 %src to i32 127 %broadcast.splatinsert = insertelement <vscale x 4 x i32> undef, i32 %in, i32 0 128 %broadcast.splat = shufflevector <vscale x 4 x i32> %broadcast.splatinsert, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer 129 %out = mul nsw <vscale x 4 x i32> %broadcast.splat, %b 130 ret <vscale x 4 x i32> %out 131} 132 133define <vscale x 2 x i64> @dupsext_v2i16_v2i64(i16 %src, <vscale x 2 x i64> %b) { 134; CHECK-LABEL: dupsext_v2i16_v2i64: 135; CHECK: // %bb.0: // %entry 136; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 137; CHECK-NEXT: sxth x8, w0 138; CHECK-NEXT: ptrue p0.d 139; CHECK-NEXT: mov z1.d, x8 140; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 141; CHECK-NEXT: ret 142entry: 143 %in = sext i16 %src to i64 144 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0 145 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer 146 %out = mul nsw <vscale x 2 x i64> %broadcast.splat, %b 147 ret <vscale x 2 x i64> %out 148} 149 150define <vscale x 2 x i64> @dupsext_v2i32_v2i64(i32 %src, <vscale x 2 x i64> %b) { 151; CHECK-LABEL: dupsext_v2i32_v2i64: 152; CHECK: // %bb.0: // %entry 153; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 154; CHECK-NEXT: sxtw x8, w0 155; CHECK-NEXT: ptrue p0.d 156; CHECK-NEXT: mov z1.d, x8 157; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 158; CHECK-NEXT: ret 159entry: 160 %in = sext i32 %src to i64 161 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0 162 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer 163 %out = mul nsw <vscale x 2 x i64> %broadcast.splat, %b 164 ret <vscale x 2 x i64> %out 165} 166 167define <vscale x 2 x i16> @dupzext_v2i8_v2i16(i8 %src, <vscale x 2 x i16> %b) { 168; CHECK-LABEL: dupzext_v2i8_v2i16: 169; CHECK: // %bb.0: // %entry 170; CHECK-NEXT: and w8, w0, #0xff 171; CHECK-NEXT: ptrue p0.d 172; CHECK-NEXT: mov z1.d, x8 173; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 174; CHECK-NEXT: ret 175entry: 176 %in = zext i8 %src to i16 177 %broadcast.splatinsert = insertelement <vscale x 2 x i16> undef, i16 %in, i16 0 178 %broadcast.splat = shufflevector <vscale x 2 x i16> %broadcast.splatinsert, <vscale x 2 x i16> undef, <vscale x 2 x i32> zeroinitializer 179 %out = mul nuw <vscale x 2 x i16> %broadcast.splat, %b 180 ret <vscale x 2 x i16> %out 181} 182 183define <vscale x 4 x i16> @dupzext_v4i8_v4i16(i8 %src, <vscale x 4 x i16> %b) { 184; CHECK-LABEL: dupzext_v4i8_v4i16: 185; CHECK: // %bb.0: // %entry 186; CHECK-NEXT: and w8, w0, #0xff 187; CHECK-NEXT: ptrue p0.s 188; CHECK-NEXT: mov z1.s, w8 189; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s 190; CHECK-NEXT: ret 191entry: 192 %in = zext i8 %src to i16 193 %broadcast.splatinsert = insertelement <vscale x 4 x i16> undef, i16 %in, i16 0 194 %broadcast.splat = shufflevector <vscale x 4 x i16> %broadcast.splatinsert, <vscale x 4 x i16> undef, <vscale x 4 x i32> zeroinitializer 195 %out = mul nuw <vscale x 4 x i16> %broadcast.splat, %b 196 ret <vscale x 4 x i16> %out 197} 198 199define <vscale x 8 x i16> @dupzext_v8i8_v8i16(i8 %src, <vscale x 8 x i16> %b) { 200; CHECK-LABEL: dupzext_v8i8_v8i16: 201; CHECK: // %bb.0: // %entry 202; CHECK-NEXT: and w8, w0, #0xff 203; CHECK-NEXT: ptrue p0.h 204; CHECK-NEXT: mov z1.h, w8 205; CHECK-NEXT: mul z0.h, p0/m, z0.h, z1.h 206; CHECK-NEXT: ret 207entry: 208 %in = zext i8 %src to i16 209 %broadcast.splatinsert = insertelement <vscale x 8 x i16> undef, i16 %in, i16 0 210 %broadcast.splat = shufflevector <vscale x 8 x i16> %broadcast.splatinsert, <vscale x 8 x i16> undef, <vscale x 8 x i32> zeroinitializer 211 %out = mul nuw <vscale x 8 x i16> %broadcast.splat, %b 212 ret <vscale x 8 x i16> %out 213} 214 215define <vscale x 2 x i32> @dupzext_v2i8_v2i32(i8 %src, <vscale x 2 x i32> %b) { 216; CHECK-LABEL: dupzext_v2i8_v2i32: 217; CHECK: // %bb.0: // %entry 218; CHECK-NEXT: and w8, w0, #0xff 219; CHECK-NEXT: ptrue p0.d 220; CHECK-NEXT: mov z1.d, x8 221; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 222; CHECK-NEXT: ret 223entry: 224 %in = zext i8 %src to i32 225 %broadcast.splatinsert = insertelement <vscale x 2 x i32> undef, i32 %in, i32 0 226 %broadcast.splat = shufflevector <vscale x 2 x i32> %broadcast.splatinsert, <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer 227 %out = mul nuw <vscale x 2 x i32> %broadcast.splat, %b 228 ret <vscale x 2 x i32> %out 229} 230 231define <vscale x 4 x i32> @dupzext_v4i8_v4i32(i8 %src, <vscale x 4 x i32> %b) { 232; CHECK-LABEL: dupzext_v4i8_v4i32: 233; CHECK: // %bb.0: // %entry 234; CHECK-NEXT: and w8, w0, #0xff 235; CHECK-NEXT: ptrue p0.s 236; CHECK-NEXT: mov z1.s, w8 237; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s 238; CHECK-NEXT: ret 239entry: 240 %in = zext i8 %src to i32 241 %broadcast.splatinsert = insertelement <vscale x 4 x i32> undef, i32 %in, i32 0 242 %broadcast.splat = shufflevector <vscale x 4 x i32> %broadcast.splatinsert, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer 243 %out = mul nuw <vscale x 4 x i32> %broadcast.splat, %b 244 ret <vscale x 4 x i32> %out 245} 246 247define <vscale x 2 x i64> @dupzext_v2i8_v2i64(i8 %src, <vscale x 2 x i64> %b) { 248; CHECK-LABEL: dupzext_v2i8_v2i64: 249; CHECK: // %bb.0: // %entry 250; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 251; CHECK-NEXT: and x8, x0, #0xff 252; CHECK-NEXT: ptrue p0.d 253; CHECK-NEXT: mov z1.d, x8 254; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 255; CHECK-NEXT: ret 256entry: 257 %in = zext i8 %src to i64 258 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0 259 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer 260 %out = mul nuw <vscale x 2 x i64> %broadcast.splat, %b 261 ret <vscale x 2 x i64> %out 262} 263 264define <vscale x 2 x i32> @dupzext_v2i16_v2i32(i16 %src, <vscale x 2 x i32> %b) { 265; CHECK-LABEL: dupzext_v2i16_v2i32: 266; CHECK: // %bb.0: // %entry 267; CHECK-NEXT: and w8, w0, #0xffff 268; CHECK-NEXT: ptrue p0.d 269; CHECK-NEXT: mov z1.d, x8 270; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 271; CHECK-NEXT: ret 272entry: 273 %in = zext i16 %src to i32 274 %broadcast.splatinsert = insertelement <vscale x 2 x i32> undef, i32 %in, i32 0 275 %broadcast.splat = shufflevector <vscale x 2 x i32> %broadcast.splatinsert, <vscale x 2 x i32> undef, <vscale x 2 x i32> zeroinitializer 276 %out = mul nuw <vscale x 2 x i32> %broadcast.splat, %b 277 ret <vscale x 2 x i32> %out 278} 279 280define <vscale x 4 x i32> @dupzext_v4i16_v4i32(i16 %src, <vscale x 4 x i32> %b) { 281; CHECK-LABEL: dupzext_v4i16_v4i32: 282; CHECK: // %bb.0: // %entry 283; CHECK-NEXT: and w8, w0, #0xffff 284; CHECK-NEXT: ptrue p0.s 285; CHECK-NEXT: mov z1.s, w8 286; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s 287; CHECK-NEXT: ret 288entry: 289 %in = zext i16 %src to i32 290 %broadcast.splatinsert = insertelement <vscale x 4 x i32> undef, i32 %in, i32 0 291 %broadcast.splat = shufflevector <vscale x 4 x i32> %broadcast.splatinsert, <vscale x 4 x i32> undef, <vscale x 4 x i32> zeroinitializer 292 %out = mul nuw <vscale x 4 x i32> %broadcast.splat, %b 293 ret <vscale x 4 x i32> %out 294} 295 296define <vscale x 2 x i64> @dupzext_v2i16_v2i64(i16 %src, <vscale x 2 x i64> %b) { 297; CHECK-LABEL: dupzext_v2i16_v2i64: 298; CHECK: // %bb.0: // %entry 299; CHECK-NEXT: // kill: def $w0 killed $w0 def $x0 300; CHECK-NEXT: and x8, x0, #0xffff 301; CHECK-NEXT: ptrue p0.d 302; CHECK-NEXT: mov z1.d, x8 303; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 304; CHECK-NEXT: ret 305entry: 306 %in = zext i16 %src to i64 307 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0 308 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer 309 %out = mul nuw <vscale x 2 x i64> %broadcast.splat, %b 310 ret <vscale x 2 x i64> %out 311} 312 313define <vscale x 2 x i64> @dupzext_v2i32_v2i64(i32 %src, <vscale x 2 x i64> %b) { 314; CHECK-LABEL: dupzext_v2i32_v2i64: 315; CHECK: // %bb.0: // %entry 316; CHECK-NEXT: mov w8, w0 317; CHECK-NEXT: ptrue p0.d 318; CHECK-NEXT: mov z1.d, x8 319; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d 320; CHECK-NEXT: ret 321entry: 322 %in = zext i32 %src to i64 323 %broadcast.splatinsert = insertelement <vscale x 2 x i64> undef, i64 %in, i64 0 324 %broadcast.splat = shufflevector <vscale x 2 x i64> %broadcast.splatinsert, <vscale x 2 x i64> undef, <vscale x 2 x i32> zeroinitializer 325 %out = mul nuw <vscale x 2 x i64> %broadcast.splat, %b 326 ret <vscale x 2 x i64> %out 327} 328