This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] H8300 Extend 8-bit constant address support to H8300 and H8S, 16-bit constant address support to H8S
- From: "Dhananjay R. Deshpande" <dhananjayd at kpit dot com>
- To: <gcc-patches at gcc dot gnu dot org>
- Cc: "Jeff Law" <law at porcupine dot slc dot redhat dot com>,"Kazu Hirata" <kazu at cs dot umass dot edu>,"tm" <tm at mail dot kloo dot net>
- Date: Thu, 12 Sep 2002 16:51:33 +0530
- Subject: [PATCH] H8300 Extend 8-bit constant address support to H8300 and H8S, 16-bit constant address support to H8S
Hi,
Currently aa:8 and aa:16 addressing mode is only supported on H8300H.
The aa:8 mode can also be supported on H8300 and H8S, likewise aa:16 can also
be supported on H8S.
Each of the above reduces code size by 2.
2002-09-12 Dhananjay Deshpande <dhananjayd@kpit.com>
* config/h8300/h8300.h (EIGHTBIT_CONSTANT_ADDRESS_P): Add support for
H8300, H8S aa:8 mode
(TINY_CONSTANT_ADDRESS_P): Add support for H8S aa:16 mode
* config/h8300/h8300.c (h8300_adjust_insn_length): Adjust length for
H8300 aa:8 mode
===============================================================================
--- h8300.h.orig Thu Sep 12 12:09:55 2002
+++ h8300.h Thu Sep 12 12:25:42 2002
@@ -822,20 +822,24 @@
? !h8300_shift_needs_scratch_p (INTVAL (OP), SImode) \
: 0)
-/* Nonzero if X is a constant address suitable as an 8-bit absolute on
- the H8/300H, which is a special case of the 'R' operand. */
+/* Nonzero if X is a constant address suitable as an 8-bit absolute,
+ which is a special case of the 'R' operand. */
-#define EIGHTBIT_CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == CONST_INT && TARGET_H8300H \
- && 0xffff00 <= INTVAL (X) && INTVAL (X) <= 0xffffff)
+#define EIGHTBIT_CONSTANT_ADDRESS_P(X) \
+ (GET_CODE (X) == CONST_INT && \
+ ((TARGET_H8300H && 0xffff00 <= INTVAL (X) && INTVAL (X) <= 0xffffff) || \
+ (TARGET_H8300S && 0xffffff00 <= INTVAL (X) && INTVAL (X) <= 0xffffffff) || \
+ (TARGET_H8300 && 0xffffff00 <= INTVAL (X) && INTVAL (X) <= 0xffffffff)))
/* Nonzero if X is a constant address suitable as an 16-bit absolute
on the H8/300H. */
-#define TINY_CONSTANT_ADDRESS_P(X) \
- (GET_CODE (X) == CONST_INT && TARGET_H8300H \
- && ((0xff8000 <= INTVAL (X) && INTVAL (X) <= 0xffffff) \
- || (0x000000 <= INTVAL (X) && INTVAL (X) <= 0x007fff)))
+#define TINY_CONSTANT_ADDRESS_P(X) \
+ (GET_CODE (X) == CONST_INT && \
+ ((TARGET_H8300H && ((0xff8000 <= INTVAL (X) && INTVAL (X) <= 0xffffff) \
+ || (0x000000 <= INTVAL (X) && INTVAL (X) <= 0x007fff))) || \
+ (TARGET_H8300S && ((0xffff8000 <= INTVAL (X) && INTVAL (X) <= 0xffffffff) \
+ || (0x00000000 <= INTVAL (X) && INTVAL (X) <= 0x00007fff)))))
/* 'U' if valid for a bset destination;
i.e. a register, register indirect, or the eightbit memory region
===============================================================================
--- h8300.c.orig Thu Sep 12 12:10:03 2002
+++ h8300.c Thu Sep 12 13:48:13 2002
@@ -3719,6 +3719,12 @@
/* @Rs is 2 bytes shorter than the longest. */
if (GET_CODE (addr) == REG)
return -2;
+
+ /* @aa:8 is 2 bytes shorter than the longest. */
+ if (GET_MODE (SET_SRC (pat)) == QImode
+ && ((GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_FLAG (addr))
+ || EIGHTBIT_CONSTANT_ADDRESS_P (addr)))
+ return -2;
}
else
{
===============================================================================
Regards,
Dhananjay
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free download of GNUSH and GNUH8 tool-chains for Hitachi's SH and H8 Series.
The following site also offers free support to European customers.
Read more at http://www.kpit.com.
Latest versions of GNUSH and GNUH8 are released on July 1, 2002.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~