public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Nathan Sidwell <nathan@codesourcery.com>
To: Marek Polacek <polacek@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [gomp4] Remove some ptxness from middle end
Date: Mon, 22 Jun 2015 20:50:00 -0000	[thread overview]
Message-ID: <5588659E.8050909@codesourcery.com> (raw)
In-Reply-To: <20150622170449.GL10139@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 418 bytes --]

On 06/22/15 13:04, Marek Polacek wrote:
> On Mon, Jun 22, 2015 at 01:00:51PM -0400, Nathan Sidwell wrote:
>> +  if (GET_CODE (arg) != CONST_INT
>> +      || (unsigned HOST_WIDE_INT)INTVAL (arg) >= OACC_HWM)
>
> Don't we have UINTVAL for this?  So UINTVAL (arg).

Applied the attached, after testing.  Also realized I'd missed some places I 
should have used the new loop level enumeration.

nathan

-- 
Nathan Sidwell

[-- Attachment #2: cleanup.patch --]
[-- Type: text/x-patch, Size: 1998 bytes --]

2015-06-22  Nathan Sidwell  <nathan@codesourcery.com>

	* omp-low.c (expand_oacc_get_num_threads): Use OACC enum.
	(expand_oacc_get_thread_num, make_predication_test): Likewise.
	* builtins.c (expand_oacc_id): Use UINTVAL.

Index: omp-low.c
===================================================================
--- omp-low.c	(revision 224747)
+++ omp-low.c	(working copy)
@@ -4994,8 +4994,8 @@ expand_oacc_get_num_threads (gimple_seq
   tree  decl = builtin_decl_explicit (BUILT_IN_GOACC_NID);
   unsigned ix;
 
-  for (ix = 0; (1 << ix) <= gwv_bits; ix++)
-    if ((1 << ix) & gwv_bits)
+  for (ix = OACC_gang; ix != OACC_HWM; ix++)
+    if (OACC_LOOP_MASK(ix) & gwv_bits)
       {
 	tree arg = build_int_cst (unsigned_type_node, ix);
 	tree count = create_tmp_var (unsigned_type_node);
@@ -5022,8 +5022,8 @@ expand_oacc_get_thread_num (gimple_seq *
   unsigned ix;
 
   /* Start at gang level, and examine relevant dimension indices.  */
-  for (ix = 0; (1 << ix) <= gwv_bits; ix++)
-    if ((1 << ix) & gwv_bits)
+  for (ix = OACC_gang; ix != OACC_HWM; ix++)
+    if (OACC_LOOP_MASK (ix) & gwv_bits)
       {
 	tree arg = build_int_cst (unsigned_type_node, ix);
 
@@ -10671,7 +10671,7 @@ make_predication_test (edge true_edge, b
   unsigned ix;
 
   for (ix = OACC_worker; ix <= OACC_vector; ix++)
-    if (mask & (1 << ix))
+    if (OACC_LOOP_MASK (ix) & mask)
       {
 	gimple call = gimple_build_call
 	  (decl, 1, build_int_cst (unsigned_type_node, ix));
Index: builtins.c
===================================================================
--- builtins.c	(revision 224747)
+++ builtins.c	(working copy)
@@ -5971,8 +5971,7 @@ expand_oacc_id (enum built_in_function f
   rtx arg;
 
   arg = expand_normal (arg0);
-  if (GET_CODE (arg) != CONST_INT
-      || (unsigned HOST_WIDE_INT)INTVAL (arg) >= OACC_HWM)
+  if (GET_CODE (arg) != CONST_INT || UINTVAL (arg) >= OACC_HWM)
     {
       error ("argument to %D must be constant in range 0 to %d",
 	     get_callee_fndecl (exp), OACC_HWM - 1);

      parent reply	other threads:[~2015-06-22 19:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22 17:04 Nathan Sidwell
2015-06-22 17:04 ` Marek Polacek
2015-06-22 17:10   ` Nathan Sidwell
2015-06-22 20:50   ` Nathan Sidwell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5588659E.8050909@codesourcery.com \
    --to=nathan@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=polacek@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).