Different addressing modes for loads and stores?

Fred Cook fcook377@hotmail.com
Wed May 14 13:18:00 GMT 2003


Hi,

How to deal with load and store instructions that have different addressing
modes? This is not unusual so there must be a solution. What I did is
specifying the following pattern in the .md file for word loads and
stores:

(define_insn "movsi"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m")
         (match_operand:SI 1 "general_operand" "m,r"))]
   ""
   "@
   load %1 -> %0
   store %0 %1"
)

My loads support base+offset and base+register addressing while stores
only have base+offset addressing. My GO_IF_LEGITIMATE_ADDRESS macro
accepts both addressing modes. Now the question is how to prevent that
the base+register mode is used for stores. For that changed the movsi
pattern to:

(define_insn "movsi"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=r,S")
         (match_operand:SI 1 "general_operand" "m,r"))]
   ""
   "@
   load %1 -> %0
   store %0 %1"
)

and I used the EXTRA_CONSTRAINT macro to accept only base+offset
if the letter argument is 'S'. However, this does not lead to what
I wanted to achieve. "=r,Sm" or "=r,mS" also does not work.

Any idea how to solve this problem?

Thanks,

Fred.

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus



More information about the Gcc mailing list