public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] simplify-rtx: Simplify VEC_CONCAT of SUBREG and VEC_CONCAT from same vector
Date: Fri, 16 Jun 2023 20:31:26 -0600	[thread overview]
Message-ID: <4c7afcac-08a8-1951-a686-2467218322b7@gmail.com> (raw)
In-Reply-To: <PAXPR08MB6926013E68A39AAC52E896599358A@PAXPR08MB6926.eurprd08.prod.outlook.com>



On 6/16/23 03:06, Kyrylo Tkachov via Gcc-patches wrote:
> Hi all,
> 
> In the testcase for this patch we try to vec_concat the lowpart and highpart of a vector, but the lowpart is expressed as a subreg.
> simplify-rtx.cc does not recognise this and combine ends up trying to match:
> Trying 7 -> 8:
>      7: r93:V2SI=vec_select(r95:V4SI,parallel)
>      8: r97:V4SI=vec_concat(r95:V4SI#0,r93:V2SI)
>        REG_DEAD r95:V4SI
>        REG_DEAD r93:V2SI
> Failed to match this instruction:
> (set (reg:V4SI 97)
>      (vec_concat:V4SI (subreg:V2SI (reg/v:V4SI 95 [ a ]) 0)
>          (vec_select:V2SI (reg/v:V4SI 95 [ a ])
>              (parallel:V4SI [
>                      (const_int 2 [0x2])
>                      (const_int 3 [0x3])
>                  ]))))
> 
> This should be just (set (reg:V4SI 97) (reg:V4SI 95)). This patch adds such a simplification.
> The testcase is a bit artificial, but I do have other aarch64-specific patterns that I want to optimise later
> that rely on this simplification happening.
> 
> Without this patch for the testcase we generate:
> foo:
>          dup     d31, v0.d[1]
>          ins     v0.d[1], v31.d[0]
>          ret
> 
> whereas we should just not generate anything as the operation is ultimately a no-op.
> 
> Bootstrapped and tested on aarch64-none-linux-gnu and aarch64_be-none-elf.
> Ok for trunk?
> Thanks,
> Kyrill
> 
> gcc/ChangeLog:
> 
> 	* simplify-rtx.cc (simplify_context::simplify_binary_operation_1):
> 	Simplify vec_concat of lowpart subreg and high part vec_select.
> 
> gcc/testsuite/ChangeLog:
> 
> 	* gcc.target/aarch64/simd/low-high-combine_1.c: New test.
OK.

Jeff

      reply	other threads:[~2023-06-17  2:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-16  9:06 Kyrylo Tkachov
2023-06-17  2:31 ` Jeff Law [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c7afcac-08a8-1951-a686-2467218322b7@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=Kyrylo.Tkachov@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).