summaryrefslogtreecommitdiff
path: root/parser.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2009-11-01 10:24:48 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2009-11-01 10:24:48 +0300
commit210c10110bca124de4b9fb38d757ffc9b4041023 (patch)
tree69906c4abda2e4f3abfdbf19023021197600b4d0 /parser.c
parentbeaef4a2ea9fa1d73eb624af8931ce02c21303cf (diff)
downloadnasm-210c10110bca124de4b9fb38d757ffc9b4041023.tar.gz
Revert "BR 2887108: Use overflow_ helper to catch inappropriate imm optimization"
This reverts commit 41208028ff52d190044ee7532bf14c5aca0f899a. | | From: "H. Peter Anvin" <hpa@zytor.com> | | The tests for overflow_signed() are wrong too. Those are relevant for if a | warning should be issued, but not for how the value should be encoded in | the byte stream. | Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/parser.c b/parser.c
index 411d1717..ea36e86c 100644
--- a/parser.c
+++ b/parser.c
@@ -840,10 +840,11 @@ is_expression:
result->oprs[operand].segment = NO_SEG; /* don't care again */
result->oprs[operand].wrt = NO_SEG; /* still don't care */
- /* Be optimistic */
if(optimizing >= 0 && !(result->oprs[operand].type & STRICT))
+ {
+ /* Be optimistic */
result->oprs[operand].type |= SBYTE16 | SBYTE32 | SBYTE64;
-
+ }
} else if (is_reloc(value)) { /* it's immediate */
result->oprs[operand].type |= IMMEDIATE;
result->oprs[operand].offset = reloc_value(value);
@@ -858,14 +859,12 @@ is_expression:
int32_t v32 = (int32_t)v64;
int16_t v16 = (int16_t)v32;
- if (v64 >= -128 && v64 <= 127)
+ if (v64 >= -128 && v64 <= 127)
result->oprs[operand].type |= SBYTE64;
- if (!overflow_signed(v64, sizeof(v32)))
- if (v32 >= -128 && v32 <= 127)
- result->oprs[operand].type |= SBYTE32;
- if (!overflow_signed(v64, sizeof(v16)))
- if (v16 >= -128 && v16 <= 127)
- result->oprs[operand].type |= SBYTE16;
+ if (v32 >= -128 && v32 <= 127)
+ result->oprs[operand].type |= SBYTE32;
+ if (v16 >= -128 && v16 <= 127)
+ result->oprs[operand].type |= SBYTE16;
}
}
} else { /* it's a register */