add lib test
This commit is contained in:
parent
6f57b3cf03
commit
d548d02e2c
3 changed files with 32 additions and 0 deletions
|
@ -49,6 +49,12 @@ test_avx: normalize_prefix
|
||||||
clean:
|
clean:
|
||||||
rm -rf *.o $(TARGET)
|
rm -rf *.o $(TARGET)
|
||||||
|
|
||||||
|
lib_test.a: lib_test.cpp
|
||||||
|
$(CXX) -c $(CFLAGS) lib_test.cpp
|
||||||
|
ar r lib_test.a lib_test.o
|
||||||
|
|
||||||
|
lib_run: lib_test.a lib_run.cpp
|
||||||
|
$(CXX) $(CFLAGS) lib_run.cpp lib_test.a -o lib_run
|
||||||
make_nm: make_nm.cpp $(XBYAK_INC)
|
make_nm: make_nm.cpp $(XBYAK_INC)
|
||||||
|
|
||||||
|
|
||||||
|
|
9
test/lib_run.cpp
Normal file
9
test/lib_run.cpp
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int ret123();
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printf("ret=%d\n", ret123());
|
||||||
|
}
|
||||||
|
|
17
test/lib_test.cpp
Normal file
17
test/lib_test.cpp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#include <xbyak/xbyak.h>
|
||||||
|
|
||||||
|
struct Code : public Xbyak::CodeGenerator {
|
||||||
|
Code()
|
||||||
|
{
|
||||||
|
mov(eax, 5);
|
||||||
|
ret();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int ret123()
|
||||||
|
{
|
||||||
|
static Code code;
|
||||||
|
int (*f)() = (int (*)())code.getCode();
|
||||||
|
return f();
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue