mirror of
https://github.com/danog/ir.git
synced 2025-01-22 05:31:32 +01:00
Fix 32-bit negation
This commit is contained in:
parent
32ad3d1052
commit
afc948def6
10
ir_x86.dasc
10
ir_x86.dasc
@ -7567,8 +7567,14 @@ void *ir_emit_code(ir_ctx *ctx, size_t *size_ptr)
|
||||
ir_reg op1_reg = ctx->regs[i][1];
|
||||
int32_t offset = ctx->ir_base[insn->op2].val.i32;
|
||||
|
||||
if (insn->op == IR_SUB) {
|
||||
offset = -offset;
|
||||
if (insn->op == IR_ADD) {
|
||||
offset = ctx->ir_base[insn->op2].val.i32;
|
||||
} else {
|
||||
IR_ASSERT(insn->op == IR_SUB);
|
||||
int64_t long_offset = ctx->ir_base[insn->op2].val.i64;
|
||||
long_offset = -long_offset;
|
||||
IR_ASSERT(IR_IS_SIGNED_32BIT(long_offset));
|
||||
offset = long_offset;
|
||||
}
|
||||
if (op1_reg & IR_REG_SPILL_LOAD) {
|
||||
op1_reg &= ~IR_REG_SPILL_LOAD;
|
||||
|
Loading…
x
Reference in New Issue
Block a user