This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]