Commit 4be6c9b9 by Claudiu Zissulescu Committed by Claudiu Zissulescu

[ARC] Fix emitting TLS symbols.

When storing a TLS symbol to memory, always use an intermediate register to load it.

gcc/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.c (prepare_move_operands): Always use an
	intermediate register when storing a TLS symbols.

gcc/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* gcc/testsuite/gcc.target/arc/tls-2.c: New test.
	* gcc/testsuite/gcc.target/arc/tls-3.c: Likewise.

From-SVN: r273657
parent 9e23d3bb
2019-07-22 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc.c (prepare_move_operands): Always use an
intermediate register when storing a TLS symbols.
2019-07-22 Stafford Horne <shorne@gmail.com> 2019-07-22 Stafford Horne <shorne@gmail.com>
* config/or1k/or1k.c (or1k_expand_compare): Check for int before * config/or1k/or1k.c (or1k_expand_compare): Check for int before
......
...@@ -8959,7 +8959,7 @@ prepare_move_operands (rtx *operands, machine_mode mode) ...@@ -8959,7 +8959,7 @@ prepare_move_operands (rtx *operands, machine_mode mode)
if (GET_CODE (operands[1]) == SYMBOL_REF) if (GET_CODE (operands[1]) == SYMBOL_REF)
{ {
enum tls_model model = SYMBOL_REF_TLS_MODEL (operands[1]); enum tls_model model = SYMBOL_REF_TLS_MODEL (operands[1]);
if (MEM_P (operands[0]) && flag_pic) if (MEM_P (operands[0]))
operands[1] = force_reg (mode, operands[1]); operands[1] = force_reg (mode, operands[1]);
else if (model) else if (model)
operands[1] = arc_legitimize_tls_address (operands[1], model); operands[1] = arc_legitimize_tls_address (operands[1], model);
......
2019-07-22 Claudiu Zissulescu <claziss@synopsys.com>
* gcc.target/arc/tls-2.c: New test.
* gcc.target/arc/tls-3.c: Likewise.
2019-07-21 Marek Polacek <polacek@redhat.com> 2019-07-21 Marek Polacek <polacek@redhat.com>
PR c++/67853 PR c++/67853
......
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-skip-if "" { arc*-*-elf* } } */
/* { dg-options "-O2" } */
typedef int type_a;
__thread int b;
int c;
extern int bar (char *, int, int *, int, int *, char, type_a, int *, int *);
int foo (int *f, char buffer, type_a buflen, int *g)
{
bar("", c, (int *)foo, 1, (int *)f, buffer, buflen, (int *)g, &b);
}
/* { dg-do compile } */
/* { dg-require-effective-target tls } */
/* { dg-skip-if "" { arc*-*-elf* } } */
/* { dg-options "-Os -fPIC" } */
typedef struct
{
int(a);
char b[];
} type_c;
extern int bar (char *, int, char *);
static _Thread_local type_c d;
int foo(void)
{
bar(d.b, 0, d.b);
}
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