Skip to content

Commit 0809761

Browse files
committed
Address nits
1 parent 24cec88 commit 0809761

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
@@ -20318,18 +20318,19 @@ The argument to this intrinsic must be a vector of floating-point values.
2031820318
Vector Partial Reduction Intrinsics
2031920319
-----------------------------------
2032020320

20321-
Partial reductions of vectors can be expressed using the following intrinsics.
20322-
Each one reduces the concatenation of the two vector arguments down to the
20323-
number of elements of the result vector type.
20321+
Partial reductions of vectors can be expressed using the intrinsics described in
20322+
this section. Each one reduces the concatenation of the two vector arguments
20323+
down to the number of elements of the result vector type.
2032420324

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

2033020330
The typical use case is loop vectorization where reductions are split into an
2033120331
in-loop phase, where maintaining an unordered vector result is important for
20332-
performance, and an out-of-loop phase to calculate the final scalar result.
20332+
performance, and an out-of-loop phase is required to calculate the final scalar
20333+
result.
2033320334

2033420335
By avoiding the introduction of new ordering constraints, these intrinsics
2033520336
enhance the ability to leverage a target's accumulation instructions.
@@ -20381,9 +20382,7 @@ Semantics:
2038120382

2038220383
As the way in which the arguments to this floating-point intrinsic are reduced
2038320384
is unspecified, this intrinsic will assume floating-point reassociation and
20384-
contraction, which may result in variations to the results due to reordering or
20385-
by lowering to different instructions (including combining multiple instructions
20386-
into a single one).
20385+
contraction, which may result in variations to the results.
2038720386

2038820387
'``llvm.vector.insert``' Intrinsic
2038920388
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

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

1209512089
unsigned Stride = AccVT.getVectorMinNumElements();
1209612090
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
@@ -2290,11 +2290,9 @@ void AArch64TargetLowering::addTypeForFixedLengthSVE(MVT VT) {
22902290
MVT::getVectorVT(MVT::i8, NumElts * 8), Custom);
22912291
}
22922292

2293-
if (Subtarget->hasSVE2p1()) {
2294-
if (VT.getVectorElementType() == MVT::f32)
2295-
setPartialReduceMLAAction(ISD::PARTIAL_REDUCE_FMLA, VT,
2296-
MVT::getVectorVT(MVT::f16, NumElts * 2),
2297-
Custom);
2293+
if (Subtarget->hasSVE2p1() && VT.getVectorElementType() == MVT::f32) {
2294+
setPartialReduceMLAAction(ISD::PARTIAL_REDUCE_FMLA, VT,
2295+
MVT::getVectorVT(MVT::f16, NumElts * 2), Custom);
22982296
}
22992297

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

0 commit comments

Comments
 (0)