-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ded393
commit ac7c320
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |