This is the mail archive of the 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: defining add in a new port

On Fri, 28 Jan 2011, Jean-Marc Saffroy wrote:
> (define_constraint "I"
>   "Signed 6-bit integer constant for binops."
>   (and (match_code "const_int")
>        (match_test "IN_RANGE (ival, -24, 32)")))
> (define_register_constraint "A" "ADDR_REGS"
>   "The address registers.")
> (define_register_constraint "D" "DATA_REGS"
>   "The general (data) registers.")
> (define_predicate "reg_or_18bit_signed_operand"
>   (if_then_else (match_code "const_int")
>     (match_test "IN_RANGE (INTVAL (op), -(1 << 17), (1 << 17) - 1)")
>     (match_operand 0 "register_operand")))
> (define_insn "adddi3"
>   [(set (match_operand:DI 0 "register_operand" "=D,D,A")
> 	(plus:DI
> 	 (match_operand:DI 1 "register_operand" "%0,0,0")
> 	 (match_operand:DI 2 "reg_or_18bit_signed_operand" "I,D,n")))]
>   ""
>   "@
>    addi   %0, %2
>    add    %0, %2
>    adda   %0, %2")

> It seems I was expecting too much intelligence from reload, or I didn't
> give enough hints.

JFTR (after reading subsequent messages and good pragmatic
advice), I think you're working around a bug in gcc; your adddi3
should work as-is above.  Reload may create suboptimal
sequences, but it should always create working code.  Not that
we can do much about it, the port not in the tree and all, but
perhaps later.  There are recent-ish changes in this area (i.e.
fp-sp elimination), fixing bugs exposed by other ports, so try
updating your tree too.

brgds, H-P

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