Skip to content

Commit 66e1d2c

Browse files
[NFC][LLVM][SVE] Simplify isel for BSL and NBSL. (#90233)
1 parent 34c89ef commit 66e1d2c

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,6 @@ def AArch64vsli : SDNode<"AArch64ISD::VSLI", SDT_AArch64vshiftinsert>;
746746
def AArch64vsri : SDNode<"AArch64ISD::VSRI", SDT_AArch64vshiftinsert>;
747747

748748
def AArch64bsp: SDNode<"AArch64ISD::BSP", SDT_AArch64trivec>;
749-
def AArch64nbsl: PatFrag<(ops node:$Op1, node:$Op2, node:$Op3),
750-
(vnot (AArch64bsp node:$Op1, node:$Op2, node:$Op3))>;
751749

752750
def AArch64cmeq: SDNode<"AArch64ISD::CMEQ", SDT_AArch64binvec>;
753751
def AArch64cmge: SDNode<"AArch64ISD::CMGE", SDT_AArch64binvec>;

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,16 @@ def AArch64smulh : PatFrag<(ops node:$op1, node:$op2),
508508
def AArch64umulh : PatFrag<(ops node:$op1, node:$op2),
509509
(AArch64umulh_p (SVEAnyPredicate), node:$op1, node:$op2)>;
510510

511+
512+
def AArch64bsl : PatFrags<(ops node:$Op1, node:$Op2, node:$Op3),
513+
[(int_aarch64_sve_bsl node:$Op1, node:$Op2, node:$Op3),
514+
(AArch64bsp node:$Op3, node:$Op1, node:$Op2)]>;
515+
516+
def AArch64nbsl : PatFrags<(ops node:$Op1, node:$Op2, node:$Op3),
517+
[(int_aarch64_sve_nbsl node:$Op1, node:$Op2, node:$Op3),
518+
(vnot (AArch64bsp node:$Op3, node:$Op1, node:$Op2))]>;
519+
520+
511521
let Predicates = [HasSVE] in {
512522
def RDFFR_PPz : sve_int_rdffr_pred<0b0, "rdffr", int_aarch64_sve_rdffr_z>;
513523
def RDFFRS_PPz : sve_int_rdffr_pred<0b1, "rdffrs">;
@@ -3757,10 +3767,10 @@ let Predicates = [HasSVE2orSME] in {
37573767
// SVE2 bitwise ternary operations
37583768
defm EOR3_ZZZZ : sve2_int_bitwise_ternary_op<0b000, "eor3", AArch64eor3>;
37593769
defm BCAX_ZZZZ : sve2_int_bitwise_ternary_op<0b010, "bcax", AArch64bcax>;
3760-
defm BSL_ZZZZ : sve2_int_bitwise_ternary_op<0b001, "bsl", int_aarch64_sve_bsl, AArch64bsp>;
3770+
defm BSL_ZZZZ : sve2_int_bitwise_ternary_op<0b001, "bsl", AArch64bsl>;
37613771
defm BSL1N_ZZZZ : sve2_int_bitwise_ternary_op<0b011, "bsl1n", int_aarch64_sve_bsl1n>;
37623772
defm BSL2N_ZZZZ : sve2_int_bitwise_ternary_op<0b101, "bsl2n", int_aarch64_sve_bsl2n>;
3763-
defm NBSL_ZZZZ : sve2_int_bitwise_ternary_op<0b111, "nbsl", int_aarch64_sve_nbsl, AArch64nbsl>;
3773+
defm NBSL_ZZZZ : sve2_int_bitwise_ternary_op<0b111, "nbsl", AArch64nbsl>;
37643774

37653775
// SVE2 bitwise xor and rotate right by immediate
37663776
defm XAR_ZZZI : sve2_int_rotate_right_imm<"xar", int_aarch64_sve_xar>;

llvm/lib/Target/AArch64/SVEInstrFormats.td

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,6 @@ class SVE_2_Op_Fp_Imm_Pat_Zero<ValueType vt, SDPatternOperator op,
605605
(vt (splat_vector (it immL))))),
606606
(inst $Pg, $Zs1, imm)>;
607607

608-
// Used to re-order the operands of BSP when lowering to BSL. BSP has the order:
609-
// mask, in1, in2 whereas BSL for SVE2 has them ordered in1, in2, mask
610-
class SVE_3_Op_BSP_Pat<ValueType vtd, SDPatternOperator op, ValueType vt1,
611-
ValueType vt2, ValueType vt3, Instruction inst>
612-
: Pat<(vtd (op vt1:$Op1, vt2:$Op2, vt3:$Op3)),
613-
(inst $Op2, $Op3, $Op1)>;
614-
615608
class SVE_Shift_Add_All_Active_Pat<ValueType vtd, SDPatternOperator op, ValueType pt,
616609
ValueType vt1, ValueType vt2, ValueType vt3,
617610
Instruction inst>
@@ -4922,8 +4915,8 @@ class sve2_int_bitwise_ternary_op_d<bits<3> opc, string asm>
49224915
let hasSideEffects = 0;
49234916
}
49244917

4925-
multiclass sve2_int_bitwise_ternary_op<bits<3> opc, string asm, SDPatternOperator op,
4926-
SDPatternOperator ir_op = null_frag> {
4918+
multiclass sve2_int_bitwise_ternary_op<bits<3> opc, string asm,
4919+
SDPatternOperator op> {
49274920
def NAME : sve2_int_bitwise_ternary_op_d<opc, asm>;
49284921

49294922
def : InstAlias<asm # "\t$Zdn, $Zdn, $Zm, $Zk",
@@ -4937,11 +4930,6 @@ multiclass sve2_int_bitwise_ternary_op<bits<3> opc, string asm, SDPatternOperato
49374930
def : SVE_3_Op_Pat<nxv8i16, op, nxv8i16, nxv8i16, nxv8i16, !cast<Instruction>(NAME)>;
49384931
def : SVE_3_Op_Pat<nxv4i32, op, nxv4i32, nxv4i32, nxv4i32, !cast<Instruction>(NAME)>;
49394932
def : SVE_3_Op_Pat<nxv2i64, op, nxv2i64, nxv2i64, nxv2i64, !cast<Instruction>(NAME)>;
4940-
4941-
def : SVE_3_Op_BSP_Pat<nxv16i8, ir_op, nxv16i8, nxv16i8, nxv16i8, !cast<Instruction>(NAME)>;
4942-
def : SVE_3_Op_BSP_Pat<nxv8i16, ir_op, nxv8i16, nxv8i16, nxv8i16, !cast<Instruction>(NAME)>;
4943-
def : SVE_3_Op_BSP_Pat<nxv4i32, ir_op, nxv4i32, nxv4i32, nxv4i32, !cast<Instruction>(NAME)>;
4944-
def : SVE_3_Op_BSP_Pat<nxv2i64, ir_op, nxv2i64, nxv2i64, nxv2i64, !cast<Instruction>(NAME)>;
49454933
}
49464934

49474935
class sve2_int_rotate_right_imm<bits<4> tsz8_64, string asm,

0 commit comments

Comments
 (0)