From patchwork Mon Jul 25 15:15:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sebastian Pop X-Patchwork-Id: 106699 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 3BE99B6FAF for ; Tue, 26 Jul 2011 01:16:42 +1000 (EST) Received: (qmail 13538 invoked by alias); 25 Jul 2011 15:16:39 -0000 Received: (qmail 13525 invoked by uid 22791); 25 Jul 2011 15:16:37 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, TW_TM X-Spam-Check-By: sourceware.org Received: from mail-qy0-f175.google.com (HELO mail-qy0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Jul 2011 15:16:23 +0000 Received: by qyk30 with SMTP id 30so926029qyk.20 for ; Mon, 25 Jul 2011 08:16:22 -0700 (PDT) Received: by 10.229.26.66 with SMTP id d2mr3540260qcc.241.1311606982131; Mon, 25 Jul 2011 08:16:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.187.79 with HTTP; Mon, 25 Jul 2011 08:15:42 -0700 (PDT) In-Reply-To: References: <1311492333-30309-1-git-send-email-sebpop@gmail.com> <1311492333-30309-3-git-send-email-sebpop@gmail.com> From: Sebastian Pop Date: Mon, 25 Jul 2011 10:15:42 -0500 Message-ID: Subject: Re: [PATCH 2/3] canonicalize_loop_ivs should not generate unsigned types. To: Richard Guenther , Zdenek Dvorak Cc: Richard Guenther , gcc-patches@gcc.gnu.org, tobias@grosser.es X-IsSubscribed: yes 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 On Mon, Jul 25, 2011 at 10:01, Richard Guenther wrote: >>  type = TREE_TYPE (res); >>  if (!is_gimple_reg (res) >>      || !INTEGRAL_TYPE_P (type) >>      || TYPE_PRECISION (type) < precision) >>    continue; >> >>  if (TYPE_PRECISION (type) > precision) >>    unsigned_p = TYPE_UNSIGNED (type); >>  else >>    unsigned_p |= TYPE_UNSIGNED (type); >> >>  precision = TYPE_PRECISION (type); > > Ah, indeed.  Yes, fine with me. Ok, so let's wait before committing to see what Zdenek says about the use of INTEGRAL_TYPE_P. I am now testing this together with the other patches. Sebastian From 0c7d8bc8935ac00701735e96fcaa91855e099727 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Sun, 24 Jul 2011 01:52:52 -0500 Subject: [PATCH] canonicalize_loop_ivs should not generate unsigned types. 2011-07-23 Sebastian Pop * tree-ssa-loop-manip.c (canonicalize_loop_ivs): Build an unsigned iv only when the largest type is unsigned. Do not call lang_hooks.types.type_for_size. * testsuite/libgomp.graphite/force-parallel-1.c: Un-xfail. * testsuite/libgomp.graphite/force-parallel-2.c: Adjust pattern. --- gcc/ChangeLog | 6 ++++++ gcc/tree-ssa-loop-manip.c | 20 +++++++++++++++++--- libgomp/ChangeLog | 5 +++++ .../testsuite/libgomp.graphite/force-parallel-1.c | 2 +- .../testsuite/libgomp.graphite/force-parallel-2.c | 2 +- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dba2f82..65676cb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2011-07-23 Sebastian Pop + * tree-ssa-loop-manip.c (canonicalize_loop_ivs): Build an unsigned + iv only when the largest type is unsigned. Do not call + lang_hooks.types.type_for_size. + +2011-07-23 Sebastian Pop + * tree-data-ref.c (max_stmt_executions_tree): Do not call lang_hooks.types.type_for_size. diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 8176ed8..f73d2d9 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -1200,6 +1200,8 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch) gimple stmt; edge exit = single_dom_exit (loop); gimple_seq stmts; + enum machine_mode mode; + bool unsigned_p = false; for (psi = gsi_start_phis (loop->header); !gsi_end_p (psi); gsi_next (&psi)) @@ -1207,11 +1209,23 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch) gimple phi = gsi_stmt (psi); tree res = PHI_RESULT (phi); - if (is_gimple_reg (res) && TYPE_PRECISION (TREE_TYPE (res)) > precision) - precision = TYPE_PRECISION (TREE_TYPE (res)); + type = TREE_TYPE (res); + if (!is_gimple_reg (res) + || !INTEGRAL_TYPE_P (type) + || TYPE_PRECISION (type) < precision) + continue; + + if (TYPE_PRECISION (type) > precision) + unsigned_p = TYPE_UNSIGNED (type); + else + unsigned_p |= TYPE_UNSIGNED (type); + + precision = TYPE_PRECISION (type); } - type = lang_hooks.types.type_for_size (precision, 1); + mode = smallest_mode_for_size (precision, MODE_INT); + precision = GET_MODE_PRECISION (mode); + type = build_nonstandard_integer_type (precision, unsigned_p); if (original_precision != precision) { diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 9225401..d5cd94d 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2011-07-23 Sebastian Pop + + * testsuite/libgomp.graphite/force-parallel-1.c: Un-xfail. + * testsuite/libgomp.graphite/force-parallel-2.c: Adjust pattern. + 2011-07-18 Rainer Orth PR target/49541 diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c index 71ed332..7f043d8 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c @@ -23,7 +23,7 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */ /* { dg-final { cleanup-tree-dump "parloops" } } */ diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-2.c b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c index 1ce0feb..03d8236 100644 --- a/libgomp/testsuite/libgomp.graphite/force-parallel-2.c +++ b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c @@ -23,7 +23,7 @@ int main(void) } /* Check that parallel code generation part make the right answer. */ -/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */ +/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 2 "graphite" } } */ /* { dg-final { cleanup-tree-dump "graphite" } } */ /* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */ /* { dg-final { cleanup-tree-dump "parloops" } } */ -- 1.7.4.1