Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work on issue #43 #44

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tests/from_issues/issue_43.cpp
Original file line number Diff line number Diff line change
@@ -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 <iostream>
#include <easy/jit.h>

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;
}