aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/i386/i386.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/i386/i386.c')
-rw-r--r--gcc/config/i386/i386.c52
1 files changed, 36 insertions, 16 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 06ef5db..13e0fdc 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -11576,22 +11576,17 @@ ix86_decompose_address (rtx addr, struct ix86_address *out)
int retval = 1;
enum ix86_address_seg seg = SEG_DEFAULT;
- /* Allow SImode subregs of DImode addresses,
- they will be emitted with addr32 prefix. */
- if (TARGET_64BIT && GET_MODE (addr) == SImode)
- {
- if (GET_CODE (addr) == SUBREG
- && GET_MODE (XEXP (addr, 0)) == DImode)
- addr = SUBREG_REG (addr);
- }
-
/* Allow zero-extended SImode addresses,
they will be emitted with addr32 prefix. */
- else if (TARGET_64BIT && GET_MODE (addr) == DImode)
+ if (TARGET_64BIT && GET_MODE (addr) == DImode)
{
if (GET_CODE (addr) == ZERO_EXTEND
&& GET_MODE (XEXP (addr, 0)) == SImode)
- addr = XEXP (addr, 0);
+ {
+ addr = XEXP (addr, 0);
+ if (CONST_INT_P (addr))
+ return 0;
+ }
else if (GET_CODE (addr) == AND
&& const_32bit_mask (XEXP (addr, 1), DImode))
{
@@ -11600,7 +11595,11 @@ ix86_decompose_address (rtx addr, struct ix86_address *out)
/* Adjust SUBREGs. */
if (GET_CODE (addr) == SUBREG
&& GET_MODE (SUBREG_REG (addr)) == SImode)
- addr = SUBREG_REG (addr);
+ {
+ addr = SUBREG_REG (addr);
+ if (CONST_INT_P (addr))
+ return 0;
+ }
else if (GET_MODE (addr) == DImode)
addr = gen_rtx_SUBREG (SImode, addr, 0);
else if (GET_MODE (addr) != VOIDmode)
@@ -11608,6 +11607,19 @@ ix86_decompose_address (rtx addr, struct ix86_address *out)
}
}
+ /* Allow SImode subregs of DImode addresses,
+ they will be emitted with addr32 prefix. */
+ if (TARGET_64BIT && GET_MODE (addr) == SImode)
+ {
+ if (GET_CODE (addr) == SUBREG
+ && GET_MODE (SUBREG_REG (addr)) == DImode)
+ {
+ addr = SUBREG_REG (addr);
+ if (CONST_INT_P (addr))
+ return 0;
+ }
+ }
+
if (REG_P (addr))
base = addr;
else if (GET_CODE (addr) == SUBREG)
@@ -14765,11 +14777,19 @@ ix86_print_operand_address (FILE *file, rtx addr)
else
{
/* Print SImode register names to force addr32 prefix. */
- if (TARGET_64BIT
- && (GET_CODE (addr) == SUBREG
- || GET_CODE (addr) == ZERO_EXTEND
- || GET_CODE (addr) == AND))
+ if (GET_CODE (addr) == SUBREG)
+ {
+ gcc_assert (TARGET_64BIT);
+ gcc_assert (GET_MODE (addr) == SImode);
+ gcc_assert (GET_MODE (SUBREG_REG (addr)) == DImode);
+ gcc_assert (!code);
+ code = 'l';
+ }
+ else if (GET_CODE (addr) == ZERO_EXTEND
+ || GET_CODE (addr) == AND)
{
+ gcc_assert (TARGET_64BIT);
+ gcc_assert (GET_MODE (addr) == DImode);
gcc_assert (!code);
code = 'l';
}