Don't forego folding of loads into 64-bit adds when the other

operand is a signed 32-bit immediate. Unlike with the 8-bit
signed immediate case, it isn't actually smaller to fold a
32-bit signed immediate instead of a load. In fact, it's
larger in the case of 32-bit unsigned immediates, because
they can be materialized with movl instead of movq.

llvm-svn: 67001
This commit is contained in:
Dan Gohman 2009-03-14 02:07:16 +00:00
parent f24f26c75a
commit 2293eb6037
1 changed files with 3 additions and 10 deletions

View File

@ -319,16 +319,9 @@ bool X86DAGToDAGISel::IsLegalAndProfitableToFold(SDNode *N, SDNode *U,
// addl 4(%esp), %eax // addl 4(%esp), %eax
// The former is 2 bytes shorter. In case where the increment is 1, then // The former is 2 bytes shorter. In case where the increment is 1, then
// the saving can be 4 bytes (by using incl %eax). // the saving can be 4 bytes (by using incl %eax).
ConstantSDNode *Imm = dyn_cast<ConstantSDNode>(U->getOperand(1)); if (ConstantSDNode *Imm = dyn_cast<ConstantSDNode>(U->getOperand(1)))
if (Imm) { if (Imm->getAPIntValue().isSignedIntN(8))
if (U->getValueType(0) == MVT::i64) { return false;
if ((int32_t)Imm->getZExtValue() == (int64_t)Imm->getZExtValue())
return false;
} else {
if ((int8_t)Imm->getZExtValue() == (int64_t)Imm->getZExtValue())
return false;
}
}
} }
} }