From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69196 invoked by alias); 1 Sep 2015 16:50:31 -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 69182 invoked by uid 89); 1 Sep 2015 16:50:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 01 Sep 2015 16:50:30 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 0B6C7A4534; Tue, 1 Sep 2015 16:50:28 +0000 (UTC) Received: from [10.3.238.88] (vpn-238-88.phx2.redhat.com [10.3.238.88]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t81GoSHi007233; Tue, 1 Sep 2015 12:50:28 -0400 Message-ID: <1441126227.9002.50.camel@surprise> Subject: Location of "dg-final" directives? (was Re: [PATCH][GCC] Algorithmic optimization in match and simplify) From: David Malcolm To: Andre Vieira Cc: GCC Patches Date: Tue, 01 Sep 2015 16:50:00 -0000 In-Reply-To: <55E092D9.8070700@arm.com> References: <55E092D9.8070700@arm.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00088.txt.bz2 On Fri, 2015-08-28 at 17:56 +0100, Andre Vieira wrote: [..snip..] > diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-33.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-33.c > new file mode 100644 > index 0000000000000000000000000000000000000000..984d8b37a01defe0e6852070a7dfa7ace5027c51 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-33.c > @@ -0,0 +1,42 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O -fdump-tree-forwprop1" } */ > + > +unsigned short > +foo (unsigned short a) > +{ > + a ^= 0x4002; > + a >>= 1; > + a |= 0x8000; /* Simplify to ((a >> 1) ^ 0xa001). */ > + return a; > +} > + > +unsigned short > +bar (unsigned short a) > +{ > + a |= 0x4002; > + a <<= 1; > + a ^= 0x0001; /* Simplify to ((a << 1) | 0x8005). */ > + return a; > +} > + > +unsigned short > +baz (unsigned short a) > +{ > + a &= 0xd123; > + a ^= 0x6040; > + a |= 0xc031; /* Simplify to ((a & 0xd123) | 0xe071). */ > + return a; > +} > + > +short > +qux (short a) > +{ > + a ^= 0x8002; > + a >>= 1; > + a |= 0x8000; /* Only move shift inward: (((a >> 1) ^ 0x4001 |) 0x8000). */ > + return a; > +} > +/* { dg-final { scan-tree-dump "\\^ 40961" "forwprop1" } } */ > +/* { dg-final { scan-tree-dump "\\| 32773" "forwprop1" } } */ > +/* { dg-final { scan-tree-dump "\\| 57457" "forwprop1" } } */ > +/* { dg-final { scan-tree-dump "\\^ -16383" "forwprop1" } } */ > -- I can't comment on the patch itself, but I noticed that in the testsuite addition, you've gathered all the "dg-final" clauses at the end. I think that this is consistent with existing practice in gcc, but AFAIK, the dg-final clauses can appear anywhere in the file. Would it make test cases more readable if we put the dg-final clauses next to the code that they relate to? Or, at least after the function that they relate to? For example: unsigned short foo (unsigned short a) { a ^= 0x4002; a >>= 1; a |= 0x8000; /* Simplify to ((a >> 1) ^ 0xa001). */ return a; } /* { dg-final { scan-tree-dump "\\^ 40961" "forwprop1" } } */ unsigned short bar (unsigned short a) { /* snip */ /* Simplify to ((a << 1) | 0x8005). */ } /* { dg-final { scan-tree-dump "\\| 32773" "forwprop1" } } */ ... etc ... I think this may be more readable than the "group them all at the end of the file approach", especially with testcases with many files and dg-final directives. Hope this is constructive and not too "bikesheddy" Dave