Re: how to force mem constraint for symbol ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 07, 2019 at 11:41:53AM -0600, Jeff Law wrote:
> On 7/7/19 11:02 AM, William Tambe wrote:
> > (define_constraint "A"
> >  "A memory address."
> >  (and (match_code "mem")
> >       (ior (match_test "GET_CODE (XEXP (op, 0)) == SYMBOL_REF")
> >            (match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF")
> >            (match_test "GET_CODE (XEXP (op, 0)) == CONST"))))
> > 
> > (define_insn "movsi"
> >  [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r")
> >        (match_operand:SI 1 "general_operand"      "A,i"))]
> >  ""
> >  "@
> >   gip %0, %1
> >   li %0, %1")
> > ----------------------------------------------------------
> > 
> > GCC always choose to match the line "li %0, %1" instead of the line
> > "gip %0, %1".
> > 
> > How can I force GCC to match "gip %0, %1" for a symbol ?
> > 
> You'd have to debug the register allocation and reloading phase to
> determine what it's doing and why.
> 
> And, in general, you want your constraints and predicates to match as
> closely as possible.  So in the above case your predicates are
> "nonimmediate_operand and "general_operand".  You'd be better off with
> "register_operand" and "immediate_operand" since operand 0's constraints
> only allow registers and operand 1's constraints only allow immediates.

Yup.  And "A" is defined as being a mem, which makes no sense, and its
comment says it is a "memory address".


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux