[fpc-devel] Finally fixed that MOVZX/SX optimisation!
florian at freepascal.org
Thu Feb 20 18:10:40 CET 2020
Am 18.02.20 um 23:04 schrieb J. Gareth Moreton:
> 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
Yes, but in this case, there is something missed at the node level
optimizer. Such code should not be generated.
> Long story short, the patch /finally/ works
Which ones did you exactly apply? All three in the bug tracker at once?
> 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
> fpc-devel maillist - fpc-devel at lists.freepascal.org
More information about the fpc-devel