diff --git a/gcc/testsuite/c-c++-common/gomp/adjust-args-1.c b/gcc/testsuite/c-c++-common/gomp/adjust-args-1.c
new file mode 100644
index 00000000000..728abe62092
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/adjust-args-1.c
@@ -0,0 +1,30 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+int f (int a, void *b, float c[2]);
+
+#pragma omp declare variant (f) match (construct={dispatch}) adjust_args (nothing: a) adjust_args (need_device_ptr: b, c)
+int f0 (int a, void *b, float c[2]);
+#pragma omp declare variant (f) match (construct={dispatch}) adjust_args (nothing: a) adjust_args (need_device_ptr: b) adjust_args (need_device_ptr: c)
+int f1 (int a, void *b, float c[2]);
+
+int test () {
+  int a;
+  void *b;
+  float c[2];
+  struct {int a;} s;
+
+  s.a = f0 (a, b, c);
+  #pragma omp dispatch
+  s.a = f0 (a, b, c);
+
+  f1 (a, b, c);
+  #pragma omp dispatch
+  s.a = f1 (a, b, c);
+
+  return s.a;
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_omp_get_default_device \\(\\);" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(&c, D\.\[0-9]+\\);" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(b, D\.\[0-9]+\\);" 2 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/adjust-args-2.c b/gcc/testsuite/c-c++-common/gomp/adjust-args-2.c
new file mode 100644
index 00000000000..d2a4a5f4ec4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/adjust-args-2.c
@@ -0,0 +1,31 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+int f (int a, void *b, float c[2]);
+
+#pragma omp declare variant (f) match (construct={dispatch}) adjust_args (nothing: a) adjust_args (need_device_ptr: b, c)
+int f0 (int a, void *b, float c[2]);
+#pragma omp declare variant (f) adjust_args (need_device_ptr: b, c) match (construct={dispatch}) adjust_args (nothing: a) 
+int f1 (int a, void *b, float c[2]);
+
+void test () {
+  int a;
+  void *b;
+  float c[2];
+
+  #pragma omp dispatch
+  f0 (a, b, c);
+
+  #pragma omp dispatch device (-4852)
+  f0 (a, b, c);
+
+  #pragma omp dispatch device (a + a)
+  f0 (a, b, c);
+}
+
+/* { dg-final { scan-tree-dump-times "__builtin_omp_get_default_device \\(\\);" 3 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(&c, D\.\[0-9]+\\);" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(b, D\.\[0-9]+\\);" 2 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(&c, -4852\\);" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "D\.\[0-9]+ = __builtin_omp_get_mapped_ptr \\(b, -4852\\);" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-not "#pragma omp dispatch device" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
index 05e485ef6a8..50d9b2dcf4b 100644
--- a/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
+++ b/gcc/testsuite/c-c++-common/gomp/declare-variant-2.c
@@ -8,9 +8,9 @@ void f3 (void);
 void f4 (void);
 #pragma omp declare variant match(user={condition(0)})	/* { dg-error "expected '\\(' before 'match'" } */
 void f5 (void);
-#pragma omp declare variant (f1)	/* { dg-error "expected 'match' before end of line" } */
+#pragma omp declare variant (f1)	/* { dg-error "expected 'match' or 'adjust_args' before end of line" } */
 void f6 (void);
-#pragma omp declare variant (f1) simd	/* { dg-error "expected 'match' before 'simd'" } */
+#pragma omp declare variant (f1) simd	/* { dg-error "expected 'match' or 'adjust_args' before 'simd'" } */
 void f7 (void);
 #pragma omp declare variant (f1) match	/* { dg-error "expected '\\(' before end of line" } */
 void f8 (void);
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-1.c b/gcc/testsuite/c-c++-common/gomp/dispatch-1.c
new file mode 100644
index 00000000000..2a4e939d000
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-1.c
@@ -0,0 +1,71 @@
+#include <stdint.h>
+
+int f0 (int, long, double);
+void f2 (void);
+int f3 (void);
+void (*f4) (void);
+void f5 (int*, int);
+
+int *pp (void);
+int dd (void);
+
+void f1 (void)
+{
+  int a, c;
+  long b;
+  double x;
+  struct {int a; float b; short c;} s, *sp;
+  int arr[3];
+
+#pragma omp dispatch
+  c = f0 (a, b, x);
+#pragma omp dispatch
+  x = f0 (a * 4, 2 - b, x * x);
+#pragma omp dispatch
+  s.a = f0 (a, sp->c, x);
+#pragma omp dispatch
+  sp->c = f0 (s.a - 2, b / 3, x * 5);
+#pragma omp dispatch
+  arr[0] = f0 (arr[1], !b, arr[2]);
+#pragma omp dispatch
+  (*sp).c = f0 (s.a, b, x);
+#pragma omp dispatch
+  sp->b = f0 (s.a++, b % 4, --x);
+#pragma omp dispatch
+  f0 (f3(), b, s.b);
+#pragma omp dispatch
+  f2 ();
+#pragma omp dispatch
+  f4 ();
+#pragma omp dispatch
+  f5 (pp(), pp()[dd()]);
+  
+#pragma omp dispatch nocontext(sp->a * x + arr[2])
+  f2 ();
+#pragma omp dispatch nocontext(arr - (intptr_t)(x / s.b))
+  f2 ();
+#pragma omp dispatch nocontext(x == s.c || b != c)
+  f2 ();
+#pragma omp dispatch novariants(b << sp->c)
+  f2 ();
+#pragma omp dispatch novariants(!arr | s.a)
+  f2 ();
+#pragma omp dispatch novariants(s.c ? f3() : a & c)
+  f2 ();
+#pragma omp dispatch nowait
+  f2 ();
+#pragma omp dispatch device(-25373654)
+  f2 ();
+#pragma omp dispatch device(b * (int)(x - sp->b))
+  f2 ();
+#pragma omp dispatch is_device_ptr(arr)
+  f2 ();
+#pragma omp dispatch is_device_ptr(sp)
+  f2 ();
+#pragma omp dispatch depend(inout: sp)
+  f2 ();
+#pragma omp dispatch depend(inoutset: arr[:2])
+  f2 ();
+#pragma omp dispatch depend(out: arr)
+  f2 ();
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-2.c b/gcc/testsuite/c-c++-common/gomp/dispatch-2.c
new file mode 100644
index 00000000000..24ab9545b73
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-2.c
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+int f0 (void);
+int f1 (void);
+#pragma omp declare variant (f0) match (construct={dispatch})
+#pragma omp declare variant (f1) match (implementation={vendor(gnu)})
+int f2 (void);
+
+int test (void)
+{
+  int a;
+#pragma omp dispatch
+  a = f2 ();
+#pragma omp dispatch novariants(1)
+  a = f2 ();
+#pragma omp dispatch novariants(0)
+  a = f2 ();
+#pragma omp dispatch nocontext(1)
+  a = f2 ();
+#pragma omp dispatch nocontext(0)
+  a = f2 ();
+  return a;
+}
+
+/* { dg-final { scan-tree-dump-times "a = f0 \\\(\\\);" 3 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "a = f1 \\\(\\\);" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "a = f2 \\\(\\\);" 1 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-3.c b/gcc/testsuite/c-c++-common/gomp/dispatch-3.c
new file mode 100644
index 00000000000..dba1d4ffdc8
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-3.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+void f2 (void);
+
+void test (void)
+{
+#pragma omp dispatch  /* { dg-final { scan-tree-dump-not "#pragma omp task" "gimple" } } */
+  f2 ();
+#pragma omp dispatch nowait /* { dg-final { scan-tree-dump-not "nowait" "gimple" } } */
+  f2 ();
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-4.c b/gcc/testsuite/c-c++-common/gomp/dispatch-4.c
new file mode 100644
index 00000000000..ac746f755be
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-4.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+void f2 (int a);
+
+void test (void)
+{
+  int a;
+
+#pragma omp dispatch device(-25373654)
+/* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(-25373654\\);" 1 "gimple" } } */
+  f2 (a);
+#pragma omp dispatch device(a + a)
+/* { dg-final { scan-tree-dump-times "(D\.\[0-9]+) = a \\* 2;.*#pragma omp dispatch.*__builtin_omp_set_default_device \\(\\1\\);.*f2 \\(a\\)" 2 "gimple" } } */
+  f2 (a);
+}
+
+/* { dg-final { scan-tree-dump-times "(D\.\[0-9]+) = __builtin_omp_get_default_device \\(\\);.*__builtin_omp_set_default_device \\(\\1\\);" 4 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-5.c b/gcc/testsuite/c-c++-common/gomp/dispatch-5.c
new file mode 100644
index 00000000000..608c6d9f154
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-5.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+void f1 (void* p, int arr[]);
+#pragma omp declare variant (f1) match (construct={dispatch}) adjust_args (need_device_ptr: p, arr)
+void f2 (void* p, int arr[]);
+
+void test (void)
+{
+  void *p;
+  int arr[2];
+
+/* Note there are multiple matches because every variable capturing matches in addition,
+   i.e. scan-tree-dump-times = 1 plus number of captures used for backward references.
+
+   For the first scan-tree-dump, on some targets the __builtin_omp_get_mapped_ptr get
+   swapped. As the counting does not work well with variable-name capturing, it only
+   uses 'scan-tree-dump' and not 'scan-tree-dump-times'.  */
+
+#pragma omp dispatch
+/* { dg-final { scan-tree-dump "#pragma omp dispatch\[ \t\n\r\{]*int (D\.\[0-9]+);\[ \t\n\r]*void \\* (D\.\[0-9]+);\[ \t\n\r]*void \\* (D\.\[0-9]+);\[ \t\n\r]*\\1 = __builtin_omp_get_default_device \\(\\);\[ \t\n\r]*\\2 = __builtin_omp_get_mapped_ptr \\(&arr, \\1\\);\[ \t\n\r]*\\3 = __builtin_omp_get_mapped_ptr \\(p, \\1\\);\[ \t\n\r]*f1 \\(\\3, \\2\\);|#pragma omp dispatch\[ \t\n\r\{]*int (D\.\[0-9]+);\[ \t\n\r]*void \\* (D\.\[0-9]+);\[ \t\n\r]*void \\* (D\.\[0-9]+);\[ \t\n\r]*\\4 = __builtin_omp_get_default_device \\(\\);\[ \t\n\r]*\\5 = __builtin_omp_get_mapped_ptr \\(p, \\4\\);\[ \t\n\r]*\\6 = __builtin_omp_get_mapped_ptr \\(&arr, \\4\\);\[ \t\n\r]*f1 \\(\\5, \\6\\);" "gimple" } } */
+  f2 (p, arr);
+#pragma omp dispatch is_device_ptr(p)
+/* { dg-final { scan-tree-dump-times "#pragma omp dispatch is_device_ptr\\(p\\)\[ \t\n\r\{]*int (D\.\[0-9]+);\[ \t\n\r]*void \\* (D\.\[0-9]+);\[ \t\n\r]*\\1 = __builtin_omp_get_default_device \\(\\);\[ \t\n\r]*\\2 = __builtin_omp_get_mapped_ptr \\(&arr, \\1\\);\[ \t\n\r]*f1 \\(p, \\2\\);" 3 "gimple" } } */
+  f2 (p, arr);
+#pragma omp dispatch is_device_ptr(arr)
+/* { dg-final { scan-tree-dump-times "#pragma omp dispatch is_device_ptr\\(arr\\)\[ \t\n\r\{]*int (D\.\[0-9]+);\[ \t\n\r]*void \\* (D\.\[0-9]+);\[ \t\n\r]*\\1 = __builtin_omp_get_default_device \\(\\);\[ \t\n\r]*\\2 = __builtin_omp_get_mapped_ptr \\(p, \\1\\);\[ \t\n\r]*f1 \\(\\2, &arr\\);" 3 "gimple" } } */
+  f2 (p, arr);
+#pragma omp dispatch is_device_ptr(p, arr)
+/* { dg-final { scan-tree-dump-times "#pragma omp dispatch is_device_ptr\\(arr\\) is_device_ptr\\(p\\)\[ \t\n\r\{]*f1 \\(p, &arr\\);" 1 "gimple" } } */
+  f2 (p, arr);
+}
+
+
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-6.c b/gcc/testsuite/c-c++-common/gomp/dispatch-6.c
new file mode 100644
index 00000000000..4e900bb5e8d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-6.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-ompexp" } */
+
+void f2 (void* p);
+
+void test (void)
+{
+  void *p;
+
+#pragma omp dispatch
+/* { dg-final { scan-tree-dump-not "__builtin_GOMP_task " "ompexp" } } */
+  f2 (p);
+#pragma omp dispatch depend(inout: p)
+/* { dg-final { scan-tree-dump-times "(D\.\[0-9]+)\\\[2] = &p;\[ \n]*__builtin_GOMP_taskwait_depend \\(&\\1\\);" 2 "ompexp" } } */
+  f2 (p);
+}
+
+
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-7.c b/gcc/testsuite/c-c++-common/gomp/dispatch-7.c
new file mode 100644
index 00000000000..44a62608eb0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-7.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-gimple" } */
+
+int f0 (void);
+int f1 (void);
+#pragma omp declare variant (f0) match (construct={dispatch})
+#pragma omp declare variant (f1) match (implementation={vendor(gnu)})
+int f2 (void);
+
+int test (void)
+{
+  int a, n;
+#pragma omp dispatch novariants(n < 1024) nocontext(n > 1024)
+  a = f2 ();
+  return a;
+}
+
+/* { dg-final { scan-tree-dump-times "#pragma omp dispatch nocontext\\(0\\) novariants\\(0\\)" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "a = f2 \\\(\\\);" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "a = f1 \\\(\\\);" 1 "gimple" } } */
+/* { dg-final { scan-tree-dump-times "a = f0 \\\(\\\);" 1 "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-8.c b/gcc/testsuite/c-c++-common/gomp/dispatch-8.c
new file mode 100644
index 00000000000..11713554a82
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-8.c
@@ -0,0 +1,63 @@
+int g1() { return 100; }
+int g2() { return 200; }
+
+#pragma omp declare variant (g1) match (construct={dispatch},user={condition(1)})
+#pragma omp declare variant (g2) match (user={condition(1)})
+int g() { return 300; }
+
+
+int f1(int x) { return 1 + x; }
+int f2(int x) { return 2 + x; }
+
+#pragma omp declare variant (f1) match (construct={dispatch},user={condition(1)})
+#pragma omp declare variant (f2) match (user={condition(1)})
+int f(int x) { return 3 + x; }
+
+
+void
+test ()
+{
+  int res;
+
+  // Call f2(g2()) due to user condition(1)
+  res = f (g ());
+  __builtin_printf("%d\n", res);
+  if (res != 202)
+    __builtin_abort ();
+
+  // Call 'f1(g1())' due to construct 'dispatch' and user conditional(1)
+  #pragma omp dispatch
+    res = f (g ());
+  __builtin_printf("%d\n", res);
+  if (res != 101)
+     __builtin_abort ();
+
+  // Call 'f2(g2())' due to nocontext (i.e. ignore construct 'dispatch') and user conditional(1)
+  #pragma omp dispatch nocontext(1)
+    res = f (g ());
+  __builtin_printf("%d\n", res);
+  if (res != 202)
+     __builtin_abort ();
+
+  // Call 'f' due to 'novariants'
+  // Call 'g1' due to construct 'dispatch' and user conditional(1)
+  #pragma omp dispatch novariants(1)
+    res = f (g ());
+  __builtin_printf("%d\n", res);   /* ACTUAL RESULT: 303, i.e. 'g' and not 'g1' was called */
+  if (res != 103)
+     __builtin_abort ();
+
+  // Call 'f' due to 'novariants'
+  // Call 'g2' due to  nocontext (i.e. ignore construct 'dispatch') and user conditional(1)
+  #pragma omp dispatch novariants(1) nocontext(1)
+    res = f (g ());
+  __builtin_printf("%d\n", res);   /* ACTUAL RESULT: 303, i.e. 'g' and not 'g2' was called */
+  if (res != 203)
+     __builtin_abort ();
+}
+
+int
+main ()
+{
+  test ();
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-9.c b/gcc/testsuite/c-c++-common/gomp/dispatch-9.c
new file mode 100644
index 00000000000..b4b46b946fd
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/dispatch-9.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fdump-tree-original -fdump-tree-gimple" } */
+
+/* Check that the right call to f is wrapped in a GOMP_DISPATCH internal function
+   before translation and that it is stripped during gimplification. */
+
+int f(int);
+void g(int *x)
+{
+  #pragma omp dispatch
+  x[f(1)] = f(f(2));
+  //        ^ only this call to f is a dispatch call
+}
+
+/* { dg-final { scan-tree-dump "\.GOMP_DISPATCH \\(f \\(f \\(2\\)\\)\\)" "original" } } */
+/* { dg-final { scan-tree-dump-times "\.GOMP_DISPATCH" 1 "original" } } */
+/* { dg-final { scan-tree-dump-not "\.GOMP_DISPATCH" "gimple" } } */
diff --git a/libgomp/testsuite/libgomp.c/dispatch-1.c b/libgomp/testsuite/libgomp.c-c++-common/dispatch-1.c
similarity index 100%
rename from libgomp/testsuite/libgomp.c/dispatch-1.c
rename to libgomp/testsuite/libgomp.c-c++-common/dispatch-1.c
diff --git a/libgomp/testsuite/libgomp.c/dispatch-2.c b/libgomp/testsuite/libgomp.c-c++-common/dispatch-2.c
similarity index 100%
rename from libgomp/testsuite/libgomp.c/dispatch-2.c
rename to libgomp/testsuite/libgomp.c-c++-common/dispatch-2.c
