Skip to content

Commit d20d891

Browse files
- Move isBeforeLegalize before call to optimizeIncrementingWhile
- Add isSVEorStreamingSVEAvailable assert to LowerGET_ACTIVE_LANE_MASK - Added more details to the comment in ISDOpcodes.h
1 parent 1cf5105 commit d20d891

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

llvm/include/llvm/CodeGen/ISDOpcodes.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,10 +1524,13 @@ enum NodeType {
15241524
// Operands: Mask
15251525
VECTOR_FIND_LAST_ACTIVE,
15261526

1527-
// Creates a mask representing active and inactive
1528-
// vector lanes, active while base < trip count.
1529-
// Operands: Base, Trip Count
1530-
// Output: Mask
1527+
// GET_ACTIVE_LANE_MASK - this corrosponds to the llvm.get.active.lane.mask
1528+
// intrinsic. It creates a mask representing active and inactive vector
1529+
// lanes, active while Base + index < Trip Count. As with the intrinsic,
1530+
// the operands Base and Trip Count have the same scalar integer type and
1531+
// the internal addition of Base + index cannot overflow. However, the ISD
1532+
// node supports result types which are wider than i1, where the high
1533+
// bits conform to getBooleanContents similar to the SETCC operator.
15311534
GET_ACTIVE_LANE_MASK,
15321535

15331536
// llvm.clear_cache intrinsic

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18133,13 +18133,13 @@ static SDValue performVecReduceAddCombineWithUADDLP(SDNode *N,
1813318133
static SDValue
1813418134
performActiveLaneMaskCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
1813518135
const AArch64Subtarget *ST) {
18136+
if (DCI.isBeforeLegalize())
18137+
return SDValue();
18138+
1813618139
if (SDValue While = optimizeIncrementingWhile(N, DCI.DAG, /*IsSigned=*/false,
1813718140
/*IsEqual=*/false))
1813818141
return While;
1813918142

18140-
if (DCI.isBeforeLegalize())
18141-
return SDValue();
18142-
1814318143
if (!ST->hasSVE2p1())
1814418144
return SDValue();
1814518145

@@ -29515,9 +29515,12 @@ AArch64TargetLowering::LowerGET_ACTIVE_LANE_MASK(SDValue Op,
2951529515
EVT VT = Op.getValueType();
2951629516
assert(VT.isFixedLengthVector() && "Expected fixed length vector type!");
2951729517

29518-
// We can use the SVE whilelo instruction to lower this intrinsic by
29519-
// creating the appropriate sequence of scalable vector operations and
29520-
// then extracting a fixed-width subvector from the scalable vector.
29518+
auto &Subtarget = DAG.getSubtarget<AArch64Subtarget>();
29519+
assert(Subtarget.isSVEorStreamingSVEAvailable() &&
29520+
"Lowering fixed length get_active_lane_mask requires SVE!");
29521+
29522+
// There are no dedicated fixed-length instructions for GET_ACTIVE_LANE_MASK,
29523+
// but we can use SVE when available.
2952129524

2952229525
SDLoc DL(Op);
2952329526
EVT ContainerVT = getContainerForFixedLengthVector(DAG, VT);

0 commit comments

Comments
 (0)