From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47017 invoked by alias); 18 Apr 2016 14:35:39 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 46837 invoked by uid 89); 18 Apr 2016 14:35:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=H*RU:sk:smtprel, Hx-spam-relays-external:sk:smtprel, HX-HELO:sk:smtprel X-HELO: smtprelay.synopsys.com Received: from smtprelay.synopsys.com (HELO smtprelay.synopsys.com) (198.182.47.9) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 18 Apr 2016 14:35:24 +0000 Received: from dc8secmta2.synopsys.com (dc8secmta2.synopsys.com [10.13.218.202]) by smtprelay.synopsys.com (Postfix) with ESMTP id 10FFA24E1F50; Mon, 18 Apr 2016 07:35:23 -0700 (PDT) Received: from dc8secmta2.internal.synopsys.com (dc8secmta2.internal.synopsys.com [127.0.0.1]) by dc8secmta2.internal.synopsys.com (Service) with ESMTP id 04DA8A4114; Mon, 18 Apr 2016 07:35:23 -0700 (PDT) Received: from mailhost.synopsys.com (unknown [10.13.184.66]) by dc8secmta2.internal.synopsys.com (Service) with ESMTP id D737BA4102; Mon, 18 Apr 2016 07:35:22 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id C73AE1C3; Mon, 18 Apr 2016 07:35:22 -0700 (PDT) Received: from US01WXQAHTC1.internal.synopsys.com (us01wxqahtc1.internal.synopsys.com [10.12.238.230]) by mailhost.synopsys.com (Postfix) with ESMTP id BEEB31C1; Mon, 18 Apr 2016 07:35:22 -0700 (PDT) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by US01WXQAHTC1.internal.synopsys.com (10.12.238.230) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 18 Apr 2016 07:35:22 -0700 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 18 Apr 2016 20:05:20 +0530 Received: from nl20droid1.internal.synopsys.com (10.100.24.228) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 18 Apr 2016 20:05:19 +0530 From: Claudiu Zissulescu To: CC: , , , Subject: [PATCH 5/6] [ARC] Fix unwanted match for sign extend 16-bit constant. Date: Mon, 18 Apr 2016 14:35:00 -0000 Message-ID: <1460990028-5718-6-git-send-email-claziss@synopsys.com> In-Reply-To: <1460990028-5718-1-git-send-email-claziss@synopsys.com> References: <1460990028-5718-1-git-send-email-claziss@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2016-04/txt/msg00855.txt.bz2 The combine pass may conclude umulhisi3_imm pattern can accept also sign extended 16-bit constants. This patch prohibits the combine in considering this pattern as suitable. OK to apply? Claudiu gcc/ 2016-04-18 Claudiu Zissulescu * config/arc/arc.md (umulhisi3_imm): Avoid unwanted match for sign extend 16-bit constants. * testsuite/gcc.target/arc/umulsihi3_z.c: New file. --- gcc/config/arc/arc.md | 3 ++- gcc/testsuite/gcc.target/arc/umulsihi3_z.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/arc/umulsihi3_z.c diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md index 74530b1..6731072 100644 --- a/gcc/config/arc/arc.md +++ b/gcc/config/arc/arc.md @@ -1729,7 +1729,8 @@ (define_insn "umulhisi3_imm" [(set (match_operand:SI 0 "register_operand" "=r, r,r, r, r") (mult:SI (zero_extend:SI (match_operand:HI 1 "register_operand" " 0, r,0, 0, r")) - (match_operand:HI 2 "short_const_int_operand" " L, L,I,C16,C16")))] + (match_operand:HI 2 "short_const_int_operand" " L, L,I,C16,C16"))) + (use (match_dup 2))] "TARGET_MPYW" "mpyuw%? %0,%1,%2" [(set_attr "length" "4,4,4,8,8") diff --git a/gcc/testsuite/gcc.target/arc/umulsihi3_z.c b/gcc/testsuite/gcc.target/arc/umulsihi3_z.c new file mode 100644 index 0000000..cf1c00d --- /dev/null +++ b/gcc/testsuite/gcc.target/arc/umulsihi3_z.c @@ -0,0 +1,23 @@ +/* Check if the optimizers are not removing the umulsihi3_imm + instruction. */ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline" } */ + +#include + +static int32_t test (int16_t reg_val) +{ + int32_t x = (reg_val & 0xf) * 62500; + return x; +} + +int main (void) +{ + volatile int32_t x = 0xc172; + x = test (x); + + if (x != 0x0001e848) + __builtin_abort (); + return 0; +} + -- 1.9.1