mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add SelectionDAG::getNOT method to construct bitwise NOT operations,
corresponding to the "not" and "vnot" PatFrags. Use the new method in some places where it seems appropriate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62768 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -6318,7 +6318,7 @@ SDValue SelectionDAGLegalize::ExpandBitCount(unsigned Opc, SDValue Op) {
|
||||
SDValue Tmp3 = DAG.getConstant(1ULL << i, ShVT);
|
||||
Op = DAG.getNode(ISD::OR, VT, Op, DAG.getNode(ISD::SRL, VT, Op, Tmp3));
|
||||
}
|
||||
Op = DAG.getNode(ISD::XOR, VT, Op, DAG.getConstant(~0ULL, VT));
|
||||
Op = DAG.getNOT(Op, VT);
|
||||
return DAG.getNode(ISD::CTPOP, VT, Op);
|
||||
}
|
||||
case ISD::CTTZ: {
|
||||
@@ -6327,9 +6327,7 @@ SDValue SelectionDAGLegalize::ExpandBitCount(unsigned Opc, SDValue Op) {
|
||||
// { return 32 - nlz(~x & (x-1)); }
|
||||
// see also http://www.hackersdelight.org/HDcode/ntz.cc
|
||||
MVT VT = Op.getValueType();
|
||||
SDValue Tmp2 = DAG.getConstant(~0ULL, VT);
|
||||
SDValue Tmp3 = DAG.getNode(ISD::AND, VT,
|
||||
DAG.getNode(ISD::XOR, VT, Op, Tmp2),
|
||||
SDValue Tmp3 = DAG.getNode(ISD::AND, VT, DAG.getNOT(Op, VT),
|
||||
DAG.getNode(ISD::SUB, VT, Op, DAG.getConstant(1, VT)));
|
||||
// If ISD::CTLZ is legal and CTPOP isn't, then do that instead.
|
||||
if (!TLI.isOperationLegal(ISD::CTPOP, VT) &&
|
||||
|
Reference in New Issue
Block a user