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: 113933 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]) by ozlabs.org (Postfix) with SMTP id DE230B708F for ; Fri, 9 Sep 2011 05:52:00 +1000 (EST) Received: (qmail 15045 invoked by alias); 8 Sep 2011 19:51:56 -0000 Received: (qmail 15022 invoked by uid 22791); 8 Sep 2011 19:51:54 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=BAYES_00, FROM_12LTRDOM X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Sep 2011 19:51:38 +0000 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 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 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);