Skip to content

Commit 1cf5105

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 b4a9650 commit 1cf5105

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);
@@ -22304,6 +22302,9 @@ static SDValue performIntrinsicCombine(SDNode *N,
2230422302
case Intrinsic::aarch64_sve_ptest_last:
2230522303
return getPTest(DAG, N->getValueType(0), N->getOperand(1), N->getOperand(2),
2230622304
AArch64CC::LAST_ACTIVE);
22305+
case Intrinsic::aarch64_sve_whilelo:
22306+
return DAG.getNode(ISD::GET_ACTIVE_LANE_MASK, SDLoc(N), N->getValueType(0),
22307+
N->getOperand(1), N->getOperand(2));
2230722308
}
2230822309
return SDValue();
2230922310
}

llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td

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

21362136
defm WHILELT_PWW : sve_int_while4_rr<0b010, "whilelt", int_aarch64_sve_whilelt, int_aarch64_sve_whilegt>;
21372137
defm WHILELE_PWW : sve_int_while4_rr<0b011, "whilele", int_aarch64_sve_whilele, null_frag>;
2138-
defm WHILELO_PWW : sve_int_while4_rr<0b110, "whilelo", int_aarch64_sve_whilelo, int_aarch64_sve_whilehi>;
2138+
defm WHILELO_PWW : sve_int_while4_rr<0b110, "whilelo", get_active_lane_mask, int_aarch64_sve_whilehi>;
21392139
defm WHILELS_PWW : sve_int_while4_rr<0b111, "whilels", int_aarch64_sve_whilels, null_frag>;
21402140

21412141
defm WHILELT_PXX : sve_int_while8_rr<0b010, "whilelt", int_aarch64_sve_whilelt, int_aarch64_sve_whilegt>;
21422142
defm WHILELE_PXX : sve_int_while8_rr<0b011, "whilele", int_aarch64_sve_whilele, null_frag>;
2143-
defm WHILELO_PXX : sve_int_while8_rr<0b110, "whilelo", int_aarch64_sve_whilelo, int_aarch64_sve_whilehi>;
2143+
defm WHILELO_PXX : sve_int_while8_rr<0b110, "whilelo", get_active_lane_mask, int_aarch64_sve_whilehi>;
21442144
defm WHILELS_PXX : sve_int_while8_rr<0b111, "whilels", int_aarch64_sve_whilels, null_frag>;
21452145

21462146
def CTERMEQ_WW : sve_int_cterm<0b0, 0b0, "ctermeq", GPR32>;
@@ -3449,24 +3449,6 @@ let Predicates = [HasSVE_or_SME] in {
34493449
def : Pat<(i64(find_last_active nxv2i1:$P1)), (LASTB_RPZ_D $P1, (INDEX_II_D 0,
34503450
1))>;
34513451

3452-
def : Pat<(nxv16i1(get_active_lane_mask i32:$index, i32:$tc)),
3453-
(WHILELO_PWW_B $index, $tc)>;
3454-
def : Pat<(nxv8i1(get_active_lane_mask i32:$index, i32:$tc)),
3455-
(WHILELO_PWW_H $index, $tc)>;
3456-
def : Pat<(nxv4i1(get_active_lane_mask i32:$index, i32:$tc)),
3457-
(WHILELO_PWW_S $index, $tc)>;
3458-
def : Pat<(nxv2i1(get_active_lane_mask i32:$index, i32:$tc)),
3459-
(WHILELO_PWW_D $index, $tc)>;
3460-
3461-
def : Pat<(nxv16i1(get_active_lane_mask i64:$index, i64:$tc)),
3462-
(WHILELO_PXX_B $index, $tc)>;
3463-
def : Pat<(nxv8i1(get_active_lane_mask i64:$index, i64:$tc)),
3464-
(WHILELO_PXX_H $index, $tc)>;
3465-
def : Pat<(nxv4i1(get_active_lane_mask i64:$index, i64:$tc)),
3466-
(WHILELO_PXX_S $index, $tc)>;
3467-
def : Pat<(nxv2i1(get_active_lane_mask i64:$index, i64:$tc)),
3468-
(WHILELO_PXX_D $index, $tc)>;
3469-
34703452
// Move element from the bottom 128-bits of a scalable vector to a single-element vector.
34713453
// Alternative case where insertelement is just scalar_to_vector rather than vector_insert.
34723454
def : Pat<(v1f64 (scalar_to_vector
@@ -4010,12 +3992,12 @@ let Predicates = [HasSVE2_or_SME] in {
40103992
defm WHILEGE_PWW : sve_int_while4_rr<0b000, "whilege", int_aarch64_sve_whilege, null_frag>;
40113993
defm WHILEGT_PWW : sve_int_while4_rr<0b001, "whilegt", int_aarch64_sve_whilegt, int_aarch64_sve_whilelt>;
40123994
defm WHILEHS_PWW : sve_int_while4_rr<0b100, "whilehs", int_aarch64_sve_whilehs, null_frag>;
4013-
defm WHILEHI_PWW : sve_int_while4_rr<0b101, "whilehi", int_aarch64_sve_whilehi, int_aarch64_sve_whilelo>;
3995+
defm WHILEHI_PWW : sve_int_while4_rr<0b101, "whilehi", int_aarch64_sve_whilehi, get_active_lane_mask>;
40143996

40153997
defm WHILEGE_PXX : sve_int_while8_rr<0b000, "whilege", int_aarch64_sve_whilege, null_frag>;
40163998
defm WHILEGT_PXX : sve_int_while8_rr<0b001, "whilegt", int_aarch64_sve_whilegt, int_aarch64_sve_whilelt>;
40173999
defm WHILEHS_PXX : sve_int_while8_rr<0b100, "whilehs", int_aarch64_sve_whilehs, null_frag>;
4018-
defm WHILEHI_PXX : sve_int_while8_rr<0b101, "whilehi", int_aarch64_sve_whilehi, int_aarch64_sve_whilelo>;
4000+
defm WHILEHI_PXX : sve_int_while8_rr<0b101, "whilehi", int_aarch64_sve_whilehi, get_active_lane_mask>;
40194001

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

0 commit comments

Comments
 (0)