From ac7c320544bedc3f50332ddcd3a589d6dcd30a90 Mon Sep 17 00:00:00 2001 From: jmmartinez Date: Thu, 21 Feb 2019 15:30:48 +0100 Subject: [PATCH] Add test for issue #43 --- tests/from_issues/issue_43.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/from_issues/issue_43.cpp diff --git a/tests/from_issues/issue_43.cpp b/tests/from_issues/issue_43.cpp new file mode 100644 index 0000000..58da8b8 --- /dev/null +++ b/tests/from_issues/issue_43.cpp @@ -0,0 +1,32 @@ +// issue https://github.com/jmmartinez/easy-just-in-time/issues/43 reported by mame +// RUN: %clangxx %cxxflags %include_flags %ld_flags %s -Xclang -load -Xclang %lib_pass -o %t +// RUN: %t + +#include +#include + +using namespace std; + +static void EASY_JIT_EXPOSE kernel(const int a, const int b, int * const res) +{ + for(int x = 1; x < a; x++) + { + for(int y = 1; y < b; y++) + { + *res += a*b - b; + } + } +} + +int main(int argc, char **argv) +{ + int res = 0; + kernel(1000, 250000, &res); + + using namespace std::placeholders; + auto kernel_opt = easy::jit(kernel, 1000, 250000, _1); + kernel_opt(&res); + + cout << res << endl; + return 0; +}