optimise test x, x followed by jz/js
This commit is contained in:
parent
0ea7c7cd81
commit
db65dd352d
|
@ -1745,7 +1745,6 @@ pub fn gen_getsf(ctx: &mut JitContext) {
|
|||
let &opsize = opsize;
|
||||
gen_profiler_stat_increment(ctx.builder, profiler::stat::CONDITION_OPTIMISED);
|
||||
// TODO:
|
||||
// use local for test x, x
|
||||
// x >= 0 for ConditionNegate::True
|
||||
gen_get_last_result(ctx.builder, &ctx.previous_instruction);
|
||||
ctx.builder.const_i32(if opsize == OPSIZE_32 {
|
||||
|
|
|
@ -1288,14 +1288,19 @@ fn gen_test(
|
|||
source_operand: &LocalOrImmediate,
|
||||
size: i32,
|
||||
) {
|
||||
// TODO: Instruction::Test { dest: local_to_instruction_operand(ctx, dest_operand) }
|
||||
let is_self_test = source_operand.eq_local(dest_operand);
|
||||
ctx.current_instruction = Instruction::Arithmetic {
|
||||
opsize: size,
|
||||
dest: InstructionOperandDest::Other,
|
||||
dest: if is_self_test {
|
||||
local_to_instruction_operand(ctx, dest_operand)
|
||||
}
|
||||
else {
|
||||
InstructionOperandDest::Other
|
||||
},
|
||||
};
|
||||
|
||||
ctx.builder.const_i32(global_pointers::last_result as i32);
|
||||
if source_operand.eq_local(dest_operand) {
|
||||
if is_self_test {
|
||||
ctx.builder.get_local(&dest_operand);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue