@@ -52,10 +52,11 @@ IR_ALWAYS_INLINE ir_mem IR_MEM(ir_reg base, int32_t offset, ir_reg index, int32_
5252 return mem;
5353}
5454
55- #define IR_IS_SIGNED_32BIT(val) ((((intptr_t)(val)) <= 0x7fffffff) && (((intptr_t)(val)) >= (-2147483647 - 1)))
56- #define IR_IS_UNSIGNED_32BIT(val) (((uintptr_t)(val)) <= 0xffffffff)
57- #define IR_IS_32BIT(type, val) (IR_IS_TYPE_SIGNED(type) ? IR_IS_SIGNED_32BIT((val).i64) : IR_IS_UNSIGNED_32BIT((val).u64))
58- #define IR_IS_FP_ZERO(insn) ((insn.type == IR_DOUBLE) ? (insn.val.u64 == 0) : (insn.val.u32 == 0))
55+ #define IR_IS_SIGNED_32BIT(val) ((((intptr_t)(val)) <= 0x7fffffff) && (((intptr_t)(val)) >= (-2147483647 - 1)))
56+ #define IR_IS_SIGNED_NEG_32BIT(val) ((((intptr_t)(val)) <= 0x7fffffff) && (((intptr_t)(val)) >= -2147483647))
57+ #define IR_IS_UNSIGNED_32BIT(val) (((uintptr_t)(val)) <= 0xffffffff)
58+ #define IR_IS_32BIT(type, val) (IR_IS_TYPE_SIGNED(type) ? IR_IS_SIGNED_32BIT((val).i64) : IR_IS_UNSIGNED_32BIT((val).u64))
59+ #define IR_IS_FP_ZERO(insn) ((insn.type == IR_DOUBLE) ? (insn.val.u64 == 0) : (insn.val.u32 == 0))
5960#define IR_MAY_USE_32BIT_ADDR(code_buffer, addr) \
6061 ((code_buffer) && \
6162 IR_IS_SIGNED_32BIT((char*)(addr) - (char*)(code_buffer)->start) && \
@@ -1656,7 +1657,7 @@ static uint32_t ir_match_insn(ir_ctx *ctx, ir_ref ref)
16561657 } else if (op2_insn->val.i64 == 0) {
16571658 return IR_COPY_INT;
16581659 } else if ((ir_type_size[insn->type] >= 4 && insn->op == IR_ADD && IR_IS_SIGNED_32BIT(op2_insn->val.i64)) ||
1659- (ir_type_size[insn->type] >= 4 && insn->op == IR_SUB && IR_IS_SIGNED_32BIT(- op2_insn->val.i64))) {
1660+ (ir_type_size[insn->type] >= 4 && insn->op == IR_SUB && IR_IS_SIGNED_NEG_32BIT( op2_insn->val.i64))) {
16601661 if (ir_in_same_block(ctx, insn->op1) && ctx->use_lists[insn->op1].count == 1) {
16611662 uint32_t rule = ctx->rules[insn->op1];
16621663
0 commit comments