Skip to content

Commit 08c2f53

Browse files
committed
[DAG][X86] Add isNegatibleForFree/GetNegatedExpression override placeholders. NFCI.
Continuing to undo the rL372756 reversion. Differential Revision: https://reviews.llvm.org/D67557 llvm-svn: 374345
1 parent 55f1be0 commit 08c2f53

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41380,6 +41380,22 @@ static SDValue combineFneg(SDNode *N, SelectionDAG &DAG,
4138041380
return SDValue();
4138141381
}
4138241382

41383+
char X86TargetLowering::isNegatibleForFree(SDValue Op, SelectionDAG &DAG,
41384+
bool LegalOperations,
41385+
bool ForCodeSize,
41386+
unsigned Depth) const {
41387+
return TargetLowering::isNegatibleForFree(Op, DAG, LegalOperations,
41388+
ForCodeSize, Depth);
41389+
}
41390+
41391+
SDValue X86TargetLowering::getNegatedExpression(SDValue Op, SelectionDAG &DAG,
41392+
bool LegalOperations,
41393+
bool ForCodeSize,
41394+
unsigned Depth) const {
41395+
return TargetLowering::getNegatedExpression(Op, DAG, LegalOperations,
41396+
ForCodeSize, Depth);
41397+
}
41398+
4138341399
static SDValue lowerX86FPLogicOp(SDNode *N, SelectionDAG &DAG,
4138441400
const X86Subtarget &Subtarget) {
4138541401
MVT VT = N->getSimpleValueType(0);

llvm/lib/Target/X86/X86ISelLowering.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,17 @@ namespace llvm {
802802
/// and some i16 instructions are slow.
803803
bool IsDesirableToPromoteOp(SDValue Op, EVT &PVT) const override;
804804

805+
/// Return 1 if we can compute the negated form of the specified expression
806+
/// for the same cost as the expression itself, or 2 if we can compute the
807+
/// negated form more cheaply than the expression itself. Else return 0.
808+
char isNegatibleForFree(SDValue Op, SelectionDAG &DAG, bool LegalOperations,
809+
bool ForCodeSize, unsigned Depth) const override;
810+
811+
/// If isNegatibleForFree returns true, return the newly negated expression.
812+
SDValue getNegatedExpression(SDValue Op, SelectionDAG &DAG,
813+
bool LegalOperations, bool ForCodeSize,
814+
unsigned Depth) const override;
815+
805816
MachineBasicBlock *
806817
EmitInstrWithCustomInserter(MachineInstr &MI,
807818
MachineBasicBlock *MBB) const override;

0 commit comments

Comments
 (0)