[fpc-devel] Discussion on a particular optimisation development (WARNING: Technical!)

J. Gareth Moreton gareth at moreton-family.com
Wed Feb 3 22:14:36 CET 2021


Rats, I might have messed up with some of the arithmetic, as well as the 
dangers of crossing bitwise with logical Boolean operations, although 
some combinations still work - if the conditions are "x = 0" rather than 
"x <> 0" in the example:

      testq    %rbx,%rbx
      seteb    %al
      testq    %rsi,%rsi
      seteb    %dl
      andb     %dl,%al

Then this would equate to:

      orq      %rbx,%rsi
      seteb    %al

And if a conditional jump follows the "set" instruction, then this could 
be removed as well.  Of course, implementing the optimisation would have 
revealed my little arithmetic mistake there.

(A <> 0) and (B <> 0) = not((A = 0) or (B = 0)), but what I wrote before 
effectively calculated (A or B) <> 0. Thanks for spotting my error, Florian.

Mistake aside, I'm looking for acceptable solutions for a 
platform-dependent node transformation, like a flag of some kind ($if 
defined etc. might get untidy, although is an option).

Gareth aka. Kit


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



More information about the fpc-devel mailing list