re PR target/18910 (unrecognisable insn in regclass on x86/amd64)
PR target/18910 * config/i386/i386.c (ix86_expand_move): Handle tls symbols with an offset. Co-Authored-By: Richard Henderson <rth@redhat.com> From-SVN: r92968
This commit is contained in:
parent
2cdb314898
commit
d2ad2c8a9c
3 changed files with 45 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
2005-01-05 Jan Hubicka <jh@suse.cz>
|
||||
Richard Henderson <rth@redhat.com>
|
||||
|
||||
PR target/18910
|
||||
* config/i386/i386.c (ix86_expand_move): Handle tls symbols
|
||||
with an offset.
|
||||
|
||||
2005-01-05 Richard Henderson <rth@redhat.com>
|
||||
|
||||
PR target/12902
|
||||
|
|
|
@ -7472,13 +7472,32 @@ ix86_expand_move (enum machine_mode mode, rtx operands[])
|
|||
op0 = operands[0];
|
||||
op1 = operands[1];
|
||||
|
||||
model = GET_CODE (op1) == SYMBOL_REF ? SYMBOL_REF_TLS_MODEL (op1) : 0;
|
||||
if (model)
|
||||
if (GET_CODE (op1) == SYMBOL_REF)
|
||||
{
|
||||
op1 = legitimize_tls_address (op1, model, true);
|
||||
op1 = force_operand (op1, op0);
|
||||
if (op1 == op0)
|
||||
return;
|
||||
model = SYMBOL_REF_TLS_MODEL (op1);
|
||||
if (model)
|
||||
{
|
||||
op1 = legitimize_tls_address (op1, model, true);
|
||||
op1 = force_operand (op1, op0);
|
||||
if (op1 == op0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (GET_CODE (op1) == CONST
|
||||
&& GET_CODE (XEXP (op1, 0)) == PLUS
|
||||
&& GET_CODE (XEXP (XEXP (op1, 0), 0)) == SYMBOL_REF)
|
||||
{
|
||||
model = SYMBOL_REF_TLS_MODEL (XEXP (XEXP (op1, 0), 0));
|
||||
if (model)
|
||||
{
|
||||
rtx addend = XEXP (XEXP (op1, 0), 1);
|
||||
op1 = legitimize_tls_address (XEXP (XEXP (op1, 0), 0), model, true);
|
||||
op1 = force_operand (op1, NULL);
|
||||
op1 = expand_simple_binop (Pmode, PLUS, op1, addend,
|
||||
op0, 1, OPTAB_DIRECT);
|
||||
if (op1 == op0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag_pic && mode == Pmode && symbolic_operand (op1, Pmode))
|
||||
|
|
13
gcc/testsuite/gcc.dg/tls/opt-8.c
Normal file
13
gcc/testsuite/gcc.dg/tls/opt-8.c
Normal file
|
@ -0,0 +1,13 @@
|
|||
/* PR 18910 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2" } */
|
||||
|
||||
static __thread void *foo [2];
|
||||
void
|
||||
test1 (void)
|
||||
{
|
||||
unsigned int s;
|
||||
|
||||
for (s = 0; s < 2; ++s)
|
||||
foo [s] = &foo[s];
|
||||
}
|
Loading…
Add table
Reference in a new issue