Hi Jiong,

I was looking at another bug and in the process of auditing our code
spotted an issue with this patch from back in June...

On Fri, Jun 19, 2015 at 10:15:38AM +0100, Jiong Wang wrote:
> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
> index 8b061ba..be9da5b 100644
> --- a/gcc/config/aarch64/aarch64.md
> +++ b/gcc/config/aarch64/aarch64.md
> +(define_insn "tlsie_tiny_sidi"
> +  [(set (match_operand:DI 0 "register_operand" "=&r")
> +     (zero_extend:DI
> +          (unspec:SI [(match_operand 1 "aarch64_tls_ie_symref" "S")
> +                   (match_operand:DI 2 "register_operand" "r")
> +                   ]
> +                   UNSPEC_GOTTINYTLS)))]
> +  ""
> +  "ldr\\t%w0, %L1\;add\\t%<w>0, %<w>0, %<w>2"

Here, you have no iterators, so the <w> will never be replaced. Consequently,
you are likely to hit an ICE if this pattern is ever used.

I presume you intended this to say

  "ldr\\t%w0, %L1\;add\\t%w0, %w0, %w2"

If so, consider that change preapproved.

Thanks,
James

> +  [(set_attr "type" "multiple")
> +   (set_attr "length" "8")]
> +)
> +
>  (define_expand "tlsle"
>    [(set (match_operand 0 "register_operand" "=r")
>          (unspec [(match_operand 1 "register_operand" "r")
> diff --git a/gcc/testsuite/gcc.target/aarch64/tlsie_tiny.c 
> b/gcc/testsuite/gcc.target/aarch64/tlsie_tiny.c
> new file mode 100644
> index 0000000..8ac01b2
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/aarch64/tlsie_tiny.c
> @@ -0,0 +1,6 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -ftls-model=initial-exec -mcmodel=tiny" } */
> +
> +#include "tls.c"
> +
> +/* { dg-final { scan-assembler-times ":gottprel:" 2 } } */

Reply via email to