This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
help with combine
- From: Dale Johannesen <dalej at apple dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 20 Nov 2001 11:27:24 -0800
- Subject: help with combine
int x,y,z,w,v;
int xx ()
{
int t = -w;
x = v + t;
y = z + t;
}
gcc3 generates code as written for this, a negate and two adds. Better
is to combine the adds and negate, and do two subtracts. With only one
add, combine does produce a subtract, but when t is shared it will not
merge either instruction pair. I have no idea how to go about fixing
this, and would appreciate guidance. The algorithms of combine clearly
aren't intended to do this, so maybe a later phase would be better?
(on Darwin, but there's nothing target-dependent, I don't think. The
problem is more general than negation, I think; my original example
involved a multiply-add.)