@@ -1996,14 +1996,16 @@ X86TargetLowering::getPreferredVectorAction(MVT VT) const {
1996
1996
MVT X86TargetLowering::getRegisterTypeForCallingConv(LLVMContext &Context,
1997
1997
CallingConv::ID CC,
1998
1998
EVT VT) const {
1999
- // Break wide vXi1 vectors into scalars to match avx2 behavior.
1999
+ // v32i1 vectors should be promoted to v32i8 to match avx2.
2000
+ if (VT == MVT::v32i1 && Subtarget.hasAVX512() && !Subtarget.hasBWI())
2001
+ return MVT::v32i8;
2002
+ // Break wide or odd vXi1 vectors into scalars to match avx2 behavior.
2000
2003
if (VT.isVector() && VT.getVectorElementType() == MVT::i1 &&
2001
2004
Subtarget.hasAVX512() &&
2002
- ((VT.getVectorNumElements() > 32 && !Subtarget.hasBWI()) ||
2005
+ (!isPowerOf2_32(VT.getVectorNumElements()) ||
2006
+ (VT.getVectorNumElements() > 16 && !Subtarget.hasBWI()) ||
2003
2007
(VT.getVectorNumElements() > 64 && Subtarget.hasBWI())))
2004
2008
return MVT::i8;
2005
- if (VT == MVT::v32i1 && Subtarget.hasAVX512() && !Subtarget.hasBWI())
2006
- return MVT::v32i8;
2007
2009
// FIXME: Should we just make these types legal and custom split operations?
2008
2010
if ((VT == MVT::v32i16 || VT == MVT::v64i8) &&
2009
2011
Subtarget.hasAVX512() && !Subtarget.hasBWI() && !EnableOldKNLABI)
@@ -2014,14 +2016,16 @@ MVT X86TargetLowering::getRegisterTypeForCallingConv(LLVMContext &Context,
2014
2016
unsigned X86TargetLowering::getNumRegistersForCallingConv(LLVMContext &Context,
2015
2017
CallingConv::ID CC,
2016
2018
EVT VT) const {
2017
- // Break wide vXi1 vectors into scalars to match avx2 behavior.
2019
+ // v32i1 vectors should be promoted to v32i8 to match avx2.
2020
+ if (VT == MVT::v32i1 && Subtarget.hasAVX512() && !Subtarget.hasBWI())
2021
+ return 1;
2022
+ // Break wide or odd vXi1 vectors into scalars to match avx2 behavior.
2018
2023
if (VT.isVector() && VT.getVectorElementType() == MVT::i1 &&
2019
2024
Subtarget.hasAVX512() &&
2020
- ((VT.getVectorNumElements() > 32 && !Subtarget.hasBWI()) ||
2025
+ (!isPowerOf2_32(VT.getVectorNumElements()) ||
2026
+ (VT.getVectorNumElements() > 16 && !Subtarget.hasBWI()) ||
2021
2027
(VT.getVectorNumElements() > 64 && Subtarget.hasBWI())))
2022
2028
return VT.getVectorNumElements();
2023
- if (VT == MVT::v32i1 && Subtarget.hasAVX512() && !Subtarget.hasBWI())
2024
- return 1;
2025
2029
// FIXME: Should we just make these types legal and custom split operations?
2026
2030
if ((VT == MVT::v32i16 || VT == MVT::v64i8) &&
2027
2031
Subtarget.hasAVX512() && !Subtarget.hasBWI() && !EnableOldKNLABI)
@@ -2032,10 +2036,11 @@ unsigned X86TargetLowering::getNumRegistersForCallingConv(LLVMContext &Context,
2032
2036
unsigned X86TargetLowering::getVectorTypeBreakdownForCallingConv(
2033
2037
LLVMContext &Context, CallingConv::ID CC, EVT VT, EVT &IntermediateVT,
2034
2038
unsigned &NumIntermediates, MVT &RegisterVT) const {
2035
- // Break wide vXi1 vectors into scalars to match avx2 behavior.
2039
+ // Break wide or odd vXi1 vectors into scalars to match avx2 behavior.
2036
2040
if (VT.isVector() && VT.getVectorElementType() == MVT::i1 &&
2037
2041
Subtarget.hasAVX512() &&
2038
- ((VT.getVectorNumElements() > 32 && !Subtarget.hasBWI()) ||
2042
+ (!isPowerOf2_32(VT.getVectorNumElements()) ||
2043
+ (VT.getVectorNumElements() > 16 && !Subtarget.hasBWI()) ||
2039
2044
(VT.getVectorNumElements() > 64 && Subtarget.hasBWI()))) {
2040
2045
RegisterVT = MVT::i8;
2041
2046
IntermediateVT = MVT::i1;
0 commit comments