Squashed 'external/xbyak/' content from commit 431abd86

git-subtree-dir: external/xbyak
git-subtree-split: 431abd865e70a46d56f5aa0e1f87572decb60169
This commit is contained in:
2026-05-12 14:03:16 +02:00
commit 2201a02272
146 changed files with 108693 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#include <xbyak/xbyak_util.h>
#ifdef XBYAK32
#error "this sample is for only 64-bit mode"
#endif
struct Code : public Xbyak::CodeGenerator {
Code()
{
// see xbyak/sample/sf_test.cpp for how to use other parameter
Xbyak::util::StackFrame sf(this, 3);
mov(rax, sf.p[0]);
add(rax, sf.p[1]);
add(rax, sf.p[2]);
}
};
int main()
{
Code c;
int (*f)(int, int, int) = c.getCode<int(*) (int, int, int)>();
int ret = f(3, 5, 2);
if (ret == 3 + 5 + 2) {
puts("ok");
} else {
puts("ng");
}
}