This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Different addressing modes for loads and stores?
- From: "Fred Cook" <fcook377 at hotmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 14 May 2003 13:18:45 +0000
- Subject: Different addressing modes for loads and stores?
- Bcc:
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