-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Hexagon] Handle Call Operand vxi1 in Hexagon without HVX Enabled #136546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,7 +155,84 @@ static bool CC_SkipOdd(unsigned &ValNo, MVT &ValVT, MVT &LocVT, | |
} | ||
|
||
#include "HexagonGenCallingConv.inc" | ||
unsigned HexagonTargetLowering::getVectorTypeBreakdownForCallingConv( | ||
LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT, | ||
unsigned &NumIntermediates, MVT &RegisterVT) const { | ||
|
||
RegisterVT = MVT::v8i8; | ||
IntermediateVT = MVT::v8i1; | ||
// Split vectors of type vXi1 into (X/8) vectors of type v8i1, | ||
// where X is divisible by 8. | ||
if (!Subtarget.useHVXOps()) { | ||
switch (VT.getSimpleVT().SimpleTy) { | ||
case MVT::v16i1: | ||
NumIntermediates = 2; | ||
return 2; | ||
case MVT::v32i1: | ||
NumIntermediates = 4; | ||
return 4; | ||
case MVT::v64i1: | ||
NumIntermediates = 8; | ||
return 8; | ||
case MVT::v128i1: | ||
NumIntermediates = 16; | ||
return 16; | ||
default: | ||
break; | ||
} | ||
} | ||
// Split v128i1 vectors into 2 v64i1 vectors in HVX 64-byte mode. | ||
if (VT == MVT::v128i1 && Subtarget.useHVX64BOps()) { | ||
RegisterVT = MVT::v64i8; | ||
IntermediateVT = MVT::v64i1; | ||
NumIntermediates = 2; | ||
return 2; | ||
} | ||
return TargetLowering::getVectorTypeBreakdownForCallingConv( | ||
Context, CC, VT, IntermediateVT, NumIntermediates, RegisterVT); | ||
} | ||
std::pair<MVT, unsigned> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty line before the start of the function |
||
HexagonTargetLowering::handleMaskRegisterForCallingConv( | ||
unsigned NumElts, CallingConv::ID CC, const HexagonSubtarget &Subtarget, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can get rid of |
||
EVT VT) const { | ||
|
||
unsigned NumIntermediates = 1; | ||
ElementCount EC = VT.getVectorElementCount(); | ||
// For vectors of type vXi1, where X is divisible by 8, | ||
// use Double registers when HVX is not enabled. | ||
if (VT.getVectorNumElements() >= 16 && !Subtarget.useHVXOps() && | ||
isPowerOf2_32(EC.getKnownMinValue())) { | ||
while (EC.getKnownMinValue() > 8) { | ||
EC = EC.divideCoefficientBy(2); | ||
|
||
NumIntermediates <<= 1; | ||
} | ||
Comment on lines
+203
to
+209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we don't need the loop here. Simplify to:
|
||
return {MVT::v8i8, NumIntermediates}; | ||
} | ||
// Split v128i1 vectors into 2 v64i1 vectors in HVX 64-byte mode. | ||
if (VT == MVT::v128i1 && Subtarget.useHVX64BOps()) { | ||
return {MVT::v64i8, 2}; | ||
} | ||
return {MVT::INVALID_SIMPLE_VALUE_TYPE, 0}; | ||
} | ||
|
||
MVT HexagonTargetLowering::getRegisterTypeForCallingConv(LLVMContext &Context, | ||
CallingConv::ID CC, | ||
EVT VT) const { | ||
if (VT.isVector()) { | ||
if (VT.getVectorElementType() == MVT::i1) { | ||
unsigned NumElts = VT.getVectorNumElements(); | ||
|
||
MVT RegisterVT; | ||
unsigned NumRegisters; | ||
std::tie(RegisterVT, NumRegisters) = | ||
handleMaskRegisterForCallingConv(NumElts, CC, Subtarget, VT); | ||
if (RegisterVT != MVT::INVALID_SIMPLE_VALUE_TYPE) | ||
return RegisterVT; | ||
} | ||
} | ||
return TargetLowering::getRegisterTypeForCallingConv(Context, CC, VT); | ||
} | ||
|
||
SDValue | ||
HexagonTargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can avoid the switch here and divide the element count by 8 here