From 9df010725faff9c0bf4dccd3bc45f871293d5d64 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 24 Aug 2010 14:08:16 -0700 Subject: 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 --- parser.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'parser.c') 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 */ -- cgit v1.2.3