Commit b15b83fb by Jakub Jelinek Committed by Jakub Jelinek

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
parent dca13767
2005-11-30 Jakub Jelinek <jakub@redhat.com> 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 * config/ia64/ia64.c (ia64_expand_atomic_op): Only use
fetchadd{4,8}.acq instruction if CODE is PLUS or MINUS, for MINUS fetchadd{4,8}.acq instruction if CODE is PLUS or MINUS, for MINUS
negate VAL. negate VAL.
......
...@@ -891,15 +891,12 @@ gen_thread_pointer (void) ...@@ -891,15 +891,12 @@ gen_thread_pointer (void)
static rtx static rtx
ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1, 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 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; HOST_WIDE_INT addend_lo, addend_hi;
addend_lo = ((addend & 0x3fff) ^ 0x2000) - 0x2000;
addend_hi = addend - addend_lo;
switch (tls_kind) switch (tls_kind)
{ {
case TLS_MODEL_GLOBAL_DYNAMIC: case TLS_MODEL_GLOBAL_DYNAMIC:
...@@ -959,6 +956,9 @@ ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1, ...@@ -959,6 +956,9 @@ ia64_expand_tls_address (enum tls_model tls_kind, rtx op0, rtx op1,
break; break;
case TLS_MODEL_INITIAL_EXEC: case TLS_MODEL_INITIAL_EXEC:
addend_lo = ((addend & 0x3fff) ^ 0x2000) - 0x2000;
addend_hi = addend - addend_lo;
op1 = plus_constant (op1, addend_hi); op1 = plus_constant (op1, addend_hi);
addend = addend_lo; addend = addend_lo;
...@@ -1023,7 +1023,7 @@ ia64_expand_move (rtx op0, rtx op1) ...@@ -1023,7 +1023,7 @@ ia64_expand_move (rtx op0, rtx op1)
tls_kind = tls_symbolic_operand_type (sym); tls_kind = tls_symbolic_operand_type (sym);
if (tls_kind) 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)) if (any_offset_symbol_operand (sym, mode))
addend = 0; addend = 0;
......
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> 2005-11-29 Joseph S. Myers <joseph@codesourcery.com>
* gcc.dg/torture/fp-int-convert-timode.c: XFAIL only on lp64 * gcc.dg/torture/fp-int-convert-timode.c: XFAIL only on lp64
/* { 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment