optimise sub; jbe
This commit is contained in:
parent
7d6a3c67e4
commit
949081837b
|
@ -1939,19 +1939,24 @@ pub fn gen_test_be(ctx: &mut JitContext, negate: ConditionNegate) {
|
|||
Instruction::Sub {
|
||||
opsize,
|
||||
dest: _,
|
||||
source: _,
|
||||
source,
|
||||
} => {
|
||||
gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_OPTIMISED);
|
||||
|
||||
gen_get_last_op1(ctx.builder, &ctx.previous_instruction);
|
||||
// Note: Can only use register if it's different from dest (being lazy here and just using op1 and result)
|
||||
gen_get_last_op1(ctx.builder, &ctx.previous_instruction);
|
||||
gen_get_last_result(ctx.builder, &ctx.previous_instruction);
|
||||
ctx.builder.sub_i32();
|
||||
if *opsize == OPSIZE_8 || *opsize == OPSIZE_16 {
|
||||
ctx.builder
|
||||
.const_i32(if *opsize == OPSIZE_8 { 0xFF } else { 0xFFFF });
|
||||
ctx.builder.and_i32();
|
||||
match (opsize, source) {
|
||||
(&OPSIZE_32, InstructionOperand::WasmLocal(l)) => ctx.builder.get_local(l),
|
||||
(_, &InstructionOperand::Immediate(i)) => ctx.builder.const_i32(i),
|
||||
_ => {
|
||||
gen_get_last_op1(ctx.builder, &ctx.previous_instruction);
|
||||
gen_get_last_result(ctx.builder, &ctx.previous_instruction);
|
||||
ctx.builder.sub_i32();
|
||||
if *opsize == OPSIZE_8 || *opsize == OPSIZE_16 {
|
||||
ctx.builder
|
||||
.const_i32(if *opsize == OPSIZE_8 { 0xFF } else { 0xFFFF });
|
||||
ctx.builder.and_i32();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
if negate == ConditionNegate::True {
|
||||
|
|
Loading…
Reference in a new issue