mirror of
https://github.com/herumi/xbyak
synced 2024-11-20 16:06:14 -07:00
cosmetic modification
This commit is contained in:
parent
0f7dea2f31
commit
0e96302822
6 changed files with 32 additions and 43 deletions
|
@ -1,5 +1,5 @@
|
|||
|
||||
Xbyak 3.01 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
|
||||
Xbyak 3.02 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
|
||||
=============
|
||||
|
||||
Abstract
|
||||
|
@ -202,6 +202,7 @@ http://www.opensource.org/licenses/bsd-license.php
|
|||
History
|
||||
-------------
|
||||
|
||||
* 2011/Apr/28 ver 3.02 do not use xgetbv on Mac gcc
|
||||
* 2011/May/24 ver 3.01 fix typo of OSXSAVE
|
||||
* 2011/May/23 ver 3.00 add vcmpeqps and so on
|
||||
* 2011/Feb/16 ver 2.994 beta add vmovq for 32-bit mode(I forgot it)
|
||||
|
@ -248,5 +249,5 @@ Author
|
|||
MITSUNARI Shigeo(herumi at nifty dot com)
|
||||
|
||||
---
|
||||
$Revision: 1.10 $
|
||||
$Date: 2011/03/24 06:32:21 $
|
||||
$Revision: 1.11 $
|
||||
$Date: 2011/04/27 20:43:24 $
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak version 3.01
|
||||
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak version 3.02
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
◎概要
|
||||
|
@ -214,6 +214,7 @@ sample/{echo,hello}.bfは http://www.kmonos.net/alang/etc/brainfuck.php から
|
|||
-----------------------------------------------------------------------------
|
||||
◎履歴
|
||||
|
||||
2011/04/28 ver 3.02 Macのgcc上ではxgetbvをdisable
|
||||
2011/03/24 ver 3.01 fix typo of OSXSAVE
|
||||
2011/03/23 ver 3.00 vcmpeqpsなどを追加
|
||||
2011/02/16 ver 2.994 beta add vmovq for 32-bit mode(I forgot it)
|
||||
|
|
|
@ -34,15 +34,9 @@ public:
|
|||
// void (*)(void* putchar, void* getchar, int *stack)
|
||||
using namespace Xbyak;
|
||||
#ifdef XBYAK32
|
||||
#if defined(_MSC_VER) && (_MSC_VER <= 1200) // for VC6
|
||||
const Reg32 pPutchar(esi);
|
||||
const Reg32 pGetchar(edi);
|
||||
const Reg32 stack(ebp);
|
||||
#else
|
||||
const Reg32& pPutchar(esi);
|
||||
const Reg32& pGetchar(edi);
|
||||
const Reg32& stack(ebp);
|
||||
#endif
|
||||
const Address cur = dword [stack];
|
||||
push(ebp); // stack
|
||||
push(esi);
|
||||
|
|
|
@ -28,28 +28,11 @@
|
|||
#include <memory.h>
|
||||
#include <vector>
|
||||
#include "xbyak/xbyak.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4996) // scanf
|
||||
#endif
|
||||
#include "xbyak/xbyak_util.h"
|
||||
#define NUM_OF_ARRAY(x) (sizeof(x) / sizeof(x[0]))
|
||||
|
||||
using namespace Xbyak;
|
||||
|
||||
uint64 getRdtsc()
|
||||
{
|
||||
#ifdef _WIN64
|
||||
return __rdtsc();
|
||||
#elif defined(WIN32)
|
||||
__asm {
|
||||
rdtsc
|
||||
}
|
||||
#else
|
||||
uint64 x;
|
||||
__asm__ volatile("rdtsc" : "=A" (x));
|
||||
return x;
|
||||
#endif
|
||||
}
|
||||
|
||||
class ToyVm : public Xbyak::CodeGenerator {
|
||||
typedef std::vector<uint32> Buffer;
|
||||
public:
|
||||
|
@ -313,23 +296,33 @@ int main()
|
|||
{
|
||||
try {
|
||||
const int n = 10000;
|
||||
uint64 p;
|
||||
Fib fib(n);
|
||||
|
||||
fib.recompile();
|
||||
|
||||
p = getRdtsc();
|
||||
fib.run();
|
||||
printf("vm %.2fKclk\n", (signed)(getRdtsc() - p) * 1e-3);
|
||||
{
|
||||
Xbyak::util::Clock clk;
|
||||
clk.begin();
|
||||
fib.run();
|
||||
clk.end();
|
||||
printf("vm %.2fKclk\n", clk.getClock() * 1e-3);
|
||||
}
|
||||
|
||||
p = getRdtsc();
|
||||
fib.runByJIT();
|
||||
printf("jit %.2fKclk\n", (signed)(getRdtsc() - p) * 1e-3);
|
||||
|
||||
p = getRdtsc();
|
||||
fibC(n);
|
||||
printf("native C %.2fKclk\n", (signed)(getRdtsc() - p) * 1e-3);
|
||||
{
|
||||
Xbyak::util::Clock clk;
|
||||
clk.begin();
|
||||
fib.runByJIT();
|
||||
clk.end();
|
||||
printf("jit %.2fKclk\n", clk.getClock() * 1e-3);
|
||||
}
|
||||
|
||||
{
|
||||
Xbyak::util::Clock clk;
|
||||
clk.begin();
|
||||
fibC(n);
|
||||
clk.end();
|
||||
printf("native C %.2fKclk\n", clk.getClock() * 1e-3);
|
||||
}
|
||||
} catch (Xbyak::Error err) {
|
||||
printf("ERR:%s(%d)\n", Xbyak::ConvertErrorToString(err), err);
|
||||
} catch (...) {
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
@file xbyak.h
|
||||
@brief Xbyak ; JIT assembler for x86(IA32)/x64 by C++
|
||||
@author herumi
|
||||
@version $Revision: 1.249 $
|
||||
@version $Revision: 1.250 $
|
||||
@url http://homepage1.nifty.com/herumi/soft/xbyak.html
|
||||
@date $Date: 2011/03/24 06:32:21 $
|
||||
@date $Date: 2011/04/27 20:43:24 $
|
||||
@note modified new BSD license
|
||||
http://www.opensource.org/licenses/bsd-license.php
|
||||
*/
|
||||
|
@ -51,7 +51,7 @@ namespace Xbyak {
|
|||
|
||||
enum {
|
||||
DEFAULT_MAX_CODE_SIZE = 4096,
|
||||
VERSION = 0x3010, /* 0xABCD = A.BC(D) */
|
||||
VERSION = 0x3020, /* 0xABCD = A.BC(D) */
|
||||
};
|
||||
|
||||
#ifndef MIE_INTEGER_TYPE_DEFINED
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const char *getVersionString() const { return "3.01"; }
|
||||
const char *getVersionString() const { return "3.02"; }
|
||||
void packssdw(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x6B); }
|
||||
void packsswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x63); }
|
||||
void packuswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x67); }
|
||||
|
|
Loading…
Reference in a new issue