This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
PRE_DEC, POST_INC, how to ?
- From: Florent DEFAY <spira dot inhabitant at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 13 May 2009 15:11:18 +0200
- Subject: PRE_DEC, POST_INC, how to ?
Hi,
I am working on a new port.
The machine is 16 bit and supports pre-dec and post-inc addressing modes.
I need your help because I do not manage to have GCC generating proper
pre dec or post inc assembler code.
I modified GO_IF_LEGITIMATE_ADDRESS routines so that addresses with
PRE_DEC or POST_INC as RTL code are accepted.
Then I sometimes get valid code like:
move r1,-(r0)
move r1,-2(r0)
move r2,r0
But only with optimization options.
Moreover, the previous example would be better coded with:
move r1,-(r0)
move r1,-(r0)
move r2,r0
because it does the same thing and pre dec is a cheaper operation
than -2(r0) (indexed with displacement).
I tried to implement the cost function so that pre dec is cheaper than
indexed with displacement but it does not work.
So I cannot control pre dec and post inc in move operations.
Besides, it never generates this addressing mode with other
operations like add, and, ior ... which should be available.
I took inspiration from MSP430 and defined patterns to directly consider
the pre dec and post inc, but nothing changed.
Please, I need advice.
Regards.
Florent