This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH 06/10] [ARC] Update legitimate constant hook.
- From: Andrew Burgess <andrew dot burgess at embecosm dot com>
- To: Claudiu Zissulescu <Claudiu dot Zissulescu at synopsys dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Francois dot Bedard at synopsys dot com, Claudiu Zissulescu <claziss at gmail dot com>
- Date: Thu, 7 Dec 2017 23:30:00 +0000
- Subject: Re: [PATCH 06/10] [ARC] Update legitimate constant hook.
- Authentication-results: sourceware.org; auth=none
- References: <1511780999-27757-1-git-send-email-claziss@synopsys.com> <1511780999-27757-7-git-send-email-claziss@synopsys.com>
* Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com> [2017-11-27 12:09:55 +0100]:
> From: Claudiu Zissulescu <claziss@gmail.com>
>
> Make sure we check the constants in all cases.
>
> gcc/
> 2017-10-14 Claudiu Zissulescu <claziss@synopsys.com>
>
> * config/arc/arc.c (arc_legitimate_constant_p): Always check all
> constants.
>
> testsuite/
> 2017-10-14 Claudiu Zissulescu <claziss@synopsys.com>
>
> * gcc.target/arc/tls-1.c: New test.
Looks good.
Thanks,
Andrew
> ---
> gcc/config/arc/arc.c | 6 ------
> gcc/testsuite/gcc.target/arc/tls-1.c | 26 ++++++++++++++++++++++++++
> 2 files changed, 26 insertions(+), 6 deletions(-)
> create mode 100644 gcc/testsuite/gcc.target/arc/tls-1.c
>
> diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
> index 4d7a282..42ea921 100644
> --- a/gcc/config/arc/arc.c
> +++ b/gcc/config/arc/arc.c
> @@ -6185,12 +6185,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/gcc.target/arc/tls-1.c b/gcc/testsuite/gcc.target/arc/tls-1.c
> new file mode 100644
> index 0000000..3f7a6d4
> --- /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" } } */
> --
> 1.9.1
>