From 6ece867305b3357797e3bc7d1fd245647125ebde Mon Sep 17 00:00:00 2001 From: nickysn Date: Thu, 15 Oct 2015 20:51:20 +0000 Subject: [PATCH] * in the i8086 64-bit shl code, use jcxz instead of test cx,cx+jz when optimization target is 386 or earlier (or when optimizing for size) git-svn-id: trunk@32060 - --- compiler/i8086/n8086mat.pas | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/compiler/i8086/n8086mat.pas b/compiler/i8086/n8086mat.pas index 55ad8edd58..5e02899d63 100644 --- a/compiler/i8086/n8086mat.pas +++ b/compiler/i8086/n8086mat.pas @@ -493,14 +493,24 @@ implementation we've already handled them earlier as a special case } if right.nodetype<>ordconstn then begin + if (cs_opt_size in current_settings.optimizerswitches) or + (current_settings.optimizecputype<=cpu_386) then + begin + ai:=Taicpu.Op_Sym(A_JCXZ,S_W,l3); + ai.is_jmp := True; + current_asmdata.CurrAsmList.Concat(ai); + end + else + begin + emit_reg_reg(A_TEST,S_W,NR_CX,NR_CX); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_E,l3); + end; emit_const_reg(A_CMP,S_L,64,NR_CX); cg.a_jmp_flags(current_asmdata.CurrAsmList,F_L,l1); cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_XOR,OS_32,hreg64lo,hreg64lo); cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_XOR,OS_32,hreg64hi,hreg64hi); cg.a_jmp_always(current_asmdata.CurrAsmList,l3); cg.a_label(current_asmdata.CurrAsmList,l1); - emit_reg_reg(A_TEST,S_W,NR_CX,NR_CX); - cg.a_jmp_flags(current_asmdata.CurrAsmList,F_E,l3); end; cg.a_label(current_asmdata.CurrAsmList,l2); if nodetype=shln then