From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21255 invoked by alias); 18 May 2011 17:21:34 -0000 Received: (qmail 21241 invoked by uid 22791); 18 May 2011 17:21:32 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 18 May 2011 17:21:17 +0000 Received: (qmail 28081 invoked from network); 18 May 2011 17:21:16 -0000 Received: from unknown (HELO ?192.168.1.68?) (vries@127.0.0.2) by mail.codesourcery.com with ESMTPA; 18 May 2011 17:21:16 -0000 Message-ID: <4DD3FFD4.1010600@codesourcery.com> Date: Wed, 18 May 2011 18:23:00 -0000 From: Tom de Vries User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: Zdenek Dvorak CC: gcc-patches@gcc.gnu.org Subject: [PATCH PR45098, 8/10] Nowrap limits iterations - test cases. References: <4DD21F6E.4050308@codesourcery.com> <4DD221FC.7060303@codesourcery.com> In-Reply-To: <4DD221FC.7060303@codesourcery.com> Content-Type: multipart/mixed; boundary="------------080004080204080400000709" 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 X-SW-Source: 2011-05/txt/msg01298.txt.bz2 This is a multi-part message in MIME format. --------------080004080204080400000709 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-length: 1839 On 05/17/2011 09:21 AM, Tom de Vries wrote: > On 05/17/2011 09:10 AM, Tom de Vries wrote: >> Hi Zdenek, >> >> I have a patch set for for PR45098. >> >> 01_object-size-target.patch >> 02_pr45098-rtx-cost-set.patch >> 03_pr45098-computation-cost.patch >> 04_pr45098-iv-init-cost.patch >> 05_pr45098-bound-cost.patch >> 06_pr45098-bound-cost.test.patch >> 07_pr45098-nowrap-limits-iterations.patch >> 08_pr45098-nowrap-limits-iterations.test.patch >> 09_pr45098-shift-add-cost.patch >> 10_pr45098-shift-add-cost.test.patch >> >> I will sent out the patches individually. >> > > OK for trunk? > > Thanks, > - Tom Resubmitting with comment. This patch introduces 3 new testcases, and modifies an existing test case. The 3 new testcases need the preceding patches to pass. The modified test case is ivopt_infer_2.c. #ifndef TYPE #define TYPE char* #endif extern int a[]; /* Can not infer loop iteration from array -- exit test can not be replaced. */ void foo (int i_width, TYPE dst, TYPE src1, TYPE src2) { TYPE dstn= dst + i_width; TYPE dst0 = dst; unsigned long long i = 0; for( ; dst <= dstn; ) { dst0[i] = ( src1[i] + src2[i] + 1 +a[i]) >> 1; dst++; i += 16; } } The estimates in set_max_iterations for this testcase are: (gdb) p /x max_niter $3 = {low = 0x0, high = 0x1} (gdb) p /x max_niter2 $4 = {low = 0x3ffffffffffffff, high = 0x0} The second estimate is based on a[i], which contains the non-wrapping pointer arithmetic a+i. Var i is incremented with 16 each iterations, an a is an int pointer, which explains the factor 64 difference between the 2. 2011-05-05 Tom de Vries PR target/45098 * gcc.target/arm/ivopts-3.c: New test. * gcc.target/arm/ivopts-4.c: New test. * gcc.target/arm/ivopts-5.c: New test. * gcc.dg/tree-ssa/ivopt_infer_2.c: Adapt test. --------------080004080204080400000709 Content-Type: text/x-patch; name="08_pr45098-nowrap-limits-iterations.test.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="08_pr45098-nowrap-limits-iterations.test.patch" Content-length: 3389 Index: gcc/testsuite/gcc.target/arm/ivopts-3.c =================================================================== --- /dev/null (new file) +++ gcc/testsuite/gcc.target/arm/ivopts-3.c (revision 0) @@ -0,0 +1,20 @@ +/* { dg-do assemble } */ +/* { dg-options "-Os -mthumb -fdump-tree-ivopts -save-temps" } */ + +extern unsigned int foo2 (short*) __attribute__((pure)); + +unsigned int +tr3 (short array[], unsigned int n) +{ + unsigned sum = 0; + unsigned int x; + for (x = 0; x < n; x++) + sum += foo2 (&array[x]); + return sum; +} + +/* { dg-final { scan-tree-dump-times "PHI 0) + for (x = 0; x < n; x++) + sum += foo (&array[x]); + return sum; +} + +/* { dg-final { scan-tree-dump-times "PHI