Skip to content

Commit b3c5076

Browse files
committed
Address nits
1 parent 023337b commit b3c5076

File tree

3 files changed

+19
-28
lines changed

3 files changed

+19
-28
lines changed

llvm/docs/LangRef.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20366,18 +20366,19 @@ The argument to this intrinsic must be a vector of floating-point values.
2036620366
Vector Partial Reduction Intrinsics
2036720367
-----------------------------------
2036820368

20369-
Partial reductions of vectors can be expressed using the following intrinsics.
20370-
Each one reduces the concatenation of the two vector arguments down to the
20371-
number of elements of the result vector type.
20369+
Partial reductions of vectors can be expressed using the intrinsics described in
20370+
this section. Each one reduces the concatenation of the two vector arguments
20371+
down to the number of elements of the result vector type.
2037220372

20373-
Other than the reduction operator (e.g. add, fadd) the way in which the
20373+
Other than the reduction operator (e.g. add, fadd), the way in which the
2037420374
concatenated arguments is reduced is entirely unspecified. By their nature these
20375-
intrinsics are not expected to be useful in isolation but instead implement the
20376-
first phase of an overall reduction operation.
20375+
intrinsics are not expected to be useful in isolation but can instead be used to
20376+
implement the first phase of an overall reduction operation.
2037720377

2037820378
The typical use case is loop vectorization where reductions are split into an
2037920379
in-loop phase, where maintaining an unordered vector result is important for
20380-
performance, and an out-of-loop phase to calculate the final scalar result.
20380+
performance, and an out-of-loop phase is required to calculate the final scalar
20381+
result.
2038120382

2038220383
By avoiding the introduction of new ordering constraints, these intrinsics
2038320384
enhance the ability to leverage a target's accumulation instructions.
@@ -20429,9 +20430,7 @@ Semantics:
2042920430

2043020431
As the way in which the arguments to this floating-point intrinsic are reduced
2043120432
is unspecified, this intrinsic will assume floating-point reassociation and
20432-
contraction, which may result in variations to the results due to reordering or
20433-
by lowering to different instructions (including combining multiple instructions
20434-
into a single one).
20433+
contraction, which may result in variations to the results.
2043520434

2043620435
'``llvm.vector.insert``' Intrinsic
2043720436
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12076,20 +12076,14 @@ SDValue TargetLowering::expandPartialReduceMLA(SDNode *N,
1207612076
}
1207712077
SDValue Input = MulLHS;
1207812078
APInt ConstantOne;
12079-
ConstantFPSDNode *C;
12080-
if (!(N->getOpcode() == ISD::PARTIAL_REDUCE_FMLA &&
12081-
(C = llvm::isConstOrConstSplatFP(MulRHS, false)) &&
12082-
C->isExactlyValue(1.0)) &&
12083-
!(ISD::isConstantSplatVector(MulRHS.getNode(), ConstantOne) &&
12084-
ConstantOne.isOne()))
12085-
switch (N->getOpcode()) {
12086-
case ISD::PARTIAL_REDUCE_FMLA:
12079+
if (N->getOpcode() == ISD::PARTIAL_REDUCE_FMLA) {
12080+
ConstantFPSDNode *C = llvm::isConstOrConstSplatFP(MulRHS, false);
12081+
if (!(C && C->isExactlyValue(1.0)))
1208712082
Input = DAG.getNode(ISD::FMUL, DL, ExtMulOpVT, MulLHS, MulRHS);
12088-
break;
12089-
default:
12090-
Input = DAG.getNode(ISD::MUL, DL, ExtMulOpVT, MulLHS, MulRHS);
12091-
break;
12092-
};
12083+
} else if (!(ISD::isConstantSplatVector(MulRHS.getNode(), ConstantOne) &&
12084+
ConstantOne.isOne())) {
12085+
Input = DAG.getNode(ISD::MUL, DL, ExtMulOpVT, MulLHS, MulRHS);
12086+
}
1209312087

1209412088
unsigned Stride = AccVT.getVectorMinNumElements();
1209512089
unsigned ScaleFactor = MulOpVT.getVectorMinNumElements() / Stride;

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2294,11 +2294,9 @@ void AArch64TargetLowering::addTypeForFixedLengthSVE(MVT VT) {
22942294
MVT::getVectorVT(MVT::i8, NumElts * 8), Custom);
22952295
}
22962296

2297-
if (Subtarget->hasSVE2p1()) {
2298-
if (VT.getVectorElementType() == MVT::f32)
2299-
setPartialReduceMLAAction(ISD::PARTIAL_REDUCE_FMLA, VT,
2300-
MVT::getVectorVT(MVT::f16, NumElts * 2),
2301-
Custom);
2297+
if (Subtarget->hasSVE2p1() && VT.getVectorElementType() == MVT::f32) {
2298+
setPartialReduceMLAAction(ISD::PARTIAL_REDUCE_FMLA, VT,
2299+
MVT::getVectorVT(MVT::f16, NumElts * 2), Custom);
23022300
}
23032301

23042302
// Lower fixed length vector operations to scalable equivalents.

0 commit comments

Comments
 (0)