Skip to content

Commit

Permalink
Add test for issue #43
Browse files Browse the repository at this point in the history
  • Loading branch information
jmmartinez-qb committed Feb 21, 2019
1 parent 9ded393 commit ac7c320
Showing 1 changed file with 32 additions and 0 deletions.
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;
}

0 comments on commit ac7c320

Please sign in to comment.