diff options
| author | Michael Matz <matz@suse.de> | 2016-05-14 04:33:41 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-05-14 04:33:41 +0200 |
| commit | 4f27e217a864d8ddb74265d24a5aadea0a3ec92d (patch) | |
| tree | 44f89ca1a324c0152954e335a5c4c184a2ce757d /i386-asm.c | |
| parent | 080ec9faddc4b7661ab05159b07655ae0224ec58 (diff) | |
| download | tinycc-4f27e217a864d8ddb74265d24a5aadea0a3ec92d.tar.gz tinycc-4f27e217a864d8ddb74265d24a5aadea0a3ec92d.tar.bz2 | |
x86-asm: Fix signed constants and opcode order
Two things: negative constants were rejected (e.g. "add $-15,%eax").
Second the insn order was such that the arithmetic IM8S forms
weren't used (always the IM32 ones). Switching them prefers those
but requires a fix for size calculation in case the opcodes were
OPC_ARITH and OPC_WLX (whose size starts with 1, not zero).
Diffstat (limited to 'i386-asm.c')
| -rw-r--r-- | i386-asm.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -355,7 +355,7 @@ static void parse_operand(TCCState *s1, Operand *op) if (op->e.v == (uint16_t)op->e.v) op->type |= OP_IM16; #ifdef TCC_TARGET_X86_64 - if (op->e.v != (uint32_t)op->e.v) + if (op->e.v != (int32_t)op->e.v) op->type = OP_IM64; #endif } @@ -551,6 +551,8 @@ ST_FUNC void asm_opcode(TCCState *s1, int opcode) if (!(opcode >= pa->sym && opcode < pa->sym + 8*NBWLX)) continue; s = (opcode - pa->sym) % NBWLX; + if ((pa->instr_type & OPC_BWLX) == OPC_WLX) + s++; } else if (pa->instr_type & OPC_SHIFT) { if (!(opcode >= pa->sym && opcode < pa->sym + 7*NBWLX)) continue; |
