On 09/01/2022 12:35, Florian Klämpfl via fpc-devel wrote:
  It removes a jump and a label, which might permit other long-range optimisations, but it's 3 instructions that are in a dependency chain.

Didn't you implement something which transformed the code above in

      xorl    %ebx,%ebx
      cmpl    $1,%ecx
      setg    %bl
      subl    %ebx,%ecx

?

I believe I did, yes.  I'll have to double-check if the "jcc -> setcc" optimisation is actually mine or if I just adapted it to use GetIntRegisterBetween.  That's certainly the better sequence because XOR is a smaller instruction (2 bytes, I believe) and it breaks the dependency chain, since it can execute at the same time as the CMP instruction.

Either way, it's not being performed here, so that's another optimisation to add to my ever-growing list!  Yes, I've got a new optimisation ready to merge request soon - I'm running my local tests as we speak.  I need to discipline myself a bit and try to fix the bug on 3.2.4's i386-linux implementation.

Gareth aka. Kit


--
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to