From patchwork Thu Feb 8 17:10:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrill Tkachov X-Patchwork-Id: 870974 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-472876-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="BQy14Y+J"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zcl8S33GSz9s75 for ; Fri, 9 Feb 2018 04:11:04 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=SqfwDqsjoGRbYc5OhiVITzPs8MmkO9T6wzndcCXpyth VgWBVqy0Eed1otevF+kFfuBkcz5i88YH82gjX3Fneq4yqKf8oQfThp3RWSkWIrl5 KJDB7jR107Vn07chUS6NGhUBC5D524LnO7PakkGRMhDKgNR3SB8LazHFq9Py2E10 = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=CFbmcFiTyNYiy06KfJJ6ZeAGs1g=; b=BQy14Y+JjjFkAIfVI SeMF/CjJTP6jtnveCU58NGgmZgYIhtp8hokC3hFeSYuxGjwafi5vgrjf8Mo0dbYc g4YHRSP97muFArNdriz4Un28Rcj2Vf17GPX07Unstj8f6LB3ZKLGebAYjX3rWOOS oSTZS3feQUcX2bNkKLaZHVLWpY= Received: (qmail 74615 invoked by alias); 8 Feb 2018 17:10:57 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 74564 invoked by uid 89); 8 Feb 2018 17:10:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Feb 2018 17:10:55 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ADE2D80D; Thu, 8 Feb 2018 09:10:54 -0800 (PST) Received: from [10.2.207.77] (e100706-lin.cambridge.arm.com [10.2.207.77]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E07623F24D; Thu, 8 Feb 2018 09:10:53 -0800 (PST) Message-ID: <5A7C849C.6090107@foss.arm.com> Date: Thu, 08 Feb 2018 17:10:52 +0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: "Richard Earnshaw (lists)" , James Greenhalgh , Marcus Shawcroft Subject: [PATCH][AArch64][2/3] PR target/84164: Add ZERO_EXTRACT + LSHIFTRT pattern for BFXIL instruction 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 PR target/84164 * config/aarch64/aarch64.md (*extr_insv_lower_reg_lshiftrt): New pattern. 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" [(set_attr "type" "bfm")] ) +(define_insn "*extr_insv_lower_reg_lshiftrt" + [(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)))" + "bfxil\\t%0, %2, %3, %1" + [(set_attr "type" "bfm")] +) + (define_insn "*_shft_" [(set (match_operand:GPI 0 "register_operand" "=r") (ashift:GPI (ANY_EXTEND:GPI