diff mbox

[gomp4] Remove some ptxness from middle end

Message ID 5588659E.8050909@codesourcery.com
State New
Headers show

Commit Message

Nathan Sidwell June 22, 2015, 7:44 p.m. UTC
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
diff mbox

Patch

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);