; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve2 < %s 2>%t | FileCheck %s ; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t ; If this check fails please read test/CodeGen/AArch64/README for instructions on how to resolve it. ; WARN-NOT: warning ; ; MUL with SPLAT ; define @mul_i16_imm( %a) { ; CHECK-LABEL: mul_i16_imm ; CHECK: mov w[[W:[0-9]+]], #255 ; CHECK-NEXT: mov z1.h, w[[W]] ; CHECK-NEXT: mul z0.h, z0.h, z1.h %elt = insertelement undef, i16 255, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = mul %a, %splat ret %res } define @mul_i16_imm_neg( %a) { ; CHECK-LABEL: mul_i16_imm_neg ; CHECK: mov w[[W:[0-9]+]], #-200 ; CHECK-NEXT: mov z1.h, w[[W]] ; CHECK-NEXT: mul z0.h, z0.h, z1.h %elt = insertelement undef, i16 -200, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = mul %a, %splat ret %res } define @mul_i32_imm( %a) { ; CHECK-LABEL: mul_i32_imm ; CHECK: mov w[[W:[0-9]+]], #255 ; CHECK-NEXT: mov z1.s, w[[W]] ; CHECK-NEXT: mul z0.s, z0.s, z1.s %elt = insertelement undef, i32 255, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = mul %a, %splat ret %res } define @mul_i32_imm_neg( %a) { ; CHECK-LABEL: mul_i32_imm_neg ; CHECK: mov w[[W:[0-9]+]], #-200 ; CHECK-NEXT: mov z1.s, w[[W]] ; CHECK-NEXT: mul z0.s, z0.s, z1.s %elt = insertelement undef, i32 -200, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = mul %a, %splat ret %res } define @mul_i64_imm( %a) { ; CHECK-LABEL: mul_i64_imm ; CHECK: mov w[[X:[0-9]+]], #255 ; CHECK-NEXT: z1.d, x[[X]] ; CHECK-NEXT: mul z0.d, z0.d, z1.d %elt = insertelement undef, i64 255, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = mul %a, %splat ret %res } define @mul_i64_imm_neg( %a) { ; CHECK-LABEL: mul_i64_imm_neg ; CHECK: mov x[[X:[0-9]+]], #-200 ; CHECK-NEXT: z1.d, x[[X]] ; CHECK-NEXT: mul z0.d, z0.d, z1.d %elt = insertelement undef, i64 -200, i32 0 %splat = shufflevector %elt, undef, zeroinitializer %res = mul %a, %splat ret %res } ; ; MUL (vector, unpredicated) ; define @mul_i8( %a, %b) { ; CHECK-LABEL: mul_i8 ; CHECK: mul z0.b, z0.b, z1.b ; CHECK-NEXT: ret %res = mul %a, %b ret %res } define @mul_i16( %a, %b) { ; CHECK-LABEL: mul_i16 ; CHECK: mul z0.h, z0.h, z1.h ; CHECK-NEXT: ret %res = mul %a, %b ret %res } define @mul_i32( %a, %b) { ; CHECK-LABEL: mul_i32 ; CHECK: mul z0.s, z0.s, z1.s ; CHECK-NEXT: ret %res = mul %a, %b ret %res } define @mul_i64( %a, %b) { ; CHECK-LABEL: mul_i64 ; CHECK: mul z0.d, z0.d, z1.d ; CHECK-NEXT: ret %res = mul %a, %b ret %res } ; ; SMULH (vector, unpredicated) ; define @smulh_i8( %a, %b) { ; CHECK-LABEL: smulh_i8 ; CHECK: smulh z0.b, z0.b, z1.b ; CHECK-NEXT: ret %sel = call @llvm.aarch64.sve.ptrue.nxv16i1(i32 31) %res = call @llvm.aarch64.sve.smulh.nxv16i8( %sel, %a, %b) ret %res } define @smulh_i16( %a, %b) { ; CHECK-LABEL: smulh_i16 ; CHECK: smulh z0.h, z0.h, z1.h ; CHECK-NEXT: ret %sel = call @llvm.aarch64.sve.ptrue.nxv8i1(i32 31) %res = call @llvm.aarch64.sve.smulh.nxv8i16( %sel, %a, %b) ret %res } define @smulh_i32( %a, %b) { ; CHECK-LABEL: smulh_i32 ; CHECK: smulh z0.s, z0.s, z1.s ; CHECK-NEXT: ret %sel = call @llvm.aarch64.sve.ptrue.nxv4i1(i32 31) %res = call @llvm.aarch64.sve.smulh.nxv4i32( %sel, %a, %b) ret %res } define @smulh_i64( %a, %b) { ; CHECK-LABEL: smulh_i64 ; CHECK: smulh z0.d, z0.d, z1.d ; CHECK-NEXT: ret %sel = call @llvm.aarch64.sve.ptrue.nxv2i1(i32 31) %res = call @llvm.aarch64.sve.smulh.nxv2i64( %sel, %a, %b) ret %res } ; ; UMULH (vector, unpredicated) ; define @umulh_i8( %a, %b) { ; CHECK-LABEL: umulh_i8 ; CHECK: umulh z0.b, z0.b, z1.b ; CHECK-NEXT: ret %sel = call @llvm.aarch64.sve.ptrue.nxv16i1(i32 31) %res = call @llvm.aarch64.sve.umulh.nxv16i8( %sel, %a, %b) ret %res } define @umulh_i16( %a, %b) { ; CHECK-LABEL: umulh_i16 ; CHECK: umulh z0.h, z0.h, z1.h ; CHECK-NEXT: ret %sel = call @llvm.aarch64.sve.ptrue.nxv8i1(i32 31) %res = call @llvm.aarch64.sve.umulh.nxv8i16( %sel, %a, %b) ret %res } define @umulh_i32( %a, %b) { ; CHECK-LABEL: umulh_i32 ; CHECK: umulh z0.s, z0.s, z1.s ; CHECK-NEXT: ret %sel = call @llvm.aarch64.sve.ptrue.nxv4i1(i32 31) %res = call @llvm.aarch64.sve.umulh.nxv4i32( %sel, %a, %b) ret %res } define @umulh_i64( %a, %b) { ; CHECK-LABEL: umulh_i64 ; CHECK: umulh z0.d, z0.d, z1.d ; CHECK-NEXT: ret %sel = call @llvm.aarch64.sve.ptrue.nxv2i1(i32 31) %res = call @llvm.aarch64.sve.umulh.nxv2i64( %sel, %a, %b) ret %res } ; ; PMUL (vector, unpredicated) ; define @pmul_i8( %a, %b) { ; CHECK-LABEL: pmul_i8 ; CHECK: pmul z0.b, z0.b, z1.b ; CHECK-NEXT: ret %res = call @llvm.aarch64.sve.pmul.nxv16i8( %a, %b) ret %res } ; ; SQDMULH (vector, unpredicated) ; define @sqdmulh_i8( %a, %b) { ; CHECK-LABEL: sqdmulh_i8 ; CHECK: sqdmulh z0.b, z0.b, z1.b ; CHECK-NEXT: ret %res = call @llvm.aarch64.sve.sqdmulh.nxv16i8( %a, %b) ret %res } define @sqdmulh_i16( %a, %b) { ; CHECK-LABEL: sqdmulh_i16 ; CHECK: sqdmulh z0.h, z0.h, z1.h ; CHECK-NEXT: ret %res = call @llvm.aarch64.sve.sqdmulh.nxv8i16( %a, %b) ret %res } define @sqdmulh_i32( %a, %b) { ; CHECK-LABEL: sqdmulh_i32 ; CHECK: sqdmulh z0.s, z0.s, z1.s ; CHECK-NEXT: ret %res = call @llvm.aarch64.sve.sqdmulh.nxv4i32( %a, %b) ret %res } define @sqdmulh_i64( %a, %b) { ; CHECK-LABEL: sqdmulh_i64 ; CHECK: sqdmulh z0.d, z0.d, z1.d ; CHECK-NEXT: ret %res = call @llvm.aarch64.sve.sqdmulh.nxv2i64( %a, %b) ret %res } ; ; SQRDMULH (vector, unpredicated) ; define @sqrdmulh_i8( %a, %b) { ; CHECK-LABEL: sqrdmulh_i8 ; CHECK: sqrdmulh z0.b, z0.b, z1.b ; CHECK-NEXT: ret %res = call @llvm.aarch64.sve.sqrdmulh.nxv16i8( %a, %b) ret %res } define @sqrdmulh_i16( %a, %b) { ; CHECK-LABEL: sqrdmulh_i16 ; CHECK: sqrdmulh z0.h, z0.h, z1.h ; CHECK-NEXT: ret %res = call @llvm.aarch64.sve.sqrdmulh.nxv8i16( %a, %b) ret %res } define @sqrdmulh_i32( %a, %b) { ; CHECK-LABEL: sqrdmulh_i32 ; CHECK: sqrdmulh z0.s, z0.s, z1.s ; CHECK-NEXT: ret %res = call @llvm.aarch64.sve.sqrdmulh.nxv4i32( %a, %b) ret %res } define @sqrdmulh_i64( %a, %b) { ; CHECK-LABEL: sqrdmulh_i64 ; CHECK: sqrdmulh z0.d, z0.d, z1.d ; CHECK-NEXT: ret %res = call @llvm.aarch64.sve.sqrdmulh.nxv2i64( %a, %b) ret %res } declare @llvm.aarch64.sve.ptrue.nxv16i1(i32) declare @llvm.aarch64.sve.ptrue.nxv8i1(i32) declare @llvm.aarch64.sve.ptrue.nxv4i1(i32) declare @llvm.aarch64.sve.ptrue.nxv2i1(i32) declare @llvm.aarch64.sve.smulh.nxv16i8(, , ) declare @llvm.aarch64.sve.smulh.nxv8i16(, , ) declare @llvm.aarch64.sve.smulh.nxv4i32(, , ) declare @llvm.aarch64.sve.smulh.nxv2i64(, , ) declare @llvm.aarch64.sve.umulh.nxv16i8(, , ) declare @llvm.aarch64.sve.umulh.nxv8i16(, , ) declare @llvm.aarch64.sve.umulh.nxv4i32(, , ) declare @llvm.aarch64.sve.umulh.nxv2i64(, , ) declare @llvm.aarch64.sve.pmul.nxv16i8(, ) declare @llvm.aarch64.sve.sqdmulh.nxv16i8(, ) declare @llvm.aarch64.sve.sqdmulh.nxv8i16(, ) declare @llvm.aarch64.sve.sqdmulh.nxv4i32(, ) declare @llvm.aarch64.sve.sqdmulh.nxv2i64(, ) declare @llvm.aarch64.sve.sqrdmulh.nxv16i8(, ) declare @llvm.aarch64.sve.sqrdmulh.nxv8i16(, ) declare @llvm.aarch64.sve.sqrdmulh.nxv4i32(, ) declare @llvm.aarch64.sve.sqrdmulh.nxv2i64(, )