This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/3507] appalling optimisation with sub/cmp on i386
- From: "cyrille at chepelov dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Mar 2004 19:46:40 -0000
- Subject: [Bug optimization/3507] appalling optimisation with sub/cmp on i386
- References: <20010701091600.3507.75773-quiet@bugs.debian.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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