From patchwork Fri Aug 19 14:42:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 3567 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 9E8C823F27 for ; Fri, 19 Aug 2011 14:43:06 +0000 (UTC) Received: from mail-gy0-f180.google.com (mail-gy0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id 5B72BA189DF for ; Fri, 19 Aug 2011 14:43:06 +0000 (UTC) Received: by gyc15 with SMTP id 15so3228978gyc.11 for ; Fri, 19 Aug 2011 07:43:05 -0700 (PDT) Received: by 10.150.2.16 with SMTP id 16mr2469183ybb.333.1313764985687; Fri, 19 Aug 2011 07:43:05 -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.150.157.17 with SMTP id f17cs101677ybe; Fri, 19 Aug 2011 07:43:05 -0700 (PDT) Received: by 10.236.173.199 with SMTP id v47mr8228315yhl.19.1313764984964; Fri, 19 Aug 2011 07:43:04 -0700 (PDT) Received: from mail.codesourcery.com (mail.codesourcery.com [38.113.113.100]) by mx.google.com with ESMTPS id d1si10465971yhe.20.2011.08.19.07.43.03 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Aug 2011 07:43:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ams@codesourcery.com designates 38.113.113.100 as permitted sender) client-ip=38.113.113.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ams@codesourcery.com designates 38.113.113.100 as permitted sender) smtp.mail=ams@codesourcery.com Received: (qmail 29124 invoked from network); 19 Aug 2011 14:43:02 -0000 Received: from unknown (HELO ?192.168.0.104?) (ams@127.0.0.2) by mail.codesourcery.com with ESMTPA; 19 Aug 2011 14:43:02 -0000 Message-ID: <4E4E7672.5040708@codesourcery.com> Date: Fri, 19 Aug 2011 15:42:58 +0100 From: Andrew Stubbs User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: Richard Guenther CC: gcc-patches@gcc.gnu.org, patches@linaro.org Subject: Re: [PATCH (5/7)] Widening multiplies for mis-matched mode inputs References: <4E034EF2.3070503@codesourcery.com> <4E0350B7.7080802@codesourcery.com> <4E09EE62.9070900@codesourcery.com> <4E11CE4F.1020102@codesourcery.com> <4E1EFCF3.9040809@codesourcery.com> In-Reply-To: On 14/07/11 15:31, Richard Guenther wrote: > Ok. I've just committed this patch with no real changes. I've just updated the testcase. Andrew 2011-08-19 Andrew Stubbs gcc/ * tree-ssa-math-opts.c (is_widening_mult_p): Remove FIXME. Ensure the the larger type is the first operand. gcc/testsuite/ * gcc.target/arm/wmul-7.c: New file. --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/wmul-7.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target arm_dsp } */ + +unsigned long long +foo (unsigned long long a, unsigned char *b, unsigned short *c) +{ + return a + *b * *c; +} + +/* { dg-final { scan-assembler "umlal" } } */ --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -2054,9 +2054,17 @@ is_widening_mult_p (gimple stmt, *type2_out = *type1_out; } - /* FIXME: remove this restriction. */ - if (TYPE_PRECISION (*type1_out) != TYPE_PRECISION (*type2_out)) - return false; + /* Ensure that the larger of the two operands comes first. */ + if (TYPE_PRECISION (*type1_out) < TYPE_PRECISION (*type2_out)) + { + tree tmp; + tmp = *type1_out; + *type1_out = *type2_out; + *type2_out = tmp; + tmp = *rhs1_out; + *rhs1_out = *rhs2_out; + *rhs2_out = tmp; + } return true; }