------- Comment #13 from ubizjak at gmail dot com 2010-06-10 14:59 ------- (In reply to comment #12) > (In reply to comment #11) > > > > > I am not sure this is correct. The code prior to revision 160394 was > > > > written in such a way to support X86_TUNE_OPT_AGU. We may have missed > > > > some cases. But it is mostly correct. I'd like to know what specific > > > > cases revision 160394 tried to fix. Thanks. > > > > > > The patch fixes general problem, where we simply output lea from > > > add{si,di} > > > instruction. This is not correct, since lea does not clobber flags, so we > > > should split add RTX to lea RTX to model this fact. > > > > > > > ADD is always faster than LEA for adding a register. However > > there is a special case on Atom where ADD should be avoided. > > It is true that LEA doesn't touch flags and we used it instead > > of ADD which touches flags. It is an optimization specific for > > Atom. You can think it as a special ADD for Atom and pretend > > it clobbers flags. We shouldn't model it as a real LEA since > > it is used to implement a faster ADD in this special case. > > > > Uros, I'd like to revert revision 160394 to fix bootstrap on > > Atom. I will work with you to resolve issues you discovered > > without affecting Atom performance. Thanks. > > OK, please go ahead. The correct fix is not as simple as I have thought.
Please revert only this part: * config/i386/i386.md (*add<mode>_1): Remove alternative 2. <TYPE_LEA>: Split instruction. <default>: Remove alternative 2 handling. (*addsi_1_zext) <TYPE_LEA>: Split instruction. (add lea splitter): Generate SImode lea for mode sizes <= SImode. (add_zext lea splitter): Use ix86_lea_for_add_ok in insn predicate. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44470