Re: [PATCH] PR target/48240

2020-04-09 Thread Andrea Corallo
Kyrylo Tkachov  writes:

> diff --git a/gcc/config/aarch64/falkor-tag-collision-avoidance.c 
> b/gcc/config/aarch64/falkor-tag-collision-avoidance.c
> index 719df484ee61..4e07a43282f7 100644
> --- a/gcc/config/aarch64/falkor-tag-collision-avoidance.c
> +++ b/gcc/config/aarch64/falkor-tag-collision-avoidance.c
> @@ -538,9 +538,12 @@ valid_src_p (rtx src, rtx_insn *insn, struct loop *loop, 
> bool *pre_post,
>if (!aarch64_classify_address (, XEXP (x, 0), mode, true))
>  return false;
>  
> -  unsigned regno = REGNO (addr.base);
> -  if (global_regs[regno] || fixed_regs[regno])
> -return false;
> +  if (REG_P (addr.base))
> +{
> +  unsigned regno = REGNO (addr.base);
> +  if (global_regs[regno] || fixed_regs[regno])
> + return false;
> +}
>
> I think we want to just return false here if !REG_P (addr.base) rather than 
> fall through?

I think functionally would be equivalent cause after we guard on
addr.type, but probably nicer.

> +++ b/gcc/testsuite/gcc.target/aarch64/pr48240.c
> @@ -0,0 +1,9 @@
> +/* { dg-do compile } */
> +/* { dg-options "-v -Os -mcpu=falkor -mpc-relative-literal-loads 
> -mcmodel=large" } */
>
> We shouldn't need the "-v" here...

Ack

> Ok with those changes.
> Thanks,
> Kyrill

Thanks for reviewing updating the patch!

  Andrea


Re: [PATCH] PR target/48240

2020-04-09 Thread Andrea Corallo
Richard Sandiford  writes:

> Andrea Corallo  writes:
>> Hi all,
>>
>> I'd like to submit this for PR48240.
>>
>> Bootstrapped on aarch64-unknown-linux-gnu.
>> Okay for trunk when finished with regression?
>
> OK, but the PR number looks like a typo.  Also:

Ooops, no idea how did I managed to generated this number.

>> Andrea
>>
>> gcc/ChangeLog
>>
>> 2020-??-??  Andrea Corallo  
>>
>>  PR target/48240
>>  * gcc/config/aarch64/falkor-tag-collision-avoidance.c
>>  (valid_src_p): Fix missing rtx type check.
>
> no gcc/ prefix here.
>
> Thanks,
> Richard


RE: [PATCH] PR target/48240

2020-04-08 Thread Kyrylo Tkachov
Hi Andrea

> -Original Message-
> From: Gcc-patches  On Behalf Of Andrea
> Corallo
> Sent: 08 April 2020 15:19
> To: gcc-patches@gcc.gnu.org
> Cc: nd 
> Subject: [PATCH] PR target/48240
> 
> Hi all,
> 
> I'd like to submit this for PR48240.
> 
> Bootstrapped on aarch64-unknown-linux-gnu.
> Okay for trunk when finished with regression?
> 
> Andrea
> 
> gcc/ChangeLog
> 
> 2020-??-??  Andrea Corallo  
> 
>   PR target/48240
>   * gcc/config/aarch64/falkor-tag-collision-avoidance.c
>   (valid_src_p): Fix missing rtx type check.
> 
> gcc/testsuite/ChangeLog
> 
> 2020-??-??  Andrea Corallo  
> 
>   * gcc.target/aarch64/pr48240.c: New test.

>From 246337341a8b58c61dc29d2198b244da737b3ef0 Mon Sep 17 00:00:00 2001
From: Andrea Corallo 
Date: Wed, 8 Apr 2020 13:38:28 +0100
Subject: [PATCH] pr48240

---
 gcc/config/aarch64/falkor-tag-collision-avoidance.c | 9 ++---
 gcc/testsuite/gcc.target/aarch64/pr48240.c  | 9 +
 2 files changed, 15 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/pr48240.c

diff --git a/gcc/config/aarch64/falkor-tag-collision-avoidance.c 
b/gcc/config/aarch64/falkor-tag-collision-avoidance.c
index 719df484ee61..4e07a43282f7 100644
--- a/gcc/config/aarch64/falkor-tag-collision-avoidance.c
+++ b/gcc/config/aarch64/falkor-tag-collision-avoidance.c
@@ -538,9 +538,12 @@ valid_src_p (rtx src, rtx_insn *insn, struct loop *loop, 
bool *pre_post,
   if (!aarch64_classify_address (, XEXP (x, 0), mode, true))
 return false;
 
-  unsigned regno = REGNO (addr.base);
-  if (global_regs[regno] || fixed_regs[regno])
-return false;
+  if (REG_P (addr.base))
+{
+  unsigned regno = REGNO (addr.base);
+  if (global_regs[regno] || fixed_regs[regno])
+   return false;
+}

I think we want to just return false here if !REG_P (addr.base) rather than 
fall through?

 
   if (addr.type == ADDRESS_REG_WB)
 {
diff --git a/gcc/testsuite/gcc.target/aarch64/pr48240.c 
b/gcc/testsuite/gcc.target/aarch64/pr48240.c
new file mode 100644
index ..012af6afeca7
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr48240.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-v -Os -mcpu=falkor -mpc-relative-literal-loads 
-mcmodel=large" } */

We shouldn't need the "-v" here...

Ok with those changes.
Thanks,
Kyrill

+
+extern void bar(const char *);
+
+void foo(void) {
+  for (;;)
+bar("");
+}
-- 
2.17.1



Re: [PATCH] PR target/48240

2020-04-08 Thread Richard Sandiford
Andrea Corallo  writes:
> Hi all,
>
> I'd like to submit this for PR48240.
>
> Bootstrapped on aarch64-unknown-linux-gnu.
> Okay for trunk when finished with regression?

OK, but the PR number looks like a typo.  Also:

> Andrea
>
> gcc/ChangeLog
>
> 2020-??-??  Andrea Corallo  
>
>   PR target/48240
>   * gcc/config/aarch64/falkor-tag-collision-avoidance.c
>   (valid_src_p): Fix missing rtx type check.

no gcc/ prefix here.

Thanks,
Richard

>
> gcc/testsuite/ChangeLog
>
> 2020-??-??  Andrea Corallo  
>
>   * gcc.target/aarch64/pr48240.c: New test.
>
> From 246337341a8b58c61dc29d2198b244da737b3ef0 Mon Sep 17 00:00:00 2001
> From: Andrea Corallo 
> Date: Wed, 8 Apr 2020 13:38:28 +0100
> Subject: [PATCH] pr48240
>
> ---
>  gcc/config/aarch64/falkor-tag-collision-avoidance.c | 9 ++---
>  gcc/testsuite/gcc.target/aarch64/pr48240.c  | 9 +
>  2 files changed, 15 insertions(+), 3 deletions(-)
>  create mode 100644 gcc/testsuite/gcc.target/aarch64/pr48240.c
>
> diff --git a/gcc/config/aarch64/falkor-tag-collision-avoidance.c 
> b/gcc/config/aarch64/falkor-tag-collision-avoidance.c
> index 719df484ee61..4e07a43282f7 100644
> --- a/gcc/config/aarch64/falkor-tag-collision-avoidance.c
> +++ b/gcc/config/aarch64/falkor-tag-collision-avoidance.c
> @@ -538,9 +538,12 @@ valid_src_p (rtx src, rtx_insn *insn, struct loop *loop, 
> bool *pre_post,
>if (!aarch64_classify_address (, XEXP (x, 0), mode, true))
>  return false;
>  
> -  unsigned regno = REGNO (addr.base);
> -  if (global_regs[regno] || fixed_regs[regno])
> -return false;
> +  if (REG_P (addr.base))
> +{
> +  unsigned regno = REGNO (addr.base);
> +  if (global_regs[regno] || fixed_regs[regno])
> + return false;
> +}
>  
>if (addr.type == ADDRESS_REG_WB)
>  {
> diff --git a/gcc/testsuite/gcc.target/aarch64/pr48240.c 
> b/gcc/testsuite/gcc.target/aarch64/pr48240.c
> new file mode 100644
> index ..012af6afeca7
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/aarch64/pr48240.c
> @@ -0,0 +1,9 @@
> +/* { dg-do compile } */
> +/* { dg-options "-v -Os -mcpu=falkor -mpc-relative-literal-loads 
> -mcmodel=large" } */
> +
> +extern void bar(const char *);
> +
> +void foo(void) {
> +  for (;;)
> +bar("");
> +}