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]

Re: AVR: CC0 to CCmode conversion


Sorry meant denote the setting of FLAG_REGS based solely on it's result,
which should be implied by operand 0, the target of 3-operand instructions;
with the exception of compare, as it's effective target are the FLAGS_REGS.

corrected below:

> From: Paul Schlie <schlie@comcast.net>
> - possibly something like: ?

  (define_insn "*minushi3"
    [(set (match_operand:HI 0 ...)
       (minus:HI (match_operand:HI 1 ...)
                 (match_operand:HI 2 ...)))
     (set (reg ZCMP_FLAGS)
       (compare:HI (match_dup 0) (const_int 0)))
     (set (reg CARRY_FLAGS)
       (compare:HI (match_dup 0) (const_int 0)))]
    ""
    "@ add %A0,%A2\;adc %B0,%B2
       ..."
    [(set_attr "length" "2, ...")])

  (define_insn "*andhi3"
    [(set (match_operand:HI 0 ...)
       (and:HI (match_operand:HI 1 ...)
               (match_operand:HI 2 ...)))
     (set (reg ZCMP_FLAGS)
       (compare:HI (match_dup 0) (const_int 0)))]
    ""
    "@ and %A0,%A2\;and %B0,%B2
       ..."
    [(set_attr "length" "2, ...")])
    
  (define_insn "*comparehi"
    [(set (reg ZCMP_FLAGS)
       (compare:HI (minus:HI (match_operand:HI 1 ...)
                             (match_operand:HI 2 ...))
                   (const_int 0)))
     (set (reg CARRY_FLAGS)
       (compare:HI (minus:HI (match_operand:HI 1 ...)
                             (match_operand:HI 2 ...))
                   (const_int 0)))]
    ""
    "@ cp %A0,%A0\;cpc %B0,%B1
       ..."
    [(set_attr "length" "2, ...")])

  (define_insn "branch"
    [(set (pc)
       (if_then_else (condition (reg ZCMP_FLAGS) (match_operand 1 ...))
                     (label_ref (match_operand 0 ...))
                     (pc)))]
    "* return ret_cond_branch (operands);
       ..."
    [(set_attr "type" "branch")])



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