From: Jakub Jelinek Date: Wed, 30 Nov 2005 08:32:16 +0000 (+0100) Subject: ia64.c (ia64_expand_tls_address): Add ORIG_OP1 argument. X-Git-Tag: releases/gcc-4.2.0~5672 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b15b83fb3bf49df836c84730431b68d498082825;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b7067e950028..4c2e7bed6abf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2005-11-30 Jakub Jelinek + * 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. diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c index a07cc6e2fa13..95a4cdbd39f4 100644 --- a/gcc/config/ia64/ia64.c +++ b/gcc/config/ia64/ia64.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4d9d5da25cec..57ea16df284c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2005-11-30 Jakub Jelinek + + * gcc.dg/tls/opt-11.c: New test. + 2005-11-29 Joseph S. Myers * gcc.dg/torture/fp-int-convert-timode.c: XFAIL only on lp64 diff --git a/gcc/testsuite/gcc.dg/tls/opt-11.c b/gcc/testsuite/gcc.dg/tls/opt-11.c new file mode 100644 index 000000000000..5b2cd5c98faa --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/opt-11.c @@ -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; +}