Skip to content

Commit 0ed8aad

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 4354759 commit 0ed8aad

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
@@ -18140,13 +18140,13 @@ static SDValue performVecReduceAddCombineWithUADDLP(SDNode *N,
1814018140
static SDValue
1814118141
performActiveLaneMaskCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
1814218142
const AArch64Subtarget *ST) {
18143+
if (DCI.isBeforeLegalize())
18144+
return SDValue();
18145+
1814318146
if (SDValue While = optimizeIncrementingWhile(N, DCI.DAG, /*IsSigned=*/false,
1814418147
/*IsEqual=*/false))
1814518148
return While;
1814618149

18147-
if (DCI.isBeforeLegalize())
18148-
return SDValue();
18149-
1815018150
if (!ST->hasSVE2p1())
1815118151
return SDValue();
1815218152

@@ -29551,9 +29551,12 @@ AArch64TargetLowering::LowerGET_ACTIVE_LANE_MASK(SDValue Op,
2955129551
EVT VT = Op.getValueType();
2955229552
assert(VT.isFixedLengthVector() && "Expected fixed length vector type!");
2955329553

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

2955829561
SDLoc DL(Op);
2955929562
EVT ContainerVT = getContainerForFixedLengthVector(DAG, VT);

0 commit comments

Comments
 (0)