mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Also match negative offsets for addrmode3 and addrmode5.
Math is hard, and isScaledConstantInRange() always returned false for negative constants. It was doing unsigned division of negative numbers before casting back to signed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140425 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -305,10 +305,10 @@ static bool isOpcWithIntImmediate(SDNode *N, unsigned Opc, unsigned& Imm) {
|
||||
/// (N * Scale) where (N in [\arg RangeMin, \arg RangeMax).
|
||||
///
|
||||
/// \param ScaledConstant [out] - On success, the pre-scaled constant value.
|
||||
static bool isScaledConstantInRange(SDValue Node, unsigned Scale,
|
||||
static bool isScaledConstantInRange(SDValue Node, int Scale,
|
||||
int RangeMin, int RangeMax,
|
||||
int &ScaledConstant) {
|
||||
assert(Scale && "Invalid scale!");
|
||||
assert(Scale > 0 && "Invalid scale!");
|
||||
|
||||
// Check that this is a constant.
|
||||
const ConstantSDNode *C = dyn_cast<ConstantSDNode>(Node);
|
||||
|
Reference in New Issue
Block a user