[fpc-devel] Finally fixed that MOVZX/SX optimisation!
J. Gareth Moreton
gareth at moreton-family.com
Tue Feb 18 23:04:02 CET 2020
Hi everyone,
So I had some difficulty reproducing a regression with my latest
optimisation patch, but a couple of days ago I finally reproduced it and
isolated the cause. As explained in the topic, my optimisation was
faulty with the instruction pair "movb $-63,%al; movsbw %al,%ax" and
other similar constructs - negative constants weren't handled properly.
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).
Long story short, the patch /finally/ works and a full run of the
regression suite on i386-win32 and x86_64-win64, including the two new
tests, show no new failures.
Gareth aka. Kit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20200218/d56c17d9/attachment.html>
More information about the fpc-devel
mailing list