diff mbox

[gomp4.1] Remove middle argument of omp_target_is_present

Message ID 20151009082137.GD8714@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Oct. 9, 2015, 8:21 a.m. UTC
Hi!

As one can just use pointer-arithmetics on the first argument, and that
argument is the host pointer, there is no point to have an OFFSET argument
and it got removed from the upcoming 4.5.

2015-10-09  Jakub Jelinek  <jakub@redhat.com>

	* omp.h.in (omp_target_is_present): Remove OFFSET argument.
	* target.c (omp_target_is_present): Likewise.
	* testsuite/libgomp.c/target-12.c (main): Adjust for removal
	of the middle argument of omp_target_is_present.
	* testsuite/libgomp.c/target-24.c (main): Likewise.



	Jakub
diff mbox

Patch

--- libgomp/omp.h.in.jj	2015-07-10 18:49:17.000000000 +0200
+++ libgomp/omp.h.in	2015-10-09 10:08:55.479460438 +0200
@@ -144,7 +144,7 @@  extern int omp_get_max_task_priority (vo
 
 extern void *omp_target_alloc (__SIZE_TYPE__, int) __GOMP_NOTHROW;
 extern void omp_target_free (void *, int) __GOMP_NOTHROW;
-extern int omp_target_is_present (void *, __SIZE_TYPE__, int) __GOMP_NOTHROW;
+extern int omp_target_is_present (void *, int) __GOMP_NOTHROW;
 extern int omp_target_memcpy (void *, void *, __SIZE_TYPE__, __SIZE_TYPE__,
 			      __SIZE_TYPE__, int, int) __GOMP_NOTHROW;
 extern int omp_target_memcpy_rect (void *, void *, __SIZE_TYPE__, int,
--- libgomp/target.c.jj	2015-09-08 09:55:24.000000000 +0200
+++ libgomp/target.c	2015-10-09 10:09:53.452638946 +0200
@@ -1731,10 +1731,10 @@  omp_target_free (void *device_ptr, int d
 }
 
 int
-omp_target_is_present (void *ptr, size_t offset, int device_num)
+omp_target_is_present (void *ptr, int device_num)
 {
   if (ptr == NULL)
-    return offset == 0;
+    return 1;
 
   if (device_num == GOMP_DEVICE_HOST_FALLBACK)
     return 1;
@@ -1753,7 +1753,7 @@  omp_target_is_present (void *ptr, size_t
   struct splay_tree_s *mem_map = &devicep->mem_map;
   struct splay_tree_key_s cur_node;
 
-  cur_node.host_start = (uintptr_t) ptr + offset;
+  cur_node.host_start = (uintptr_t) ptr;
   cur_node.host_end = cur_node.host_start;
   splay_tree_key n = gomp_map_lookup (mem_map, &cur_node);
   int ret = n != NULL;
--- libgomp/testsuite/libgomp.c/target-12.c.jj	2015-07-15 13:00:32.000000000 +0200
+++ libgomp/testsuite/libgomp.c/target-12.c	2015-10-09 10:11:17.898442349 +0200
@@ -39,9 +39,9 @@  main ()
       if (omp_target_associate_ptr (q, p, 128 * sizeof (int), sizeof (int), d) != 0)
 	abort ();
 
-      if (omp_target_is_present (q, 0, d) != 1
-	  || omp_target_is_present (q, 32 * sizeof (int), d) != 1
-	  || omp_target_is_present (q, 128 * sizeof (int), d) != 1)
+      if (omp_target_is_present (q, d) != 1
+	  || omp_target_is_present (&q[32], d) != 1
+	  || omp_target_is_present (&q[128], d) != 1)
 	abort ();
 
       if (omp_target_memcpy (p, q, 128 * sizeof (int), sizeof (int), 0,
--- libgomp/testsuite/libgomp.c/target-24.c.jj	2015-09-02 16:54:13.000000000 +0200
+++ libgomp/testsuite/libgomp.c/target-24.c	2015-10-09 10:11:46.834032335 +0200
@@ -15,28 +15,28 @@  main ()
   int shared_mem = 0;
   #pragma omp target map (alloc: shared_mem)
   shared_mem = 1;
-  if (omp_target_is_present (b, 0, d) != shared_mem)
+  if (omp_target_is_present (b, d) != shared_mem)
     abort ();
   #pragma omp target enter data map (to: a)
-  if (omp_target_is_present (b, 0, d) == 0)
+  if (omp_target_is_present (b, d) == 0)
     abort ();
   #pragma omp target enter data map (alloc: b[:0])
-  if (omp_target_is_present (b, 0, d) == 0)
+  if (omp_target_is_present (b, d) == 0)
     abort ();
   #pragma omp target exit data map (release: b[:0])
-  if (omp_target_is_present (b, 0, d) == 0)
+  if (omp_target_is_present (b, d) == 0)
     abort ();
   #pragma omp target exit data map (release: b[:0])
-  if (omp_target_is_present (b, 0, d) != shared_mem)
+  if (omp_target_is_present (b, d) != shared_mem)
     abort ();
   #pragma omp target enter data map (to: a)
-  if (omp_target_is_present (b, 0, d) == 0)
+  if (omp_target_is_present (b, d) == 0)
     abort ();
   #pragma omp target enter data map (always, to: b[:0])
-  if (omp_target_is_present (b, 0, d) == 0)
+  if (omp_target_is_present (b, d) == 0)
     abort ();
   #pragma omp target exit data map (delete: b[:0])
-  if (omp_target_is_present (b, 0, d) != shared_mem)
+  if (omp_target_is_present (b, d) != shared_mem)
     abort ();
   #pragma omp target exit data map (from: b[:0])
   return 0;