diff options
author | MITSUNARI Shigeo <[email protected]> | 2014-03-15 17:59:21 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2014-03-15 17:59:21 +0900 |
commit | e34a3253a37a9b62c52db7165462b096a322e8e5 (patch) | |
tree | 6d93a4934e4bd9eaa9443193596be958001e626f | |
parent | bddc3147a53137b0f0d6b1885779eb25aebac32f (diff) | |
download | xbyak-e34a3253a37a9b62c52db7165462b096a322e8e5.tar.gz xbyak-e34a3253a37a9b62c52db7165462b096a322e8e5.zip |
add test of new Label
-rw-r--r-- | test/jmp.cpp | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/test/jmp.cpp b/test/jmp.cpp index 3c421fd..97785cb 100644 --- a/test/jmp.cpp +++ b/test/jmp.cpp @@ -384,27 +384,37 @@ void test4() { puts("test4"); struct Test4 : Xbyak::CodeGenerator { - explicit Test4(int size, void *mode) + Test4(int size, void *mode, bool useNewLabel) : CodeGenerator(size, mode) { - using namespace Xbyak; - inLocalLabel(); - jmp(".x"); - putNop(this, 10); - L(".x"); - ret(); - outLocalLabel(); + if (useNewLabel) { + Label x; + jmp(x); + putNop(this, 10); + L(x); + ret(); + } else { + inLocalLabel(); + jmp(".x"); + putNop(this, 10); + L(".x"); + ret(); + outLocalLabel(); + } } }; - std::string fm, gm; - Test4 fc(1024, 0); - Test4 gc(5, Xbyak::AutoGrow); - gc.ready(); - fm.assign((const char*)fc.getCode(), fc.getSize()); - gm.assign((const char*)gc.getCode(), gc.getSize()); -// dump(fm); -// dump(gm); - diff(gm, gm); + for (int i = 0; i < 2; i++) { + const bool useNewLabel = i == 0; + std::string fm, gm; + Test4 fc(1024, 0, useNewLabel); + Test4 gc(5, Xbyak::AutoGrow, !useNewLabel); + gc.ready(); + fm.assign((const char*)fc.getCode(), fc.getSize()); + gm.assign((const char*)gc.getCode(), gc.getSize()); +// dump(fm); +// dump(gm); + diff(gm, gm); + } } void test5() |