Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2846,6 +2846,15 @@ bool X86::mayFoldIntoZeroExtend(SDValue Op) {
return false;
}

// Return true if its cheap to bitcast this to a vector type.
static bool mayFoldIntoVector(SDValue Op, const X86Subtarget &Subtarget) {
if (peekThroughBitcasts(Op).getValueType().isVector())
return true;
if (isa<ConstantSDNode>(Op) || isa<ConstantFPSDNode>(Op))
return true;
return X86::mayFoldLoad(Op, Subtarget);
}

static bool isLogicOp(unsigned Opcode) {
// TODO: Add support for X86ISD::FAND/FOR/FXOR/FANDN with test coverage.
return ISD::isBitwiseLogicOp(Opcode) || X86ISD::ANDNP == Opcode;
Expand Down Expand Up @@ -33958,7 +33967,7 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
EVT VT = N->getValueType(0);
assert(Subtarget.hasCDI() && "AVX512CD required");
assert((VT == MVT::i256 || VT == MVT::i512) && "Unexpected VT!");
if (VT == MVT::i256 && !X86::mayFoldLoad(N0, Subtarget))
if (VT == MVT::i256 && !mayFoldIntoVector(N0, Subtarget))
return;

unsigned SizeInBits = VT.getSizeInBits();
Expand Down
Loading
Loading