Index: llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td =================================================================== --- llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td +++ llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td @@ -407,6 +407,9 @@ [(int_aarch64_sve_sub node:$pred, node:$op1, node:$op2), (vselect node:$pred, (sub node:$op1, node:$op2), node:$op1), (sub node:$op1, (vselect node:$pred, node:$op2, (SVEDup0)))]>; +def AArch64mul_m1 : PatFrags<(ops node:$pred, node:$op1, node:$op2), + [(int_aarch64_sve_mul node:$pred, node:$op1, node:$op2), + (vselect node:$pred, (AArch64mul_p (AArch64ptrue 31), node:$op1, node:$op2), node:$op1)]>; def AArch64mla_m1 : PatFrags<(ops node:$pred, node:$op1, node:$op2, node:$op3), [(int_aarch64_sve_mla node:$pred, node:$op1, node:$op2, node:$op3), // add(a, select(mask, mul(b, c), splat(0))) -> mla(a, mask, b, c) @@ -529,7 +532,7 @@ defm UMIN_ZI : sve_int_arith_imm1_unsigned<0b11, "umin", AArch64umin_p>; defm MUL_ZI : sve_int_arith_imm2<"mul", AArch64mul_p>; - defm MUL_ZPmZ : sve_int_bin_pred_arit_2<0b000, "mul", "MUL_ZPZZ", int_aarch64_sve_mul, DestructiveBinaryComm>; + defm MUL_ZPmZ : sve_int_bin_pred_arit_2<0b000, "mul", "MUL_ZPZZ", AArch64mul_m1, DestructiveBinaryComm>; defm SMULH_ZPmZ : sve_int_bin_pred_arit_2<0b010, "smulh", "SMULH_ZPZZ", int_aarch64_sve_smulh, DestructiveBinaryComm>; defm UMULH_ZPmZ : sve_int_bin_pred_arit_2<0b011, "umulh", "UMULH_ZPZZ", int_aarch64_sve_umulh, DestructiveBinaryComm>; Index: llvm/test/CodeGen/AArch64/sve-pred-selectop2.ll =================================================================== --- llvm/test/CodeGen/AArch64/sve-pred-selectop2.ll +++ llvm/test/CodeGen/AArch64/sve-pred-selectop2.ll @@ -117,9 +117,8 @@ ; CHECK-LABEL: mul_nxv2i64_x: ; CHECK: // %bb.0: // %entry ; CHECK-NEXT: ptrue p0.d -; CHECK-NEXT: mul z1.d, z0.d, z1.d ; CHECK-NEXT: cmpgt p0.d, p0/z, z2.d, #0 -; CHECK-NEXT: mov z0.d, p0/m, z1.d +; CHECK-NEXT: mul z0.d, p0/m, z0.d, z1.d ; CHECK-NEXT: ret entry: %c = icmp sgt %n, zeroinitializer @@ -132,9 +131,8 @@ ; CHECK-LABEL: mul_nxv4i32_x: ; CHECK: // %bb.0: // %entry ; CHECK-NEXT: ptrue p0.s -; CHECK-NEXT: mul z1.s, z0.s, z1.s ; CHECK-NEXT: cmpgt p0.s, p0/z, z2.s, #0 -; CHECK-NEXT: mov z0.s, p0/m, z1.s +; CHECK-NEXT: mul z0.s, p0/m, z0.s, z1.s ; CHECK-NEXT: ret entry: %c = icmp sgt %n, zeroinitializer @@ -147,9 +145,8 @@ ; CHECK-LABEL: mul_nxv8i16_x: ; CHECK: // %bb.0: // %entry ; CHECK-NEXT: ptrue p0.h -; CHECK-NEXT: mul z1.h, z0.h, z1.h ; CHECK-NEXT: cmpgt p0.h, p0/z, z2.h, #0 -; CHECK-NEXT: mov z0.h, p0/m, z1.h +; CHECK-NEXT: mul z0.h, p0/m, z0.h, z1.h ; CHECK-NEXT: ret entry: %c = icmp sgt %n, zeroinitializer @@ -162,9 +159,8 @@ ; CHECK-LABEL: mul_nxv16i8_x: ; CHECK: // %bb.0: // %entry ; CHECK-NEXT: ptrue p0.b -; CHECK-NEXT: mul z1.b, z0.b, z1.b ; CHECK-NEXT: cmpgt p0.b, p0/z, z2.b, #0 -; CHECK-NEXT: mov z0.b, p0/m, z1.b +; CHECK-NEXT: mul z0.b, p0/m, z0.b, z1.b ; CHECK-NEXT: ret entry: %c = icmp sgt %n, zeroinitializer