diff mbox

[gomp4] openacc id builtin

Message ID 558D480D.9050602@acm.org
State New
Headers show

Commit Message

Nathan Sidwell June 26, 2015, 12:39 p.m. UTC
I discovered a latent bug in the openacc thread id builtin and associated 
unspec.  They should not be treated as constant functions, because that causes 
the compiler to consider them constant across threads.  Which of course they are 
not.

Applied to gomp4 branch

nathan
diff mbox

Patch

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

	* config/nvptx/nvptx.md (UNSPEC_ID): Rename to ...
	(UNSPECV_ID): ... here.
	(oacc_id): Make volatile.
	* omp-builtins.def (BUILT_IN_GOACC_ID): Not a constant function.

@@ -2802,3 +2809,8 @@  Copyright (C) 2013-2015 Free Software Fo
 Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
 notice and this notice are preserved.
+
+Local Variables:
+mode: change-log
+change-log-default-name: "ChangeLog.gomp"
+End:
Index: config/nvptx/nvptx.md
===================================================================
--- config/nvptx/nvptx.md	(revision 224987)
+++ config/nvptx/nvptx.md	(working copy)
@@ -50,7 +50,6 @@ 
    UNSPEC_ALLOCA
 
    UNSPEC_NID
-   UNSPEC_ID
 
    UNSPEC_SHARED_DATA
 ])
@@ -61,6 +60,7 @@ 
    UNSPECV_XCHG
    UNSPECV_WARP_BCAST
    UNSPECV_BARSYNC
+   UNSPECV_ID
 ])
 
 (define_attr "subregs_ok" "false,true"
@@ -1313,7 +1313,8 @@ 
 
 (define_insn "oacc_id"
   [(set (match_operand:SI 0 "nvptx_register_operand" "")
-	(unspec:SI [(match_operand:SI 1 "const_int_operand" "")] UNSPEC_ID))]
+	(unspec_volatile:SI [(match_operand:SI 1 "const_int_operand" "")]
+			UNSPECV_ID))]
   ""
 {
   static const char *const asms[] =
Index: omp-builtins.def
===================================================================
--- omp-builtins.def	(revision 224987)
+++ omp-builtins.def	(working copy)
@@ -62,7 +62,7 @@  DEF_GOACC_BUILTIN (BUILT_IN_GOACC_WAIT,
 		   BT_FN_VOID_INT_INT_VAR,
 		   ATTR_NOTHROW_LIST)
 DEF_GOACC_BUILTIN (BUILT_IN_GOACC_ID, "GOACC_id",
-		   BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)
+		   BT_FN_UINT_UINT, ATTR_NOTHROW_LEAF_LIST)
 DEF_GOACC_BUILTIN (BUILT_IN_GOACC_NID, "GOACC_nid",
 		   BT_FN_UINT_UINT, ATTR_CONST_NOTHROW_LEAF_LIST)
 DEF_GOACC_BUILTIN (BUILT_IN_GOACC_GET_GANGLOCAL_PTR, "GOACC_get_ganglocal_ptr",