h8300.c (h8300_eightbit_constant_address_p): New.

* config/h8300/h8300.c (h8300_eightbit_constant_address_p): New.
	(h8300_tiny_constant_address_p): Likewise.
	* config/h8300/h8300.h (EIGHTBIT_CONSTANT_ADDRESS_P): Use
	h8300_eightbit_constant_address_p.
	(TINY_CONSTANT_ADDRESS_P): Use h8300_tiny_constant_address_p.
	* config/h8300/h8300-protos.h: Add the prototypes for the two
	new functions.

From-SVN: r58628
This commit is contained in:
Kazu Hirata 2002-10-29 17:55:45 +00:00 committed by Kazu Hirata
parent 6bb8a3f75a
commit 803d56f52a
4 changed files with 70 additions and 17 deletions

View File

@ -1,3 +1,13 @@
2002-10-29 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.c (h8300_eightbit_constant_address_p): New.
(h8300_tiny_constant_address_p): Likewise.
* config/h8300/h8300.h (EIGHTBIT_CONSTANT_ADDRESS_P): Use
h8300_eightbit_constant_address_p.
(TINY_CONSTANT_ADDRESS_P): Use h8300_tiny_constant_address_p.
* config/h8300/h8300-protos.h: Add the prototypes for the two
new functions.
2002-10-29 Kazu Hirata <kazu@cs.umass.edu>
* reload1.c (update_eliminables): Unconditionally check if

View File

@ -60,6 +60,9 @@ extern int bit_memory_operand PARAMS ((rtx, enum machine_mode));
extern int bit_operator PARAMS ((rtx, enum machine_mode));
extern int nshift_operator PARAMS ((rtx, enum machine_mode));
extern int h8300_eightbit_constant_address_p PARAMS ((rtx));
extern int h8300_tiny_constant_address_p PARAMS ((rtx));
/* Used in builtins.c */
extern rtx h8300_return_addr_rtx PARAMS ((int, rtx));
#endif /* RTX_CODE */

View File

@ -3856,3 +3856,56 @@ h8300_asm_named_section (name, flags)
fprintf (asm_out_file, "\t.section %s\n", name);
}
#endif /* ! OBJECT_FORMAT_ELF */
int
h8300_eightbit_constant_address_p (x)
rtx x;
{
/* The ranges the 8-bit area. */
const unsigned HOST_WIDE_INT n1 = trunc_int_for_mode (0x0000ff00, SImode);
const unsigned HOST_WIDE_INT n2 = trunc_int_for_mode (0x0000ffff, SImode);
const unsigned HOST_WIDE_INT h1 = trunc_int_for_mode (0x00ffff00, SImode);
const unsigned HOST_WIDE_INT h2 = trunc_int_for_mode (0x00ffffff, SImode);
const unsigned HOST_WIDE_INT s1 = trunc_int_for_mode (0xffffff00, SImode);
const unsigned HOST_WIDE_INT s2 = trunc_int_for_mode (0xffffffff, SImode);
unsigned HOST_WIDE_INT addr;
if (GET_CODE (x) != CONST_INT)
return 0;
addr = INTVAL (x);
return (0
|| (TARGET_H8300 && IN_RANGE (addr, n1, n2))
|| (TARGET_H8300H && IN_RANGE (addr, h1, h2))
|| (TARGET_H8300S && IN_RANGE (addr, s1, s2)));
}
int
h8300_tiny_constant_address_p (x)
rtx x;
{
/* The ranges for the 16-bit area. */
const unsigned HOST_WIDE_INT h1 = trunc_int_for_mode (0x00000000, SImode);
const unsigned HOST_WIDE_INT h2 = trunc_int_for_mode (0x00007fff, SImode);
const unsigned HOST_WIDE_INT h3 = trunc_int_for_mode (0x00ff8000, SImode);
const unsigned HOST_WIDE_INT h4 = trunc_int_for_mode (0x00ffffff, SImode);
const unsigned HOST_WIDE_INT s1 = trunc_int_for_mode (0x00000000, SImode);
const unsigned HOST_WIDE_INT s2 = trunc_int_for_mode (0x00007fff, SImode);
const unsigned HOST_WIDE_INT s3 = trunc_int_for_mode (0xffff8000, SImode);
const unsigned HOST_WIDE_INT s4 = trunc_int_for_mode (0xffffffff, SImode);
unsigned HOST_WIDE_INT addr;
if (GET_CODE (x) != CONST_INT)
return 0;
addr = INTVAL (x);
return (0
|| (TARGET_H8300H
&& IN_RANGE (addr, h1, h2) || IN_RANGE (addr, h3, h4))
|| (TARGET_H8300S
&& IN_RANGE (addr, s1, s2) || IN_RANGE (addr, s3, s4)));
}

View File

@ -837,27 +837,14 @@ struct cum_arg
/* 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_H8300 && IN_RANGE (INTVAL (X) & 0xffff, 0xff00, 0xffff)) \
|| (TARGET_H8300H && IN_RANGE (INTVAL (X) & 0xffffffff, \
0xffff00, 0xffffff)) \
|| (TARGET_H8300S && IN_RANGE (INTVAL (X) & 0xffffffff, \
0xffffff00, 0xffffffff))))
#define EIGHTBIT_CONSTANT_ADDRESS_P(X) \
h8300_eightbit_constant_address_p (X)
/* Nonzero if X is a constant address suitable as an 16-bit absolute
on H8/300H and H8S. */
#define TINY_CONSTANT_ADDRESS_P(X) \
((GET_CODE (X) == CONST_INT) \
&& ((TARGET_H8300H \
&& (IN_RANGE (INTVAL (X) & 0xffffffff, 0x000000, 0x007fff) \
|| IN_RANGE (INTVAL (X) & 0xffffffff, 0xff8000, 0xffffff))) \
|| (TARGET_H8300S \
&& (IN_RANGE (INTVAL (X) & 0xffffffff, \
0x00000000, 0x00007fff) \
|| IN_RANGE (INTVAL (X) & 0xffffffff, \
0xffff8000, 0xffffffff)))))
#define TINY_CONSTANT_ADDRESS_P(X) \
h8300_tiny_constant_address_p (X)
/* 'U' if valid for a bset destination;
i.e. a register, register indirect, or the eightbit memory region