From patchwork Tue Nov 19 09:02:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu Ianculescu X-Patchwork-Id: 1197306 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513997-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="hnneXk7E"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="hgc4hbhe"; 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 47HKc874Jxz9s4Y for ; Tue, 19 Nov 2019 20:03:18 +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:from :to:cc:subject:date:message-id:mime-version :content-transfer-encoding; q=dns; s=default; b=KbmGuLSy+E13JwEB 4X//e5W7iyaV5R+mAoUFxnuv1AOioBTF34jYNVRXcQ8Tx0Ige7iBvwSlQgAlvuWj vZY2n7f4JVHMXpHLW0OCEEVwbFzF8Xcy81ERejoF8dnxEy1IUQiBkvN6x02xbZyQ 5TUA5FVzVaKVSFfJTMmDeTcIuME= 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:from :to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=default; bh=OkQB6i9Of8gVZkEjAhd/p7 dNIj4=; b=hnneXk7EsjE9RLf/acQ/Zvu9nawpzq7RRA5iTmQ2SSPqa5vVpD7vMK ahUoZKZPZSGwr4T+a2mpvXIKoKKB9EkNvBvgfhozdJ2RrYIuzTtqE7NFDQ6U2+Vg OVcTSkj2hsQEgmpW3LSilaRxHCLSX8Ux4UcC3RPhCEdsUjt2ZhFsw= Received: (qmail 100225 invoked by alias); 19 Nov 2019 09:03:10 -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 100217 invoked by uid 89); 19 Nov 2019 09:03:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:3082, HContent-Transfer-Encoding:8bit X-HELO: mail-wm1-f68.google.com Received: from mail-wm1-f68.google.com (HELO mail-wm1-f68.google.com) (209.85.128.68) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Nov 2019 09:02:59 +0000 Received: by mail-wm1-f68.google.com with SMTP id b11so2244213wmb.5 for ; Tue, 19 Nov 2019 01:02:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0Kfb3gWwyi/KG7I8x1+diQ1wEM86y9hBk23MtXxv5kM=; b=hgc4hbhesZVPWjsE0jnYjQztcLL27Jz5UF0TShNbK92fa8h0WgJfeo2ap6taT0JGfY VHy4fsQ0fe3GU9c3ZI/dlhvm+MBqr6apKW2EDyzNM3yKo3HXg0H0yCDsKQUJ6JQekqxZ pzg0YYonuqacna2kMftk8PW2Tb4TdGkgLpSOF4ZgfzYB5rTpzzSeErOpLdrKB1ODdjNm D1mi0erWYXXCzp8t99Xb5WnHujbJVfqFSrRKw8KtAAOCOul7ajUdA8Lno6LFdV8T8lBb B2/adX7TNhn3Rxr8m4iDtaDGvfG6UmR0pykh/COU4aJPtTrI++cNVpfyCf6lEDAT8Pbp QMyw== Received: from localhost.localdomain ([79.115.252.33]) by smtp.gmail.com with ESMTPSA id z9sm26695136wrv.35.2019.11.19.01.02.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2019 01:02:56 -0800 (PST) From: Claudiu Zissulescu To: gcc-patches@gcc.gnu.org Cc: fbedard@synopsys.com, claziss@synopsys.com, andrew.burgess@embecosm.com Subject: [PATCH 1/3] [ARC] Fix failing pr77309 for ARC700 Date: Tue, 19 Nov 2019 11:02:48 +0200 Message-Id: <20191119090250.5619-1-claziss@gmail.com> MIME-Version: 1.0 X-IsSubscribed: yes The patterns neg_scc_insn and not_scc_insn are not correct, leading to failing pr77309 test for ARC700. Add two new bic compare with zero patterns to improve output code. gcc/ xxxx-xx-xx Claudiu Zissulescu * config/arc/arc.md (bic_f): Use cc_set_register predicate. (bic_cmp0_noout): New pattern. (bic_cmp0): Likewise. (neg_scc_insn): Remove pattern. (not_scc_insn): Likewise. --- gcc/config/arc/arc.md | 52 ++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index 7da52199415..d2b7a45b6e6 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -1272,7 +1272,7 @@ archs4x, archs4xd" "") (define_insn "*bic_f" - [(set (match_operand 3 "cc_register" "=Rcc,Rcc,Rcc") + [(set (match_operand 3 "cc_set_register" "") (match_operator 4 "zn_compare_operator" [(and:SI (match_operand:SI 1 "register_operand" "c,0,c") (not:SI @@ -1286,6 +1286,34 @@ archs4x, archs4xd" (set_attr "cond" "set_zn,set_zn,set_zn") (set_attr "length" "4,4,8")]) +(define_insn "*bic_cmp0_noout" + [(set (match_operand 0 "cc_set_register" "") + (compare:CC_ZN + (and:SI (not:SI (match_operand:SI 1 "nonmemory_operand" "Lr,Cal,r")) + (match_operand:SI 2 "nonmemory_operand" "r,r,Cal")) + (const_int 0)))] + "register_operand (operands[1], SImode) + || register_operand (operands[2], SImode)" + "bic.f\\t0,%2,%1" + [(set_attr "type" "unary") + (set_attr "cond" "set_zn") + (set_attr "length" "4,8,8")]) + +(define_insn "*bic_cmp0" + [(set (match_operand 0 "cc_set_register" "") + (compare:CC_ZN + (and:SI (not:SI (match_operand:SI 1 "nonmemory_operand" "Lr,Cal,r")) + (match_operand:SI 2 "nonmemory_operand" "r,r,Cal")) + (const_int 0))) + (set (match_operand:SI 3 "register_operand" "=r,r,r") + (and:SI (not:SI (match_dup 1)) (match_dup 2)))] + "register_operand (operands[1], SImode) + || register_operand (operands[2], SImode)" + "bic.f\\t%3,%2,%1" + [(set_attr "type" "unary") + (set_attr "cond" "set_zn") + (set_attr "length" "4,8,8")]) + (define_expand "movdi" [(set (match_operand:DI 0 "move_dest_operand" "") (match_operand:DI 1 "general_operand" ""))] @@ -3763,28 +3791,6 @@ archs4x, archs4xd" } [(set_attr "type" "unary")]) -;; ??? At least for ARC600, we should use sbc b,b,s12 if we want a value -;; that is one lower if the carry flag is set. - -;; ??? Look up negscc insn. See pa.md for example. -(define_insn "*neg_scc_insn" - [(set (match_operand:SI 0 "dest_reg_operand" "=w") - (neg:SI (match_operator:SI 1 "proper_comparison_operator" - [(reg CC_REG) (const_int 0)])))] - "" - "mov %0,-1\;sub.%D1 %0,%0,%0" - [(set_attr "type" "unary") - (set_attr "length" "8")]) - -(define_insn "*not_scc_insn" - [(set (match_operand:SI 0 "dest_reg_operand" "=w") - (not:SI (match_operator:SI 1 "proper_comparison_operator" - [(reg CC_REG) (const_int 0)])))] - "" - "mov %0,1\;sub.%d1 %0,%0,%0" - [(set_attr "type" "unary") - (set_attr "length" "8")]) - ; cond_exec patterns (define_insn "*movsi_ne" [(cond_exec From patchwork Tue Nov 19 09:02:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu Ianculescu X-Patchwork-Id: 1197307 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513998-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="nEjUfENz"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="kPi+4+Fh"; 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 47HKcM4DP2z9sPW for ; Tue, 19 Nov 2019 20:03: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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; q=dns; s=default; b=g8h h6qdwu3hpblkdxYRm5iXAXjo4dJv1q8ONHM+6N9VsAYzPIcuYF+VkMg/XyMs8l3s 817kxB9n/hcLCT7F7btefcK3Y1sdtYGd9pbmoNckgvXeCbvuvQUrCCwoHBLOi9F8 Aw8k+aVnrW2Kqs1qCHKwlRziFYUgrMc3H3J7X+5A= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=default; bh=8pgHm3uzk +ICls/C4ea3MbKN6P4=; b=nEjUfENzyxz5fuQBz5XZC734jdIH5r0bSqtntQ58X /aggwxb9Qwf3P532ieLVw94x7ewntHvDmpt4GZKorAanfpV4sTdTmSFxjsuYBjek 2Khtzfi0mf9TIBLQEqd1ajEw9HlxAwe+FYR6iswiNL73ShfD77XQ2+eAVyQN3v+w lE= Received: (qmail 100240 invoked by alias); 19 Nov 2019 09:03:10 -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 100226 invoked by uid 89); 19 Nov 2019 09:03:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=H*RU:209.85.221.67, HX-Spam-Relays-External:209.85.221.67, HContent-Transfer-Encoding:8bit X-HELO: mail-wr1-f67.google.com Received: from mail-wr1-f67.google.com (HELO mail-wr1-f67.google.com) (209.85.221.67) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Nov 2019 09:03:00 +0000 Received: by mail-wr1-f67.google.com with SMTP id e6so22859938wrw.1 for ; Tue, 19 Nov 2019 01:03:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=afzOWkRfXbNCWQDCl1Z/PdGnV79gWYa7Tuo8p8kwlm4=; b=kPi+4+Fh1CkjiRpSgs7MXENc3yjdafyLGjvRCqmoBxYLWpm4nr6gQbtBeMoy+ximSH A2oY5k2kP8KICFDSmivv6ByM5+jt4+FFv8AFZAuLdAdEbk1X4BivNuuWOrRCs3XKYN7a gdsF1M9FVwFAneOVLLJ7dyxeDEsijr2Dh+hcfy6nWFFOQGnvxyw5abOVzp/JkU+Cwequ dQrNfuxKPavXC2ov4weEghisRSxSjapr64m+7qz2AifTejLxwfa71mnNCudPMJAWhEbg E6yawkPPQ+ljmvVRivSXFE91027a+ogY9Lx+IOxINlD4tnqUG9B4tkgO0Vs5zLHqupry LLkA== Received: from localhost.localdomain ([79.115.252.33]) by smtp.gmail.com with ESMTPSA id z9sm26695136wrv.35.2019.11.19.01.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2019 01:02:57 -0800 (PST) From: Claudiu Zissulescu To: gcc-patches@gcc.gnu.org Cc: fbedard@synopsys.com, claziss@synopsys.com, andrew.burgess@embecosm.com Subject: [PATCH 2/3] [ARC] Add scaled load pattern Date: Tue, 19 Nov 2019 11:02:49 +0200 Message-Id: <20191119090250.5619-2-claziss@gmail.com> In-Reply-To: <20191119090250.5619-1-claziss@gmail.com> References: <20191119090250.5619-1-claziss@gmail.com> MIME-Version: 1.0 X-IsSubscribed: yes ARC processors can use scaled addresses, i.e., the offset part of the load address can be shifted by 2 (multiplied by 4). Add this pattern and a test for it. gcc/ xxxx-xx-xx Claudiu Zissulescu * config/arc/arc.md (load_scaledsi): New pattern. testcase/ xxxx-xx-xx Claudiu Zissulescu * gcc.target/arc/scaled-ld.c: New test. --- gcc/config/arc/arc.md | 12 ++++++++++++ gcc/testsuite/gcc.target/arc/scaled-ld.c | 13 +++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.target/arc/scaled-ld.c diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index d2b7a45b6e6..ed16be65cab 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -867,6 +867,18 @@ archs4x, archs4xd" "st%U0 %1,%0\;st%U0.di %1,%0" [(set_attr "type" "store")]) +(define_insn "*load_scaledsi" + [(set (match_operand:SI 0 "register_operand" "=q,r,r") + (mem:SI (plus:SI (mult:SI (match_operand:SI 1 "register_operand" "q,r,r") + (const_int 4)) + (match_operand:SI 2 "nonmemory_operand" "q,r,Cal"))))] + "" + "ld%?.as\\t%0,[%2,%1]" + [(set_attr "type" "load") + (set_attr "iscompact" "true,false,false") + (set_attr "length" "2,4,8") + (set_attr "cpu_facility" "cd,*,*")]) + ;; Combiner patterns for compare with zero (define_mode_iterator SQH [QI HI]) (define_mode_attr SQH_postfix [(QI "b") (HI "%_")]) diff --git a/gcc/testsuite/gcc.target/arc/scaled-ld.c b/gcc/testsuite/gcc.target/arc/scaled-ld.c new file mode 100644 index 00000000000..bebae8fe505 --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/scaled-ld.c @@ -0,0 +1,13 @@ +/* Simple test for scaled load addressed. */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +const int table[2] = {1, 2}; + +int +foo (char i) +{ + return table[i]; +} + +/* { dg-final { scan-assembler "ld.as" } } */ From patchwork Tue Nov 19 09:02:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Zissulescu Ianculescu X-Patchwork-Id: 1197308 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-513999-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="rx1xXZGM"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uX/Xq6el"; 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 47HKcd1DJtz9s4Y for ; Tue, 19 Nov 2019 20:03:44 +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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; q=dns; s=default; b=NRs 02UJemM1b0KRe+ozVvmJmmHr0SAUZqIpk8EPOignYl3TZooHAZ7FrCU1qnK5M1w5 XFwopkQulCvJACUjAdrUG9VRQyZODobj/huwl3+2R56wiB952RTJE0ICiUgmL0xO UO79vO7GLLt0z/0YTvVBSLmHYRnbj26fEi6RHNok= 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:from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=default; bh=K10gobC87 H0pvbPi0swBo6pwvsc=; b=rx1xXZGMbM7CXUcDgladoL714LOiNKqUKnncSNO30 xM9axMOXtFoBfs3SsNcmg7T2ttrqReksUhYw7Ffww+l0MN4u+i2yLik8AXctKscG s3ko2leupWEn5zPsTSl0acm+3We9eWhhRaENkeJBF8zw0r7Fzjw4JTNMK1k7fdJT lw= Received: (qmail 100518 invoked by alias); 19 Nov 2019 09:03: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 100438 invoked by uid 89); 19 Nov 2019 09:03:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-wr1-f51.google.com Received: from mail-wr1-f51.google.com (HELO mail-wr1-f51.google.com) (209.85.221.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Nov 2019 09:03:01 +0000 Received: by mail-wr1-f51.google.com with SMTP id e6so22860000wrw.1 for ; Tue, 19 Nov 2019 01:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3rNc4wh8iMpkeNdnTP3SlXWrgyqxAxykWZPQoRjDgmk=; b=uX/Xq6elwc0LLR4+g+I/PgLjF8UtCJxtDYsj5X5eo6trxD3TRcAvQk35/sWti2mlXA ZxZihfGMx+75b08eQyPIbRSL/f2z0PYOMcTOUKSWWz2yafjX7Ze3ar9/PGHSch+z1Yss eYfEym6qzTcyJpSEjjNBVpfGkVl8SVFRtXn3peZvk0pltUR8KjeTP6h2Y66lqAemvLc9 03BMan72XezjEm88xXUSGBQiGtixke3xwqUtztMK906H1T2GqZSC4vTrRtkDYyJg0hqR j2PqAq/5VszBDKfVMu3RGaqb2F0t+NXv0qEXBWVceXtAs7+cEEnF7Lf7ZlyGF5si6nMX zxDQ== Received: from localhost.localdomain ([79.115.252.33]) by smtp.gmail.com with ESMTPSA id z9sm26695136wrv.35.2019.11.19.01.02.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2019 01:02:58 -0800 (PST) From: Claudiu Zissulescu To: gcc-patches@gcc.gnu.org Cc: fbedard@synopsys.com, claziss@synopsys.com, andrew.burgess@embecosm.com Subject: [PATCH 3/3] [ARC] Register ARC specific passes with a .def file. Date: Tue, 19 Nov 2019 11:02:50 +0200 Message-Id: <20191119090250.5619-3-claziss@gmail.com> In-Reply-To: <20191119090250.5619-1-claziss@gmail.com> References: <20191119090250.5619-1-claziss@gmail.com> MIME-Version: 1.0 X-IsSubscribed: yes Use arc-passes.def to register ARC specific passes. Ok to apply? Claudiu gcc/ xxxx-xx-xx Claudiu Zissulescu * config/arc/arc-protos.h (make_pass_arc_ifcvt): Declare. (make_pass_arc_predicate_delay_insns): Likewise. * config/arc/arc.c (class pass_arc_ifcvt): Reformat text, add gate method. (class pass_arc_predicate_delay_insns): Likewise. (arc_init): Remove registering of ARC specific passes. * config/arc/t-arc (PASSES_EXTRA): Add arc-passes.def. * config/arc/arc-passes.def: New file. --- gcc/config/arc/arc-passes.def | 29 ++++++++++++++++ gcc/config/arc/arc-protos.h | 3 ++ gcc/config/arc/arc.c | 64 +++++++++++++++-------------------- gcc/config/arc/t-arc | 2 ++ 4 files changed, 61 insertions(+), 37 deletions(-) create mode 100644 gcc/config/arc/arc-passes.def diff --git a/gcc/config/arc/arc-passes.def b/gcc/config/arc/arc-passes.def new file mode 100644 index 00000000000..ebb69a563df --- /dev/null +++ b/gcc/config/arc/arc-passes.def @@ -0,0 +1,29 @@ +/* Description of target passes for ARC. + Copyright (C) 2019 Free Software Foundation, Inc. */ + +/* This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation; either version 3, or (at your option) any later + version. + + GCC is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING3. If not see + . */ + +/* First target dependent ARC if-conversion pass. */ +INSERT_PASS_AFTER (pass_delay_slots, 1, pass_arc_ifcvt); + +/* Second target dependent ARC if-conversion pass. */ +INSERT_PASS_BEFORE (pass_shorten_branches, 1, pass_arc_ifcvt); + +/* Find annulled delay insns and convert them to use the appropriate + predicate. This allows branch shortening to size up these + instructions properly. */ +INSERT_PASS_AFTER (pass_delay_slots, 1, pass_arc_predicate_delay_insns); diff --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h index 1220e77206d..da128dcbcb2 100644 --- a/gcc/config/arc/arc-protos.h +++ b/gcc/config/arc/arc-protos.h @@ -111,3 +111,6 @@ extern void arc_eh_return_address_location (rtx); extern bool arc_is_jli_call_p (rtx); extern void arc_file_end (void); extern bool arc_is_secure_call_p (rtx); + +rtl_opt_pass * make_pass_arc_ifcvt (gcc::context *ctxt); +rtl_opt_pass * make_pass_arc_predicate_delay_insns (gcc::context *ctxt); diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index 918c4e06533..d67775448a3 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -961,14 +961,24 @@ const pass_data pass_data_arc_ifcvt = class pass_arc_ifcvt : public rtl_opt_pass { -public: - pass_arc_ifcvt(gcc::context *ctxt) - : rtl_opt_pass(pass_data_arc_ifcvt, ctxt) - {} + public: + pass_arc_ifcvt (gcc::context *ctxt) + : rtl_opt_pass (pass_data_arc_ifcvt, ctxt) + {} /* opt_pass methods: */ - opt_pass * clone () { return new pass_arc_ifcvt (m_ctxt); } - virtual unsigned int execute (function *) { return arc_ifcvt (); } + opt_pass * clone () + { + return new pass_arc_ifcvt (m_ctxt); + } + virtual unsigned int execute (function *) + { + return arc_ifcvt (); + } + virtual bool gate (function *) + { + return (optimize > 1 && !TARGET_NO_COND_EXEC); + } }; } // anon namespace @@ -998,16 +1008,20 @@ const pass_data pass_data_arc_predicate_delay_insns = class pass_arc_predicate_delay_insns : public rtl_opt_pass { -public: - pass_arc_predicate_delay_insns(gcc::context *ctxt) - : rtl_opt_pass(pass_data_arc_predicate_delay_insns, ctxt) - {} + public: + pass_arc_predicate_delay_insns(gcc::context *ctxt) + : rtl_opt_pass(pass_data_arc_predicate_delay_insns, ctxt) + {} /* opt_pass methods: */ virtual unsigned int execute (function *) - { - return arc_predicate_delay_insns (); - } + { + return arc_predicate_delay_insns (); + } + virtual bool gate (function *) + { + return flag_delayed_branch; + } }; } // anon namespace @@ -1100,30 +1114,6 @@ arc_init (void) arc_punct_chars['&'] = 1; arc_punct_chars['+'] = 1; arc_punct_chars['_'] = 1; - - if (optimize > 1 && !TARGET_NO_COND_EXEC) - { - /* There are two target-independent ifcvt passes, and arc_reorg may do - one or more arc_ifcvt calls. */ - opt_pass *pass_arc_ifcvt_4 = make_pass_arc_ifcvt (g); - struct register_pass_info arc_ifcvt4_info - = { pass_arc_ifcvt_4, "dbr", 1, PASS_POS_INSERT_AFTER }; - struct register_pass_info arc_ifcvt5_info - = { pass_arc_ifcvt_4->clone (), "shorten", 1, PASS_POS_INSERT_BEFORE }; - - register_pass (&arc_ifcvt4_info); - register_pass (&arc_ifcvt5_info); - } - - if (flag_delayed_branch) - { - opt_pass *pass_arc_predicate_delay_insns - = make_pass_arc_predicate_delay_insns (g); - struct register_pass_info arc_predicate_delay_info - = { pass_arc_predicate_delay_insns, "dbr", 1, PASS_POS_INSERT_AFTER }; - - register_pass (&arc_predicate_delay_info); - } } /* Parse -mirq-ctrl-saved=RegisterRange, blink, lp_copunt. The diff --git a/gcc/config/arc/t-arc b/gcc/config/arc/t-arc index ca6e06ac3ab..604e639b5bf 100644 --- a/gcc/config/arc/t-arc +++ b/gcc/config/arc/t-arc @@ -43,6 +43,8 @@ $(srcdir)/config/arc/arc-tables.opt: $(srcdir)/config/arc/genoptions.awk \ $(srcdir)/config/arc/arc-cpus.def $(AWK) -f $< -v FORMAT=Makefile $< $(srcdir)/config/arc/arc-cpus.def > $@ +PASSES_EXTRA += $(srcdir)/config/arc/arc-passes.def + # Local Variables: # mode: Makefile # End: