public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][AArch64] Fix generation of tst (PR87763)
@ 2019-01-24 15:39 Wilco Dijkstra
  2019-01-24 15:44 ` Richard Earnshaw (lists)
  2019-01-24 21:10 ` Segher Boessenkool
  0 siblings, 2 replies; 3+ messages in thread
From: Wilco Dijkstra @ 2019-01-24 15:39 UTC (permalink / raw)
  To: GCC Patches, James Greenhalgh, Richard Earnshaw; +Cc: nd

The TST instruction no longer matches in all cases due to changes in
Combine.  The fix is simple, we now need to allow a subreg as well when
selecting the cc_mode.  This fixes the tst_5.c and tst_6.c failures.

AArch64 regress & bootstrap OK.

ChangeLog:
2019-01-23  Wilco Dijkstra  <wdijkstr@arm.com>

	PR rtl-optimization/87763
	* config/aarch64/aarch64.c (aarch64_select_cc_mode):
	Allow SUBREG when matching CC_NZmode compare.

--

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index a0006dc1f8a921dd83209d4404132a1fe3cfcd1e..237428d28b4f20ddfefee83ed020e209011147a0 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -7120,7 +7120,7 @@ aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y)
 
   /* Equality comparisons of short modes against zero can be performed
      using the TST instruction with the appropriate bitmask.  */
-  if (y == const0_rtx && REG_P (x)
+  if (y == const0_rtx && (REG_P (x) || SUBREG_P (x))
       && (code == EQ || code == NE)
       && (GET_MODE (x) == HImode || GET_MODE (x) == QImode))
     return CC_NZmode;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][AArch64] Fix generation of tst (PR87763)
  2019-01-24 15:39 [PATCH][AArch64] Fix generation of tst (PR87763) Wilco Dijkstra
@ 2019-01-24 15:44 ` Richard Earnshaw (lists)
  2019-01-24 21:10 ` Segher Boessenkool
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Earnshaw (lists) @ 2019-01-24 15:44 UTC (permalink / raw)
  To: Wilco Dijkstra, GCC Patches, James Greenhalgh; +Cc: nd

On 24/01/2019 15:36, Wilco Dijkstra wrote:
> The TST instruction no longer matches in all cases due to changes in
> Combine.  The fix is simple, we now need to allow a subreg as well when
> selecting the cc_mode.  This fixes the tst_5.c and tst_6.c failures.
> 
> AArch64 regress & bootstrap OK.
> 
> ChangeLog:
> 2019-01-23  Wilco Dijkstra  <wdijkstr@arm.com>
> 
> 	PR rtl-optimization/87763
> 	* config/aarch64/aarch64.c (aarch64_select_cc_mode):
> 	Allow SUBREG when matching CC_NZmode compare.
> 
> --
> 
> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
> index a0006dc1f8a921dd83209d4404132a1fe3cfcd1e..237428d28b4f20ddfefee83ed020e209011147a0 100644
> --- a/gcc/config/aarch64/aarch64.c
> +++ b/gcc/config/aarch64/aarch64.c
> @@ -7120,7 +7120,7 @@ aarch64_select_cc_mode (RTX_CODE code, rtx x, rtx y)
>  
>    /* Equality comparisons of short modes against zero can be performed
>       using the TST instruction with the appropriate bitmask.  */
> -  if (y == const0_rtx && REG_P (x)
> +  if (y == const0_rtx && (REG_P (x) || SUBREG_P (x))
>        && (code == EQ || code == NE)
>        && (GET_MODE (x) == HImode || GET_MODE (x) == QImode))
>      return CC_NZmode;
> 

OK.

R.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][AArch64] Fix generation of tst (PR87763)
  2019-01-24 15:39 [PATCH][AArch64] Fix generation of tst (PR87763) Wilco Dijkstra
  2019-01-24 15:44 ` Richard Earnshaw (lists)
@ 2019-01-24 21:10 ` Segher Boessenkool
  1 sibling, 0 replies; 3+ messages in thread
From: Segher Boessenkool @ 2019-01-24 21:10 UTC (permalink / raw)
  To: Wilco Dijkstra; +Cc: GCC Patches, James Greenhalgh, Richard Earnshaw, nd

On Thu, Jan 24, 2019 at 03:36:46PM +0000, Wilco Dijkstra wrote:
> The TST instruction no longer matches in all cases due to changes in
> Combine.  The fix is simple, we now need to allow a subreg as well when
> selecting the cc_mode.

You needed to before, it just wasn't as obvious yet.  It now is exposed
in the simplest testcases (hard regs, as you used to have from function
arguments here, can be referred to in any mode, without subreg).


Segher

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-24 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-24 15:39 [PATCH][AArch64] Fix generation of tst (PR87763) Wilco Dijkstra
2019-01-24 15:44 ` Richard Earnshaw (lists)
2019-01-24 21:10 ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).