From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78220 invoked by alias); 27 Jul 2015 08:17:34 -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 78206 invoked by uid 89); 27 Jul 2015 08:17:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 27 Jul 2015 08:17:31 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-25-i575xgIFTfKlCUV6xPWhAQ-1; Mon, 27 Jul 2015 09:17:25 +0100 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 27 Jul 2015 09:17:25 +0100 Message-ID: <55B5E915.6080309@arm.com> Date: Mon, 27 Jul 2015 08:48:00 -0000 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Michael Collison , Ramana Radhakrishnan CC: gcc-patches Subject: Re: [ARM] Optimize compare against smin/umin References: <558C3576.3070108@linaro.org> <55B5650B.2060601@linaro.org> In-Reply-To: <55B5650B.2060601@linaro.org> X-MC-Unique: i575xgIFTfKlCUV6xPWhAQ-1 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg02215.txt.bz2 Hi Michael, On 26/07/15 23:54, Michael Collison wrote: > Here is an updated patch that addresses the issues you mentioned: > > 2015-07-24 Michael Collison Ramana Radhakrishnan > > * gcc/config/arm/arm.md (*arm_smin_cmp): New pattern. > (*arm_umin_cmp): Likewise. > * gcc.target/arm/mincmp.c: Test min compare idiom. Just "New test." would be a better ChangeLog entry for this. > > diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md > index 0be70a8..361c292 100644 > --- a/gcc/config/arm/arm.md > +++ b/gcc/config/arm/arm.md > @@ -3455,6 +3455,44 @@ > (set_attr "type" "multiple,multiple")] > ) > > +;; t =3D (s/u)min (x, y) > +;; cc =3D cmp (t, z) > +;; is the same as > +;; cmp x, z > +;; cmpge(u) y, z > + > +(define_insn_and_split "*arm_smin_cmp" > + [(set (reg:CC CC_REGNUM) > + (compare:CC > + (smin:SI (match_operand:SI 0 "s_register_operand" "r") > + (match_operand:SI 1 "s_register_operand" "r")) > + (match_operand:SI 2 "s_register_operand" "r")))] > + "TARGET_32BIT" > + "#" > + "&& reload_completed" > + [(set (reg:CC CC_REGNUM) > + (compare:CC (match_dup 0) (match_dup 2))) > + (cond_exec (ge:CC (reg:CC CC_REGNUM) (const_int 0)) > + (set (reg:CC CC_REGNUM) > + (compare:CC (match_dup 1) (match_dup 2))))] > +) > + > +(define_insn_and_split "*arm_umin_cmp" > + [(set (reg:CC CC_REGNUM) > + (compare:CC > + (umin:SI (match_operand:SI 0 "s_register_operand" "r") > + (match_operand:SI 1 "s_register_operand" "r")) > + (match_operand:SI 2 "s_register_operand" "r")))] > + "TARGET_32BIT" > + "#" > + "&& reload_completed" > + [(set (reg:CC CC_REGNUM) > + (compare:CC (match_dup 0) (match_dup 2))) > + (cond_exec (geu:CC (reg:CC CC_REGNUM) (const_int 0)) > + (set (reg:CC CC_REGNUM) > + (compare:CC (match_dup 1) (match_dup 2))))] > +) > + > (define_expand "umaxsi3" > [(parallel [ > (set (match_operand:SI 0 "s_register_operand" "") > diff --git a/gcc/testsuite/gcc.target/arm/mincmp.c > b/gcc/testsuite/gcc.target/arm/mincmp.c > new file mode 100644 > index 0000000..2a55c6d > --- /dev/null > +++ b/gcc/testsuite/gcc.target/arm/mincmp.c > @@ -0,0 +1,18 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2" } */ > +/* { dg-require-effective-target arm32 } */ > + > +#define min(x, y) ((x) <=3D (y)) ? (x) : (y) > + > +unsigned int foo (unsigned int i, unsigned int x ,unsigned int y) Comma after "unsigned int x" in the wrong place. > +{ > + return i < (min (x, y)); > +} > + > +int bar (int i, int x, int y) > +{ > + return i < (min (x, y)); > +} Can you please use GNU style for the testcase. New line after return type, function name an arguments on their own line. Ok with these changes. Thanks, Kyrill