Skip to content

Commit 3c382ed

Browse files
[AArch64][SVE] Remove BIC from logical operation DestructiveBinaryComm patterns
This reverts part of https://reviews.llvm.org/D124224 that causes an assert because the register allocator triggers a pathological situation where there's no safe way to insert a zeroing MOVPFRX instruction.
1 parent 074abdc commit 3c382ed

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -339,20 +339,25 @@ let Predicates = [HasSVEorStreamingSVE] in {
339339
defm ADD_ZPmZ : sve_int_bin_pred_arit_0<0b000, "add", "ADD_ZPZZ", int_aarch64_sve_add, DestructiveBinaryComm>;
340340
defm SUB_ZPmZ : sve_int_bin_pred_arit_0<0b001, "sub", "SUB_ZPZZ", int_aarch64_sve_sub, DestructiveBinaryCommWithRev, "SUBR_ZPmZ">;
341341
defm SUBR_ZPmZ : sve_int_bin_pred_arit_0<0b011, "subr", "SUBR_ZPZZ", int_aarch64_sve_subr, DestructiveBinaryCommWithRev, "SUB_ZPmZ", /*isReverseInstr*/ 1>;
342+
343+
defm ORR_ZPmZ : sve_int_bin_pred_log<0b000, "orr", "ORR_ZPZZ", int_aarch64_sve_orr, DestructiveBinaryComm>;
344+
defm EOR_ZPmZ : sve_int_bin_pred_log<0b001, "eor", "EOR_ZPZZ", int_aarch64_sve_eor, DestructiveBinaryComm>;
345+
defm AND_ZPmZ : sve_int_bin_pred_log<0b010, "and", "AND_ZPZZ", int_aarch64_sve_and, DestructiveBinaryComm>;
346+
defm BIC_ZPmZ : sve_int_bin_pred_log<0b011, "bic", "BIC_ZPZZ", int_aarch64_sve_bic, DestructiveBinary>;
342347
} // End HasSVEorStreamingSVE
343348

344349
let Predicates = [HasSVEorStreamingSVE, UseExperimentalZeroingPseudos] in {
345350
defm ADD_ZPZZ : sve_int_bin_pred_zeroing_bhsd<int_aarch64_sve_add>;
346351
defm SUB_ZPZZ : sve_int_bin_pred_zeroing_bhsd<int_aarch64_sve_sub>;
347352
defm SUBR_ZPZZ : sve_int_bin_pred_zeroing_bhsd<int_aarch64_sve_subr>;
353+
354+
defm ORR_ZPZZ : sve_int_bin_pred_zeroing_bhsd<int_aarch64_sve_orr>;
355+
defm EOR_ZPZZ : sve_int_bin_pred_zeroing_bhsd<int_aarch64_sve_eor>;
356+
defm AND_ZPZZ : sve_int_bin_pred_zeroing_bhsd<int_aarch64_sve_and>;
357+
defm BIC_ZPZZ : sve_int_bin_pred_zeroing_bhsd<null_frag>;
348358
} // End HasSVEorStreamingSVE, UseExperimentalZeroingPseudos
349359

350360
let Predicates = [HasSVEorStreamingSVE] in {
351-
defm ORR_ZPmZ : sve_int_bin_pred_log<0b000, "orr", "ORR_ZPZZ", int_aarch64_sve_orr, DestructiveBinaryComm>;
352-
defm EOR_ZPmZ : sve_int_bin_pred_log<0b001, "eor", "EOR_ZPZZ", int_aarch64_sve_eor, DestructiveBinaryComm>;
353-
defm AND_ZPmZ : sve_int_bin_pred_log<0b010, "and", "AND_ZPZZ", int_aarch64_sve_and, DestructiveBinaryComm>;
354-
defm BIC_ZPmZ : sve_int_bin_pred_log<0b011, "bic", "BIC_ZPZZ", int_aarch64_sve_bic, DestructiveBinary>;
355-
356361
defm ADD_ZI : sve_int_arith_imm0<0b000, "add", add>;
357362
defm SUB_ZI : sve_int_arith_imm0<0b001, "sub", sub>;
358363
defm SUBR_ZI : sve_int_arith_imm0_subr<0b011, "subr", sub>;
@@ -463,11 +468,6 @@ let Predicates = [HasSVEorStreamingSVE] in {
463468
defm FMIN_ZPZI : sve_fp_2op_i_p_zds_hfd<sve_fpimm_zero_one, fpimm0, fpimm_one, AArch64fmin_p>;
464469

465470
let Predicates = [HasSVE, UseExperimentalZeroingPseudos] in {
466-
defm ORR_ZPZZ : sve_int_bin_pred_zeroing_bhsd<int_aarch64_sve_orr>;
467-
defm EOR_ZPZZ : sve_int_bin_pred_zeroing_bhsd<int_aarch64_sve_eor>;
468-
defm AND_ZPZZ : sve_int_bin_pred_zeroing_bhsd<int_aarch64_sve_and>;
469-
defm BIC_ZPZZ : sve_int_bin_pred_zeroing_bhsd<int_aarch64_sve_bic>;
470-
471471
defm FADD_ZPZI : sve_fp_2op_i_p_zds_zeroing_hfd<sve_fpimm_half_one, fpimm_half, fpimm_one, int_aarch64_sve_fadd>;
472472
defm FSUB_ZPZI : sve_fp_2op_i_p_zds_zeroing_hfd<sve_fpimm_half_one, fpimm_half, fpimm_one, int_aarch64_sve_fsub>;
473473
defm FMUL_ZPZI : sve_fp_2op_i_p_zds_zeroing_hfd<sve_fpimm_half_two, fpimm_half, fpimm_two, int_aarch64_sve_fmul>;

llvm/test/CodeGen/AArch64/sve-intrinsics-int-arith-merging.ll

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ define <vscale x 2 x i64> @and_i64_zero(<vscale x 2 x i1> %pg, <vscale x 2 x i64
344344
define <vscale x 16 x i8> @bic_i8_zero(<vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 16 x i8> %b) {
345345
; CHECK-LABEL: bic_i8_zero:
346346
; CHECK: // %bb.0:
347-
; CHECK-NEXT: movprfx z0.b, p0/z, z0.b
347+
; CHECK-NEXT: mov z2.b, #0 // =0x0
348+
; CHECK-NEXT: sel z0.b, p0, z0.b, z2.b
348349
; CHECK-NEXT: bic z0.b, p0/m, z0.b, z1.b
349350
; CHECK-NEXT: ret
350351
%a_z = select <vscale x 16 x i1> %pg, <vscale x 16 x i8> %a, <vscale x 16 x i8> zeroinitializer
@@ -357,7 +358,8 @@ define <vscale x 16 x i8> @bic_i8_zero(<vscale x 16 x i1> %pg, <vscale x 16 x i8
357358
define <vscale x 8 x i16> @bic_i16_zero(<vscale x 8 x i1> %pg, <vscale x 8 x i16> %a, <vscale x 8 x i16> %b) {
358359
; CHECK-LABEL: bic_i16_zero:
359360
; CHECK: // %bb.0:
360-
; CHECK-NEXT: movprfx z0.h, p0/z, z0.h
361+
; CHECK-NEXT: mov z2.h, #0 // =0x0
362+
; CHECK-NEXT: sel z0.h, p0, z0.h, z2.h
361363
; CHECK-NEXT: bic z0.h, p0/m, z0.h, z1.h
362364
; CHECK-NEXT: ret
363365
%a_z = select <vscale x 8 x i1> %pg, <vscale x 8 x i16> %a, <vscale x 8 x i16> zeroinitializer
@@ -370,7 +372,8 @@ define <vscale x 8 x i16> @bic_i16_zero(<vscale x 8 x i1> %pg, <vscale x 8 x i16
370372
define <vscale x 4 x i32> @bic_i32_zero(<vscale x 4 x i1> %pg, <vscale x 4 x i32> %a, <vscale x 4 x i32> %b) {
371373
; CHECK-LABEL: bic_i32_zero:
372374
; CHECK: // %bb.0:
373-
; CHECK-NEXT: movprfx z0.s, p0/z, z0.s
375+
; CHECK-NEXT: mov z2.s, #0 // =0x0
376+
; CHECK-NEXT: sel z0.s, p0, z0.s, z2.s
374377
; CHECK-NEXT: bic z0.s, p0/m, z0.s, z1.s
375378
; CHECK-NEXT: ret
376379
%a_z = select <vscale x 4 x i1> %pg, <vscale x 4 x i32> %a, <vscale x 4 x i32> zeroinitializer
@@ -383,7 +386,8 @@ define <vscale x 4 x i32> @bic_i32_zero(<vscale x 4 x i1> %pg, <vscale x 4 x i32
383386
define <vscale x 2 x i64> @bic_i64_zero(<vscale x 2 x i1> %pg, <vscale x 2 x i64> %a, <vscale x 2 x i64> %b) {
384387
; CHECK-LABEL: bic_i64_zero:
385388
; CHECK: // %bb.0:
386-
; CHECK-NEXT: movprfx z0.d, p0/z, z0.d
389+
; CHECK-NEXT: mov z2.d, #0 // =0x0
390+
; CHECK-NEXT: sel z0.d, p0, z0.d, z2.d
387391
; CHECK-NEXT: bic z0.d, p0/m, z0.d, z1.d
388392
; CHECK-NEXT: ret
389393
%a_z = select <vscale x 2 x i1> %pg, <vscale x 2 x i64> %a, <vscale x 2 x i64> zeroinitializer

0 commit comments

Comments
 (0)