summaryrefslogtreecommitdiff
path: root/offload/test/offloading/test_libc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'offload/test/offloading/test_libc.cpp')
-rw-r--r--offload/test/offloading/test_libc.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/offload/test/offloading/test_libc.cpp b/offload/test/offloading/test_libc.cpp
new file mode 100644
index 000000000000..859c2da97de0
--- /dev/null
+++ b/offload/test/offloading/test_libc.cpp
@@ -0,0 +1,28 @@
+// RUN: %libomptarget-compilexx-run-and-check-generic
+
+#include <algorithm>
+
+extern "C" int printf(const char *, ...);
+
+// std::equal is lowered to libc function memcmp.
+void test_memcpy() {
+ int r = 0;
+#pragma omp target map(from : r)
+ {
+ int x[2] = {0, 0};
+ int y[2] = {0, 0};
+ int z[2] = {0, 1};
+ bool eq1 = std::equal(x, x + 2, y);
+ bool eq2 = std::equal(x, x + 2, z);
+ r = eq1 && !eq2;
+ }
+ printf("memcmp: %s\n", r ? "PASS" : "FAIL");
+}
+
+int main(int argc, char *argv[]) {
+ test_memcpy();
+
+ return 0;
+}
+
+// CHECK: memcmp: PASS