diff --git a/ir_aarch64.dasc b/ir_aarch64.dasc index e81788b..ca90511 100644 --- a/ir_aarch64.dasc +++ b/ir_aarch64.dasc @@ -2465,11 +2465,7 @@ static void ir_emit_jcc(ir_ctx *ctx, uint8_t op, int b, ir_ref def, ir_insn *ins if (true_block == next_block) { if (int_cmp || (op != IR_GT && op != IR_GE)) { /* swap to avoid unconditional JMP if this doesn't introduce additional JP instruction */ - if (op < IR_LT) { - op ^= 1; // reverse - } else { - op ^= 3; // reverse - } + op ^= 1; // reverse true_block = false_block; false_block = 0; } @@ -4175,11 +4171,7 @@ static void ir_emit_guard_cmp_int(ir_ctx *ctx, int b, ir_ref def, ir_insn *insn) } ir_emit_cmp_int_common(ctx, type, op1_reg, op1, op2_reg, op2); - if (op < IR_LT) { - op ^= 1; // reverse - } else { - op ^= 3; // reverse - } + op ^= 1; // reverse ir_emit_guard_jcc(ctx, op, addr, 1); } diff --git a/ir_x86.dasc b/ir_x86.dasc index c505fda..6eb9b86 100644 --- a/ir_x86.dasc +++ b/ir_x86.dasc @@ -3642,11 +3642,7 @@ static void ir_emit_jcc(ir_ctx *ctx, uint8_t op, int b, ir_ref def, ir_insn *ins if (true_block == next_block) { if (int_cmp || (op != IR_GT && op != IR_GE)) { /* swap to avoid unconditional JMP if this doesn't introduce additional JP instruction */ - if (op < IR_LT) { - op ^= 1; // reverse - } else { - op ^= 3; // reverse - } + op ^= 1; // reverse true_block = false_block; false_block = 0; } @@ -5922,11 +5918,7 @@ static void ir_emit_guard_cmp_int(ir_ctx *ctx, int b, ir_ref def, ir_insn *insn) } ir_emit_cmp_int_common(ctx, type, cmp_insn, op1_reg, op1, op2_reg, op2); - if (op < IR_LT) { - op ^= 1; // reverse - } else { - op ^= 3; // reverse - } + op ^= 1; // reverse ir_emit_guard_jcc(ctx, op, addr, 1); } diff --git a/tests/debug/loop_002.irt b/tests/debug/loop_002.irt index 559dad9..10986eb 100644 --- a/tests/debug/loop_002.irt +++ b/tests/debug/loop_002.irt @@ -50,11 +50,11 @@ test: xorl %eax, %eax .L1: cmpl $0xa, %ecx - jg .L5 + jge .L5 xorl %edx, %edx .L2: cmpl $0xa, %edx - jg .L4 + jge .L4 cmpl %ecx, %edx je .L3 leal 1(%rax), %eax diff --git a/tests/debug/test-O0.irt b/tests/debug/test-O0.irt index 33857cc..dd60353 100644 --- a/tests/debug/test-O0.irt +++ b/tests/debug/test-O0.irt @@ -104,7 +104,7 @@ test: retq .L3: cmpl $0x3e8, 0x2c(%rsp) - jl .L4 + jle .L4 xorl %eax, %eax addq $0x70, %rsp retq diff --git a/tests/debug/test_mem.irt b/tests/debug/test_mem.irt index 1c8ab7d..9c7e168 100644 --- a/tests/debug/test_mem.irt +++ b/tests/debug/test_mem.irt @@ -118,7 +118,7 @@ test: ja .L2 movl (%rax), %ecx cmpl $0x3e8, %ecx - jl .L1 + jle .L1 xorl %eax, %eax movq %rbp, %rsp popq %rbp diff --git a/tests/debug/test_var-O0.irt b/tests/debug/test_var-O0.irt index a2c4f26..55a2f83 100644 --- a/tests/debug/test_var-O0.irt +++ b/tests/debug/test_var-O0.irt @@ -126,7 +126,7 @@ test: retq .L3: cmpl $0x3e8, 0x30(%rsp) - jl .L4 + jle .L4 xorl %eax, %eax addq $0x68, %rsp retq diff --git a/tests/debug/test_var.irt b/tests/debug/test_var.irt index 58563f5..21bad8d 100644 --- a/tests/debug/test_var.irt +++ b/tests/debug/test_var.irt @@ -108,7 +108,7 @@ test: ucomisd .L4(%rip), %xmm0 ja .L2 cmpl $0x3e8, 0x20(%rsp) - jl .L1 + jle .L1 xorl %eax, %eax addq $0x40, %rsp retq