summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-08-24 14:08:16 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-08-24 14:08:16 -0700
commit9df010725faff9c0bf4dccd3bc45f871293d5d64 (patch)
tree755a351a77b629a5f397c1eddf627e2546e1e82b /parser.c
parent47fb7bc088f4468053070795ac536d04c812b6df (diff)
downloadnasm-9df010725faff9c0bf4dccd3bc45f871293d5d64.tar.gz
nasm-9df010725faff9c0bf4dccd3bc45f871293d5d64.tar.bz2
nasm-9df010725faff9c0bf4dccd3bc45f871293d5d64.zip
Optimize mov r64,imm
Handle immediate-size optimization for "mov r64,imm" -- reduce it to "mov r32,imm32" or "mov r64,imm32" as appropriate. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/parser.c b/parser.c
index ea36e86..75bd344 100644
--- a/parser.c
+++ b/parser.c
@@ -843,7 +843,8 @@ is_expression:
if(optimizing >= 0 && !(result->oprs[operand].type & STRICT))
{
/* Be optimistic */
- result->oprs[operand].type |= SBYTE16 | SBYTE32 | SBYTE64;
+ result->oprs[operand].type |=
+ SBYTE16 | SBYTE32 | SBYTE64 | UDWORD64 | SDWORD64;
}
} else if (is_reloc(value)) { /* it's immediate */
result->oprs[operand].type |= IMMEDIATE;
@@ -865,6 +866,12 @@ is_expression:
result->oprs[operand].type |= SBYTE32;
if (v16 >= -128 && v16 <= 127)
result->oprs[operand].type |= SBYTE16;
+ if ((uint64_t)v64 <= UINT64_C(0xffffffff))
+ result->oprs[operand].type |= UDWORD64;
+ if (v64 >= -INT64_C(2147483648) &&
+ v64 <= INT64_C(2147483647))
+ result->oprs[operand].type |= SDWORD64;
+
}
}
} else { /* it's a register */