[Bug optimization/3507] appalling optimisation with sub/cmp on i386
cyrille at chepelov dot org
gcc-bugzilla@gcc.gnu.org
Wed Mar 3 19:46:00 GMT 2004
------- Additional Comments From cyrille at chepelov dot org 2004-03-03 19:46 -------
Observed on m68k-palmos (2.95.3+Debian boatload of patches), arm-palmos (3.2.2),
AVR (3.3, 20030512 prerelease, likely patched), and on i386 (3.3.3, mainline and
tree-ssa as of 20040302).
I suggest updating $SUMMARY and $TARGET accordingly.
Further testing (see attachement) show that opportunities can be missed even for
simple signed ints: bar() has the problem, while baz() and bat() use either cmp
or sub, but not both. Furthermore, baz() seems to show that the combine pass is
doing a good job of finding the right compare instruction when the primary
result of the subtraction is thrown away. Could it be possible that a simple and
systematic:
(a < b) ===> (coerce_to_signed_type<>(a - b) < 0)
replacement (done perhaps at the SSA level) would resolve this, without
incurring excessive costs?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3507
More information about the Gcc-bugs
mailing list