public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kyrill  Tkachov <kyrylo.tkachov@foss.arm.com>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: "Richard Earnshaw (lists)" <richard.earnshaw@arm.com>,
	 James Greenhalgh <james.greenhalgh@arm.com>,
	Marcus Shawcroft <marcus.shawcroft@arm.com>
Subject: [PATCH][AArch64][2/3] PR target/84164: Add ZERO_EXTRACT + LSHIFTRT pattern for BFXIL instruction
Date: Thu, 08 Feb 2018 17:10:00 -0000	[thread overview]
Message-ID: <5A7C849C.6090107@foss.arm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]

Hi all,

This is a followup to the other PR target/84164 patch [1] that fixes the testsuite regression
gcc.target/aarch64/bfxil_1.c.
The regression is that with the new subreg+masking simplification we no longer match the
pattern for BFXIL that has the form:
(set (zero_extract:DI (reg/v:DI 76 [ a ])
         (const_int 8 [0x8])
         (const_int 0 [0]))
     (zero_extract:DI (reg/v:DI 76 [ a ])
         (const_int 8 [0x8])
         (const_int 16 [0x10])))

This is now instead represented as:
(set (zero_extract:DI (reg/v:DI 93 [ a ])
         (const_int 8 [0x8])
         (const_int 0 [0]))
     (lshiftrt:DI (reg/v:DI 93 [ a ])
         (const_int 16 [0x10])))

As far as I can see the two are equivalent semantically and the LSHIFTRT form is a bit
simpler, so I think the simplified form is valid, but we have no pattern to match it.
This patch adds that pattern to catch this form as well.
This fixes the aforementioned regression and bootstrap and testing on aarch64-none-linux-gnu
shows no problem.

Is this ok for trunk if the first patch goes in?
Thanks,
Kyrill

[1] https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00443.html

2018-02-08  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

     PR target/84164
     * config/aarch64/aarch64.md (*extr_insv_lower_reg_lshiftrt<mode>):
     New pattern.

[-- Attachment #2: aarch64-bfxil-2.patch --]
[-- Type: text/x-patch, Size: 978 bytes --]

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 62a4f8262a316087894aeb555c609fbe75885203..2c6343a363c161ed503ca1ddd752e21b5c941eb8 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -4803,6 +4803,19 @@ (define_insn "*extr_insv_lower_reg<mode>"
   [(set_attr "type" "bfm")]
 )
 
+(define_insn "*extr_insv_lower_reg_lshiftrt<mode>"
+  [(set (zero_extract:GPI (match_operand:GPI 0 "register_operand" "+r")
+			  (match_operand 1 "const_int_operand" "n")
+			  (const_int 0))
+	(lshiftrt:GPI (match_operand:GPI 2 "register_operand" "r")
+			(match_operand 3 "const_int_operand" "n")))]
+  "!(UINTVAL (operands[1]) == 0
+     || (UINTVAL (operands[3]) + UINTVAL (operands[1])
+	 > GET_MODE_BITSIZE (<MODE>mode)))"
+  "bfxil\\t%<w>0, %<w>2, %3, %1"
+  [(set_attr "type" "bfm")]
+)
+
 (define_insn "*<optab><ALLX:mode>_shft_<GPI:mode>"
   [(set (match_operand:GPI 0 "register_operand" "=r")
 	(ashift:GPI (ANY_EXTEND:GPI

             reply	other threads:[~2018-02-08 17:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08 17:10 Kyrill Tkachov [this message]
2018-03-02 17:36 ` Kyrill Tkachov
2018-03-08 13:34 ` James Greenhalgh

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=5A7C849C.6090107@foss.arm.com \
    --to=kyrylo.tkachov@foss.arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=james.greenhalgh@arm.com \
    --cc=marcus.shawcroft@arm.com \
    --cc=richard.earnshaw@arm.com \
    /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).