From patchwork Wed Oct 29 10:05:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 404497 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 DD880140085 for ; Wed, 29 Oct 2014 21:05:31 +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=g4LZLwsKfQx5Py5fcanTUs6t7lo33LdwfC1CBaYUGVe eJfcTnmOH7YLH5SKo0i98fv32o46HCNT+3unk2peNDV6zCFfR4j6yK65kTCe5oip JQiDBQdwbp4C+is69KoNPifsadkPUoFndtWNcFA/XgcgbVcrZ12jXNsbfp0yJyPU = 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=uXC4Z1y42RcgXQQOW94Il2xNFos=; b=gf4KQQ64UtWRKYtMR +s8ac14p10VIcoddlvR6ww1PyHCnQ9AHGn9RG4uUsAVIrvulBfFTQSbHKcxWYj0H S68sspDGjwqC+L5UNhibn/lOv4ue/VK8tynukpO9N4HGp7ynQhWPzCJRcW+0iZNT BD0Ipg2p2//poeiLf7/wLO2CgE= Received: (qmail 308 invoked by alias); 29 Oct 2014 10:05:12 -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 32744 invoked by uid 89); 29 Oct 2014 10:05:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: service87.mimecast.com Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 29 Oct 2014 10:05:09 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 29 Oct 2014 10:05:06 +0000 Received: from [10.1.207.43] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 29 Oct 2014 10:05:05 +0000 Message-ID: <5450BBD0.3060909@arm.com> Date: Wed, 29 Oct 2014 10:05:04 +0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: GCC Patches CC: Ramana Radhakrishnan , Richard Earnshaw , 'Jakub Jelinek' , Marcus Shawcroft Subject: [PATCH][AArch64][4.9] Restore recog state after finding pre-madd instruction X-MC-Unique: 114102910050612301 X-IsSubscribed: yes Hi all, This is the backport of the trunk patch posted at https://gcc.gnu.org/ml/gcc-patches/2014-10/msg03019.html. It is essentially the same content (only the diff context differs). Jakub, this is a regression fix so, if ok'd, can we get this into 4.9.2 please? Bootstrapped and regtested on aarch64-none-linux-gnu. Thanks, Kyrill 2014-10-28 Kyrylo Tkachov * config/aarch64/aarch64.c (aarch64_madd_needs_nop): Restore recog state after aarch64_prev_real_insn call. 2014-10-28 Kyrylo Tkachov * gcc.target/aarch64/madd_after_asm_1.c: New test. diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 34354d4..52c0471 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -6557,6 +6557,10 @@ aarch64_madd_needs_nop (rtx insn) return false; prev = aarch64_prev_real_insn (insn); + /* aarch64_prev_real_insn can call recog_memoized on insns other than INSN. + Restore recog state to INSN to avoid state corruption. */ + extract_constrain_insn_cached (insn); + if (!prev) return false; diff --git a/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c b/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c new file mode 100644 index 0000000..523941d --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c @@ -0,0 +1,14 @@ +/* { dg-do assemble } */ +/* { dg-options "-O2 -mfix-cortex-a53-835769" } */ + +int +test (int a, double b, int c, int d, int e) +{ + double result; + __asm__ __volatile ("// %0, %1" + : "=w" (result) + : "0" (b) + : /* No clobbers */ + ); + return c * d + e; +}