[fpc-devel] Finally fixed that MOVZX/SX optimisation!

Florian Klämpfl florian at freepascal.org
Thu Feb 20 21:34:39 CET 2020

Am 20.02.20 um 21:25 schrieb J. Gareth Moreton:
> On 20/02/2020 17:10, Florian Klämpfl wrote:
>> Am 18.02.20 um 23:04 schrieb J. Gareth Moreton:
>>> ...
>>> It seems that not all regressions are caught when you run the test 
>>> suite conventionally, and you have to specify additional options like 
>>> "-O4", which may cause other failures to occur if a test is not 
>>> expecting any kind of intense optimisation, for example.  In 
>>> response, over here at https://bugs.freepascal.org/view.php?id=36687, 
>>> I've introduced two new tests that are copies of the ones that 
>>> failed, but which explicitly add -O4 to the default compiler 
>>> options.  Besides covering the fault in my patch, I can see these 
>>> tests proving useful later on because I can see future peephole 
>>> optimisations in the compiled assembly language (e.g. the following 
>>> triplet appears... "movw $65280,%ax; cmp $65280,%ax; je @lbl"... 
>>> logical analysis shows that the conditional branch is always taken).
>> Yes, but in this case, there is something missed at the node level 
>> optimizer. Such code should not be generated.
> it might be an artefact of "-Oonoconstprop", 

Then the peephole optimizer should care even less about it.

> but if you run all of the 
> "test/cg/tcnvint3" tests with the "-a" option, you will notice such 
> sequences in some of the ".s" file.

With full -O3?

More information about the fpc-devel mailing list