From patchwork Thu Sep 8 19:51:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 3989 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5AB2A23EFB for ; Thu, 8 Sep 2011 19:51:40 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 497A9A18314 for ; Thu, 8 Sep 2011 19:51:40 +0000 (UTC) Received: by fxd18 with SMTP id 18so2752773fxd.11 for ; Thu, 08 Sep 2011 12:51:40 -0700 (PDT) Received: by 10.223.24.21 with SMTP id t21mr569400fab.24.1315511500061; Thu, 08 Sep 2011 12:51:40 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.11.8 with SMTP id m8cs187965lab; Thu, 8 Sep 2011 12:51:39 -0700 (PDT) Received: by 10.150.238.2 with SMTP id l2mr1375964ybh.44.1315511498770; Thu, 08 Sep 2011 12:51:38 -0700 (PDT) Received: from relay1.mentorg.com (relay1.mentorg.com [192.94.38.131]) by mx.google.com with ESMTPS id h16si5644191ybi.15.2011.09.08.12.51.38 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Sep 2011 12:51:38 -0700 (PDT) Received-SPF: neutral (google.com: 192.94.38.131 is neither permitted nor denied by best guess record for domain of Andrew_Stubbs@mentor.com) client-ip=192.94.38.131; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.94.38.131 is neither permitted nor denied by best guess record for domain of Andrew_Stubbs@mentor.com) smtp.mail=Andrew_Stubbs@mentor.com Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1R1kdM-0001Jb-Mf from Andrew_Stubbs@mentor.com ; Thu, 08 Sep 2011 12:51:36 -0700 Received: from [127.0.0.1] ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 8 Sep 2011 20:51:34 +0100 Message-ID: <4E691CC1.1000307@codesourcery.com> Date: Thu, 08 Sep 2011 20:51:29 +0100 From: Andrew Stubbs User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org CC: patches@linaro.org Subject: [commit] Fix PR50318 - ICE optimizing widening multiply-and-accumulate X-OriginalArrivalTime: 08 Sep 2011 19:51:35.0309 (UTC) FILETIME=[B700A3D0:01CC6E60] This patch fixes PR50318 in which the compiler fails with a bad gimple expression. The problem was caused by a cut-and-paste error. I don't understand why it wasn't caught in testing, but it's fixed now. Committed as obvious. Andrew 2011-09-08 Andrew Stubbs PR tree-optimization/50318 gcc/ * tree-ssa-math-opts.c (convert_plusminus_to_widen): Correct typo in use of mult_rhs1 and mult_rhs2. gcc/testsuite/ * gcc.target/arm/pr50318-1.c: New file. --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr50318-1.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target arm_dsp } */ + +long long test (unsigned int sec, unsigned long long nsecs) +{ + return (long long)(long)sec * 1000000000L + (long long)(unsigned + long)nsecs; +} + +/* { dg-final { scan-assembler "umlal" } } */ --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -2386,9 +2386,9 @@ convert_plusminus_to_widen (gimple_stmt_iterator *gsi, gimple stmt, /* Handle constants. */ if (TREE_CODE (mult_rhs1) == INTEGER_CST) - rhs1 = fold_convert (type1, mult_rhs1); + mult_rhs1 = fold_convert (type1, mult_rhs1); if (TREE_CODE (mult_rhs2) == INTEGER_CST) - rhs2 = fold_convert (type2, mult_rhs2); + mult_rhs2 = fold_convert (type2, mult_rhs2); gimple_assign_set_rhs_with_ops_1 (gsi, wmult_code, mult_rhs1, mult_rhs2, add_rhs);