ia64.c (ia64_expand_tls_address): Add ORIG_OP1 argument.

* config/ia64/ia64.c (ia64_expand_tls_address): Add ORIG_OP1 argument.
	Move ADDEND_{HI,LO} computation into TLS_MODEL_INITIAL_EXEC case.
	(ia64_expand_move): Adjust caller.

	* gcc.dg/tls/opt-11.c: New test.

From-SVN: r107704
This commit is contained in:
Jakub Jelinek 2005-11-30 09:32:16 +01:00 committed by Jakub Jelinek
parent dca1376799
commit b15b83fb3b
4 changed files with 46 additions and 6 deletions

View File

@ -1,5 +1,9 @@
2005-11-30 Jakub Jelinek <jakub@redhat.com>
* config/ia64/ia64.c (ia64_expand_tls_address): Add ORIG_OP1 argument.
Move ADDEND_{HI,LO} computation into TLS_MODEL_INITIAL_EXEC case.
(ia64_expand_move): Adjust caller.
* config/ia64/ia64.c (ia64_expand_atomic_op): Only use
fetchadd{4,8}.acq instruction if CODE is PLUS or MINUS, for MINUS
negate VAL.

View File

@ -891,15 +891,12 @@ gen_thread_pointer (void)
static rtx
ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1,
HOST_WIDE_INT addend)
rtx orig_op1, HOST_WIDE_INT addend)
{
rtx tga_op1, tga_op2, tga_ret, tga_eqv, tmp, insns;
rtx orig_op0 = op0, orig_op1 = op1;
rtx orig_op0 = op0;
HOST_WIDE_INT addend_lo, addend_hi;
addend_lo = ((addend & 0x3fff) ^ 0x2000) - 0x2000;
addend_hi = addend - addend_lo;
switch (tls_kind)
{
case TLS_MODEL_GLOBAL_DYNAMIC:
@ -959,6 +956,9 @@ ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1,
break;
case TLS_MODEL_INITIAL_EXEC:
addend_lo = ((addend & 0x3fff) ^ 0x2000) - 0x2000;
addend_hi = addend - addend_lo;
op1 = plus_constant (op1, addend_hi);
addend = addend_lo;
@ -1023,7 +1023,7 @@ ia64_expand_move (rtx op0, rtx op1)
tls_kind = tls_symbolic_operand_type (sym);
if (tls_kind)
return ia64_expand_tls_address (tls_kind, op0, sym, addend);
return ia64_expand_tls_address (tls_kind, op0, sym, op1, addend);
if (any_offset_symbol_operand (sym, mode))
addend = 0;

View File

@ -1,3 +1,7 @@
2005-11-30 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/tls/opt-11.c: New test.
2005-11-29 Joseph S. Myers <joseph@codesourcery.com>
* gcc.dg/torture/fp-int-convert-timode.c: XFAIL only on lp64

View File

@ -0,0 +1,32 @@
/* { dg-do run } */
extern void abort (void);
extern void *memset (void *, int, __SIZE_TYPE__);
struct A
{
char pad[48];
int i;
int pad2;
int j;
};
__thread struct A a;
int *
__attribute__((noinline))
foo (void)
{
return &a.i;
}
int
main (void)
{
int *p = foo ();
memset (&a, 0, sizeof (a));
a.i = 6;
a.j = 8;
if (p[0] != 6 || p[1] != 0 || p[2] != 8)
abort ();
return 0;
}