This is the mail archive of the gcc-patches@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]

Re: [Patch,AVR]: Fix PR50447 (2/n)


On 09/23/2011 10:56 AM, Paolo Bonzini wrote:
Also, I am curious about one thing: while this is of course a very
pragmatic solution, you could also convert AVR to get rid of CC0, do
this at expansion time, and get split-wide-types to work as intended.

compare-elim.c makes it relatively easy to remove CC0 nowadays.

For example, a two-byte add can be written as


   (set (reg:QI L1) (plus:QI (reg:QI L2) (reg:QI L3)))
   (set (reg:QI H1) (plus:QI
                    (plus:QI (req:QI H2) (reg:QI H3))
                    (ltu:QI  (reg:QI L1) (reg:QI L3))))

After reload the second instruction can be split to

  (set (reg:CC_C CC) (compare:QI (reg:QI L1) (reg:QI L3)))
  (set (reg:QI   H1) (plus:QI
                     (plus:QI    (req:QI   H2) (reg:QI H3))
                     (lt:QI      (reg:CC_C CC) (const_int 0))))

(i.e. cp+adc). compare-elim will then be able to turn this into add+adc:

  [parallel
    (set (reg:QI   L1) (plus:QI    (reg:QI L2) (reg:QI L3)))
    (set (reg:CC_C CC) (compare:QI
                       (plus:QI    (reg:QI L2) (reg:QI L3))
                                   (reg:QI L3))))]
  (set (reg:QI H1) (plus:QI
                   (plus:QI (req:QI   H2) (reg:QI H3))
                   (lt:QI   (reg:CC_C CC) (const_int 0))))

Paolo


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