forked from OSchip/llvm-project
[X86] X86::isConstantSplat - enable partial undef bit handling by default.
We currently only ever use this for lowering constant uniform values (shift/rotate by immediate) so we can safely enable it by default (it treats the undef bits as zero when extracting constants). This is necessary for an upcoming patch that will use SimplifyDemandedBits more aggressively on funnel shift amounts and causes regressions in vXi64 constant without it.
This commit is contained in:
parent
ac4609cb1d
commit
e43a085781
|
@ -6528,11 +6528,12 @@ static bool getTargetConstantBitsFromNode(SDValue Op, unsigned EltSizeInBits,
|
|||
|
||||
namespace llvm {
|
||||
namespace X86 {
|
||||
bool isConstantSplat(SDValue Op, APInt &SplatVal) {
|
||||
bool isConstantSplat(SDValue Op, APInt &SplatVal, bool AllowPartialUndefs) {
|
||||
APInt UndefElts;
|
||||
SmallVector<APInt, 16> EltBits;
|
||||
if (getTargetConstantBitsFromNode(Op, Op.getScalarValueSizeInBits(),
|
||||
UndefElts, EltBits, true, false)) {
|
||||
UndefElts, EltBits, true,
|
||||
AllowPartialUndefs)) {
|
||||
int SplatIndex = -1;
|
||||
for (int i = 0, e = EltBits.size(); i != e; ++i) {
|
||||
if (UndefElts[i])
|
||||
|
|
|
@ -722,7 +722,10 @@ namespace llvm {
|
|||
|
||||
/// If Op is a constant whose elements are all the same constant or
|
||||
/// undefined, return true and return the constant value in \p SplatVal.
|
||||
bool isConstantSplat(SDValue Op, APInt &SplatVal);
|
||||
/// If we have undef bits that don't cover an entire element, we treat these
|
||||
/// as zero if AllowPartialUndefs is set, else we fail and return false.
|
||||
bool isConstantSplat(SDValue Op, APInt &SplatVal,
|
||||
bool AllowPartialUndefs = true);
|
||||
} // end namespace X86
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue