From 2bd36ebab737f4bd3f5d306b269ffdff22eace4f Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Mon, 18 Dec 2017 16:26:35 +0100 Subject: [PATCH] [ARC] Update legitimate constant hook. Make sure we check the constants in all cases. gcc/ 2017-10-14 Claudiu Zissulescu * config/arc/arc.c (arc_legitimate_constant_p): Always check all constants. testsuite/ 2017-10-14 Claudiu Zissulescu * gcc.target/arc/tls-1.c: New test. From-SVN: r255778 --- gcc/ChangeLog | 5 +++++ gcc/config/arc/arc.c | 6 ------ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/arc/tls-1.c | 26 ++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.target/arc/tls-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 128374c1287..84046fffb17 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-12-18 Claudiu Zissulescu + + * config/arc/arc.c (arc_legitimate_constant_p): Always check all + constants. + 2017-12-18 Andreas Krebbel PR target/83420 diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index d1d0d727df1..29c2a0f5314 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -5999,12 +5999,6 @@ arc_return_addr_rtx (int count, ATTRIBUTE_UNUSED rtx frame) bool arc_legitimate_constant_p (machine_mode mode, rtx x) { - if (GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (x)) - return false; - - if (!flag_pic && mode != Pmode) - return true; - switch (GET_CODE (x)) { case CONST: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index afcdd206d5f..844fc960f7d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-12-18 Claudiu Zissulescu + + * gcc.target/arc/tls-1.c: New test. + 2017-12-18 Richard Biener PR tree-optimization/81877 diff --git a/gcc/testsuite/gcc.target/arc/tls-1.c b/gcc/testsuite/gcc.target/arc/tls-1.c new file mode 100644 index 00000000000..3f7a6d49f59 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/tls-1.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target tls } */ +/* { dg-options "-O3 -std=gnu99" } */ + +/* Check if addressing the `pos` member of struct is done via tls + mechanism. */ + +struct callchain_cursor { + int last; + long long pos; +} __thread a; +void fn1(struct callchain_cursor *p1) +{ + p1->pos++; +} + +extern void fn3 (void); + +void fn2(void) { + struct callchain_cursor *b = &a; + while (1) { + fn3(); + fn1(b); + } +} +/* { dg-final { scan-assembler "r25,@a@tpoff" } } */ -- 2.30.2