Skip to content

Commit fa0eab1

Browse files
committed
Merge remote-tracking branch 'origin/main' into vplan-branch-on-false
2 parents ff89acf + 78eafb1 commit fa0eab1

File tree

5 files changed

+2687
-101
lines changed

5 files changed

+2687
-101
lines changed

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,6 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
901901
setOperationAction(ISD::FEXP, MVT::v2f64, Expand);
902902
setOperationAction(ISD::FEXP2, MVT::v2f64, Expand);
903903
setOperationAction(ISD::FEXP10, MVT::v2f64, Expand);
904-
// FIXME: Create unittest for FCEIL, FTRUNC, FRINT, FNEARBYINT, FFLOOR.
905904
setOperationAction(ISD::FCEIL, MVT::v2f64, Expand);
906905
setOperationAction(ISD::FTRUNC, MVT::v2f64, Expand);
907906
setOperationAction(ISD::FRINT, MVT::v2f64, Expand);
@@ -951,6 +950,12 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
951950
setOperationAction(ISD::FNEARBYINT, MVT::v2f32, Expand);
952951
setOperationAction(ISD::FFLOOR, MVT::v2f32, Expand);
953952

953+
for (ISD::NodeType Op : {ISD::FFLOOR, ISD::FNEARBYINT, ISD::FCEIL,
954+
ISD::FRINT, ISD::FTRUNC, ISD::FROUNDEVEN}) {
955+
setOperationAction(Op, MVT::v4f16, Expand);
956+
setOperationAction(Op, MVT::v8f16, Expand);
957+
}
958+
954959
// Neon does not support some operations on v1i64 and v2i64 types.
955960
setOperationAction(ISD::MUL, MVT::v1i64, Expand);
956961
// Custom handling for some quad-vector types to detect VMULL.

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,20 @@ class VPBlockBase {
320320
std::swap(Successors[0], Successors[1]);
321321
}
322322

323+
/// Returns the index for \p Pred in the blocks predecessors list.
324+
unsigned getIndexForPredecessor(const VPBlockBase *Pred) const {
325+
assert(count(Predecessors, Pred) == 1 &&
326+
"must have Pred exactly once in Predecessors");
327+
return std::distance(Predecessors.begin(), find(Predecessors, Pred));
328+
}
329+
330+
/// Returns the index for \p Succ in the blocks successor list.
331+
unsigned getIndexForSuccessor(const VPBlockBase *Succ) const {
332+
assert(count(Successors, Succ) == 1 &&
333+
"must have Succ exactly once in Successors");
334+
return std::distance(Successors.begin(), find(Successors, Succ));
335+
}
336+
323337
/// The method which generates the output IR that correspond to this
324338
/// VPBlockBase, thereby "executing" the VPlan.
325339
virtual void execute(VPTransformState *State) = 0;

llvm/lib/Transforms/Vectorize/VPlanUtils.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,8 @@ class VPBlockUtils {
232232
/// single edge between \p From and \p To.
233233
static void insertOnEdge(VPBlockBase *From, VPBlockBase *To,
234234
VPBlockBase *BlockPtr) {
235-
auto &Successors = From->getSuccessors();
236-
auto &Predecessors = To->getPredecessors();
237-
assert(count(Successors, To) == 1 && count(Predecessors, From) == 1 &&
238-
"must have single between From and To");
239-
unsigned SuccIdx = std::distance(Successors.begin(), find(Successors, To));
240-
unsigned PredIx =
241-
std::distance(Predecessors.begin(), find(Predecessors, From));
235+
unsigned SuccIdx = From->getIndexForSuccessor(To);
236+
unsigned PredIx = To->getIndexForPredecessor(From);
242237
VPBlockUtils::connectBlocks(From, BlockPtr, -1, SuccIdx);
243238
VPBlockUtils::connectBlocks(BlockPtr, To, PredIx, -1);
244239
}

0 commit comments

Comments
 (0)