commit | 6a246e6b0577aab68887252c3793aab9d619a2fc | [log] [tgz] |
---|---|---|
author | MITSUNARI Shigeo <herumi@nifty.com> | Thu Feb 10 10:29:19 2011 +0900 |
committer | MITSUNARI Shigeo <herumi@nifty.com> | Thu Feb 10 10:29:19 2011 +0900 |
tree | d33b0415110bb29f5710aa9bc339cd6a3f2a3555 | |
parent | 6b6527ccad8fa718d865e4c6d6e24dfeddee5f57 [diff] |
trivial fix readme.md
This is a header file which enables dynamically to assemble x86(IA32), x64(AMD64, x86-64) mnemonic.
header file only you can use Xbyak's functions at once if xbyak.h is included.
MMX/MMX2/SSE/SSE2/SSE3/SSSE3/SSE4/FPU(partial)/AVX
Note: “-fno-operator-names” option is required on gcc to avoid analyzing “and”, “or”, etc. as operators.
The following files are necessary. Please add the path to your compile directories.
Linux:
make install
These files are copied into /usr/local/include/xbyak
Make Xbyak::CodeGenerator and make the class method and get the function pointer by calling cgetCode() and casting the return value.
NASM Xbyak mov eax, ebx --> mov(eax, ebx); inc ecx inc(ecx); ret --> ret();
(ptr|dword|word|byte) [base + index * (1|2|4|8) + displacement] [rip + 32bit disp] ; x64 only NASM Xbyak mov eax, [ebx+ecx] --> mov (eax, ptr[ebx+ecx]); test byte [esp], 4 --> test (byte [esp], 4);
you can use ptr for almost memory access unless you specify the size of memory.
dword, word and byte are class members, then don't use dword as unsigned int, for example.
You can omit a destination for almost 3-op mnemonics.
vaddps(xmm1, xmm2, xmm3); // xmm1 <- xmm2 + xmm3 vaddps(xmm2, xmm3); // xmm2 <- xmm2 + xmm3 vaddps(xmm2, xmm3, ptr [rax]); // use ptr to access memory
L("L1"); jmp ("L1"); jmp ("L2"); ... a few mnemonics(8-bit displacement jmp) ... L("L2"); jmp ("L3", T_NEAR); ... a lot of mnemonics(32-bit displacement jmp) ... L("L3");
Call hasUndefinedLabel() to verify your code has no undefined label.
L("@@"); // <A> jmp("@b"); // jmp to <A> jmp("@f"); // jmp to <B> L("@@"); // <B> jmp("@b"); // jmp to <B>
void func1() { inLocalLabel(); L(".lp"); // <A> ... jmp(".lp"); // jmpt to <A> outLocalLabel(); } void func2() { L(".lp"); // <B> func1(); jmp(".lp"); // jmp to <B> }
The default max code size is 2048 bytes. Please set it in constructor of CodeGenerator() if you want to use large size.
class Quantize : public Xbyak::CodeGenerator { public: Quantize() : CodeGenerator(8192) { } ... };
See main.cpp
The current version does not support 3D Now!, 80bit FPU load/store and some special mnemonics. Please mail to me if necessary.
modified new BSD License http://www.opensource.org/licenses/bsd-license.php
MITSUNARI Shigeo(herumi at nifty dot com)
$Revision: 1.3 $ $Date: 2011/02/10 01:29:02 $