Skip to content

Commit 4354759

Browse files
- Lower whilelo intrinsic to GET_ACTIVE_LANE_MASK in performIntrinsicCombine
- Remove the additional tablegen patterns matching get_active_lane_mask and reuse those for the whilelo intrinsic
1 parent aea9c5a commit 4354759

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ static bool isZeroingInactiveLanes(SDValue Op) {
290290
return false;
291291
// We guarantee i1 splat_vectors to zero the other lanes
292292
case ISD::SPLAT_VECTOR:
293+
case ISD::GET_ACTIVE_LANE_MASK:
293294
case AArch64ISD::PTRUE:
294295
case AArch64ISD::SETCC_MERGE_ZERO:
295296
return true;
@@ -6231,9 +6232,6 @@ SDValue AArch64TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
62316232
DAG.getNode(
62326233
AArch64ISD::URSHR_I, dl, Op.getOperand(1).getValueType(), Op.getOperand(1), Op.getOperand(2)));
62336234
return SDValue();
6234-
case Intrinsic::aarch64_sve_whilelo:
6235-
return optimizeIncrementingWhile(Op.getNode(), DAG, /*IsSigned=*/false,
6236-
/*IsEqual=*/false);
62376235
case Intrinsic::aarch64_sve_whilelt:
62386236
return optimizeIncrementingWhile(Op.getNode(), DAG, /*IsSigned=*/true,
62396237
/*IsEqual=*/false);
@@ -22335,6 +22333,9 @@ static SDValue performIntrinsicCombine(SDNode *N,
2233522333
case Intrinsic::aarch64_sve_ptest_last:
2233622334
return getPTest(DAG, N->getValueType(0), N->getOperand(1), N->getOperand(2),
2233722335
AArch64CC::LAST_ACTIVE);
22336+
case Intrinsic::aarch64_sve_whilelo:
22337+
return DAG.getNode(ISD::GET_ACTIVE_LANE_MASK, SDLoc(N), N->getValueType(0),
22338+
N->getOperand(1), N->getOperand(2));
2233822339
case Intrinsic::aarch64_sve_bsl:
2233922340
case Intrinsic::aarch64_sve_bsl1n:
2234022341
case Intrinsic::aarch64_sve_bsl2n:

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,12 +2141,12 @@ let Predicates = [HasSVE_or_SME] in {
21412141

21422142
defm WHILELT_PWW : sve_int_while4_rr<0b010, "whilelt", int_aarch64_sve_whilelt, int_aarch64_sve_whilegt>;
21432143
defm WHILELE_PWW : sve_int_while4_rr<0b011, "whilele", int_aarch64_sve_whilele, null_frag>;
2144-
defm WHILELO_PWW : sve_int_while4_rr<0b110, "whilelo", int_aarch64_sve_whilelo, int_aarch64_sve_whilehi>;
2144+
defm WHILELO_PWW : sve_int_while4_rr<0b110, "whilelo", get_active_lane_mask, int_aarch64_sve_whilehi>;
21452145
defm WHILELS_PWW : sve_int_while4_rr<0b111, "whilels", int_aarch64_sve_whilels, null_frag>;
21462146

21472147
defm WHILELT_PXX : sve_int_while8_rr<0b010, "whilelt", int_aarch64_sve_whilelt, int_aarch64_sve_whilegt>;
21482148
defm WHILELE_PXX : sve_int_while8_rr<0b011, "whilele", int_aarch64_sve_whilele, null_frag>;
2149-
defm WHILELO_PXX : sve_int_while8_rr<0b110, "whilelo", int_aarch64_sve_whilelo, int_aarch64_sve_whilehi>;
2149+
defm WHILELO_PXX : sve_int_while8_rr<0b110, "whilelo", get_active_lane_mask, int_aarch64_sve_whilehi>;
21502150
defm WHILELS_PXX : sve_int_while8_rr<0b111, "whilels", int_aarch64_sve_whilels, null_frag>;
21512151

21522152
def CTERMEQ_WW : sve_int_cterm<0b0, 0b0, "ctermeq", GPR32>;
@@ -3455,24 +3455,6 @@ let Predicates = [HasSVE_or_SME] in {
34553455
def : Pat<(i64(find_last_active nxv2i1:$P1)), (LASTB_RPZ_D $P1, (INDEX_II_D 0,
34563456
1))>;
34573457

3458-
def : Pat<(nxv16i1(get_active_lane_mask i32:$index, i32:$tc)),
3459-
(WHILELO_PWW_B $index, $tc)>;
3460-
def : Pat<(nxv8i1(get_active_lane_mask i32:$index, i32:$tc)),
3461-
(WHILELO_PWW_H $index, $tc)>;
3462-
def : Pat<(nxv4i1(get_active_lane_mask i32:$index, i32:$tc)),
3463-
(WHILELO_PWW_S $index, $tc)>;
3464-
def : Pat<(nxv2i1(get_active_lane_mask i32:$index, i32:$tc)),
3465-
(WHILELO_PWW_D $index, $tc)>;
3466-
3467-
def : Pat<(nxv16i1(get_active_lane_mask i64:$index, i64:$tc)),
3468-
(WHILELO_PXX_B $index, $tc)>;
3469-
def : Pat<(nxv8i1(get_active_lane_mask i64:$index, i64:$tc)),
3470-
(WHILELO_PXX_H $index, $tc)>;
3471-
def : Pat<(nxv4i1(get_active_lane_mask i64:$index, i64:$tc)),
3472-
(WHILELO_PXX_S $index, $tc)>;
3473-
def : Pat<(nxv2i1(get_active_lane_mask i64:$index, i64:$tc)),
3474-
(WHILELO_PXX_D $index, $tc)>;
3475-
34763458
// Move element from the bottom 128-bits of a scalable vector to a single-element vector.
34773459
// Alternative case where insertelement is just scalar_to_vector rather than vector_insert.
34783460
def : Pat<(v1f64 (scalar_to_vector
@@ -4016,12 +3998,12 @@ let Predicates = [HasSVE2_or_SME] in {
40163998
defm WHILEGE_PWW : sve_int_while4_rr<0b000, "whilege", int_aarch64_sve_whilege, null_frag>;
40173999
defm WHILEGT_PWW : sve_int_while4_rr<0b001, "whilegt", int_aarch64_sve_whilegt, int_aarch64_sve_whilelt>;
40184000
defm WHILEHS_PWW : sve_int_while4_rr<0b100, "whilehs", int_aarch64_sve_whilehs, null_frag>;
4019-
defm WHILEHI_PWW : sve_int_while4_rr<0b101, "whilehi", int_aarch64_sve_whilehi, int_aarch64_sve_whilelo>;
4001+
defm WHILEHI_PWW : sve_int_while4_rr<0b101, "whilehi", int_aarch64_sve_whilehi, get_active_lane_mask>;
40204002

40214003
defm WHILEGE_PXX : sve_int_while8_rr<0b000, "whilege", int_aarch64_sve_whilege, null_frag>;
40224004
defm WHILEGT_PXX : sve_int_while8_rr<0b001, "whilegt", int_aarch64_sve_whilegt, int_aarch64_sve_whilelt>;
40234005
defm WHILEHS_PXX : sve_int_while8_rr<0b100, "whilehs", int_aarch64_sve_whilehs, null_frag>;
4024-
defm WHILEHI_PXX : sve_int_while8_rr<0b101, "whilehi", int_aarch64_sve_whilehi, int_aarch64_sve_whilelo>;
4006+
defm WHILEHI_PXX : sve_int_while8_rr<0b101, "whilehi", int_aarch64_sve_whilehi, get_active_lane_mask>;
40254007

40264008
// SVE2 pointer conflict compare
40274009
defm WHILEWR_PXX : sve2_int_while_rr<0b0, "whilewr", "int_aarch64_sve_whilewr">;

0 commit comments

Comments
 (0)