This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PR target/20928 (unrecognized insn)
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at redhat dot com
- Date: Mon, 31 Oct 2005 15:46:00 +0100
- Subject: PR target/20928 (unrecognized insn)
Hi,
problem in the testcase is loop optimizer constructing
(const (plus (symbol_ref "blah) (const_int very_large_number)))
where very_large_number does not encode as sign extended immediate and thus
needs to be split up. This patch teach legitimize_pic_address to use temporary
register and movabs in such scenarios.
Bootstrapped/regtested x86_64-pc-gnu-linux, OK?
extern struct bar_t bar;
void
foo (void)
{
void **p;
do {
*p++ = ((unsigned char *) &bar + ((unsigned long int) 1L << 31));
} while (p);
}
2005-10-31 Jan Hubicka <jh@suse.cz>
PR target/20928
* i386.c (legitimize_pic_address): Deal with large immediates.
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 106026)
+++ config/i386/i386.c (working copy)
@@ -6016,7 +6016,18 @@ legitimize_pic_address (rtx orig, rtx re
}
else
{
- if (GET_CODE (addr) == CONST)
+ if (GET_CODE (addr) == CONST_INT
+ && !x86_64_immediate_operand (addr, VOIDmode))
+ {
+ if (reg)
+ {
+ emit_move_insn (reg, addr);
+ new = reg;
+ }
+ else
+ new = force_reg (DImode, addr);
+ }
+ else if (GET_CODE (addr) == CONST)
{
addr = XEXP (addr, 0);