mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Make sure to legalize generated ctpop nodes, convert tabs to spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21868 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
50d435f3a7
commit
5c33c9a166
@ -1134,15 +1134,15 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
||||
}
|
||||
case ISD::CTLZ: {
|
||||
/* for now, we do this:
|
||||
x = x | (x >> 1);
|
||||
x = x | (x >> 2);
|
||||
...
|
||||
x = x | (x >>16);
|
||||
x = x | (x >>32); // for 64-bit input
|
||||
return popcount(~x);
|
||||
x = x | (x >> 1);
|
||||
x = x | (x >> 2);
|
||||
...
|
||||
x = x | (x >>16);
|
||||
x = x | (x >>32); // for 64-bit input
|
||||
return popcount(~x);
|
||||
|
||||
but see also: http://www.hackersdelight.org/HDcode/nlz.cc */
|
||||
MVT::ValueType VT = Tmp1.getValueType();
|
||||
but see also: http://www.hackersdelight.org/HDcode/nlz.cc */
|
||||
MVT::ValueType VT = Tmp1.getValueType();
|
||||
MVT::ValueType ShVT = TLI.getShiftAmountTy();
|
||||
unsigned len = getSizeInBits(VT);
|
||||
for (unsigned i = 0; (1U << i) <= (len / 2); ++i) {
|
||||
@ -1151,19 +1151,19 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
|
||||
DAG.getNode(ISD::SRL, VT, Tmp1, Tmp3));
|
||||
}
|
||||
Tmp3 = DAG.getNode(ISD::XOR, VT, Tmp1, DAG.getConstant(~0ULL, VT));
|
||||
Result = DAG.getNode(ISD::CTPOP, VT, Tmp3);
|
||||
Result = LegalizeOp(DAG.getNode(ISD::CTPOP, VT, Tmp3));
|
||||
break;
|
||||
}
|
||||
case ISD::CTTZ: {
|
||||
// for now, we use: { return popcount(~x & (x - 1)); }
|
||||
// but see also http://www.hackersdelight.org/HDcode/ntz.cc )
|
||||
MVT::ValueType VT = Tmp1.getValueType();
|
||||
Tmp2 = DAG.getConstant(~0ULL, VT);
|
||||
Tmp3 = DAG.getNode(ISD::AND, VT,
|
||||
DAG.getNode(ISD::XOR, VT, Tmp1, Tmp2),
|
||||
DAG.getNode(ISD::SUB, VT, Tmp1,
|
||||
DAG.getConstant(1, VT)));
|
||||
Result = DAG.getNode(ISD::CTPOP, VT, Tmp3);
|
||||
// for now, we use: { return popcount(~x & (x - 1)); }
|
||||
// but see also http://www.hackersdelight.org/HDcode/ntz.cc
|
||||
MVT::ValueType VT = Tmp1.getValueType();
|
||||
Tmp2 = DAG.getConstant(~0ULL, VT);
|
||||
Tmp3 = DAG.getNode(ISD::AND, VT,
|
||||
DAG.getNode(ISD::XOR, VT, Tmp1, Tmp2),
|
||||
DAG.getNode(ISD::SUB, VT, Tmp1,
|
||||
DAG.getConstant(1, VT)));
|
||||
Result = LegalizeOp(DAG.getNode(ISD::CTPOP, VT, Tmp3));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user