approaches to carry-flag modelling in RTL

Paulo J. Matos paulo@matos-sorge.com
Mon Oct 31 09:40:00 GMT 2011


On 28/10/11 17:59, Richard Henderson wrote:
> On 10/28/2011 06:49 AM, Peter Bigot wrote:
>> I'm inclined to follow sparc's lead, but is one or another of the choices
>> more likely to help combine/reload/etc do a better job?
>
> I don't know.
>
> In the case of RX, we don't model CC_REG until after reload, so combine really
> doesn't get a shot at it.
>
> Be careful here.  If you explicitly model the carry flag before reload, you need
> to have an ADD instruction that can avoid any flags modification.  Reload needs
> to generate such instructions in some cases, and needs to be able to insert them
> between any two arbitrary insns.
>

I followed rx model but instead RCC before clobber in some cases.
To solve this problem

I have the following insn_and_split:
(define_insn_and_split "addqi3_noclobber"
   [(set (match_operand:QI 0 "register_operand" "=c")
         (plus:QI (match_operand:QI 1 "register_operand")
                  (match_operand:QI 2 "immediate_operand")))]
   "reload_in_progress"
   "#"
   "reload_completed"
   [(parallel [(set (match_dup 0) (match_dup 1))
               (clobber (reg:CC RCC))])
    (parallel [(set (match_dup 0) (plus:QI (match_dup 0) (match_dup 2)))
               (clobber (reg:CC RCC))])])

Cheers,
-- 
PMatos



More information about the Gcc mailing list