From f73a88b01d12b9fb68bcfa7d45613748bd707258 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Thu, 9 Feb 2012 16:06:41 +0900 Subject: [PATCH] add pclmullqlqdq --- gen/gen_code.cpp | 15 +++++++++++++++ readme.md | 6 +++--- test/make_nm.cpp | 12 ++++++++++++ xbyak/xbyak.h | 12 ++++++------ xbyak/xbyak_mnemonic.h | 6 +++++- 5 files changed, 41 insertions(+), 10 deletions(-) diff --git a/gen/gen_code.cpp b/gen/gen_code.cpp index 669f59c..cb62be3 100644 --- a/gen/gen_code.cpp +++ b/gen/gen_code.cpp @@ -767,6 +767,21 @@ void put() printf("void %s(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0x%02X, 0x66, isXMM_XMMorMEM, static_cast(imm), 0x3A); }\n", p->name, p->code); } } + { + const struct Tbl { + const char *name; + uint8 code; + } tbl[] = { + { "pclmullqlqdq", 0 }, + { "pclmulhqlqdq", 1 }, + { "pclmullqhdq", 0x10 }, + { "pclmulhqhdq", 0x11 }, + }; + for (int i = 0; i < NUM_OF_ARRAY(tbl); i++) { + const Tbl *p = &tbl[i]; + printf("void %s(const Xmm& xmm, const Operand& op) { pclmulqdq(xmm, op, 0x%02X); }\n", p->name, p->code); + } + } { const struct Tbl { uint8 code; diff --git a/readme.md b/readme.md index 791c444..3b1d2c3 100644 --- a/readme.md +++ b/readme.md @@ -197,7 +197,7 @@ License ------------- modified new BSD License -http://www.opensource.org/licenses/bsd-license.php +http://opensource.org/licenses/BSD-3-Clause History ------------- @@ -252,5 +252,5 @@ Author MITSUNARI Shigeo(herumi at nifty dot com) --- -$Revision: 1.15 $ -$Date: 2011/11/09 02:50:21 $ +$Revision: 1.16 $ +$Date: 2011/12/22 01:43:13 $ diff --git a/test/make_nm.cpp b/test/make_nm.cpp index cfb402d..23d2b26 100644 --- a/test/make_nm.cpp +++ b/test/make_nm.cpp @@ -1096,6 +1096,18 @@ class Test { const char *p = tbl[i]; put(p, XMM, XMM|MEM, IMM); } + { + const char tbl[][16] = { + "pclmullqlqdq", + "pclmulhqlqdq", +// "pclmullqhdq", // QQQ : not supported by nasm/yasm +// "pclmulhqhdq", + }; + for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) { + const char *p = tbl[i]; + put(p, XMM, XMM|MEM); + } + } put("extractps", REG32e|MEM, XMM, IMM); put("pextrw", REG32e|MEM, XMM, IMM); // pextrw for REG32 is for MMX2 put("pextrb", REG32e|MEM, XMM, IMM); diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h index 49c0d40..e7d795d 100644 --- a/xbyak/xbyak.h +++ b/xbyak/xbyak.h @@ -5,14 +5,14 @@ @file xbyak.h @brief Xbyak ; JIT assembler for x86(IA32)/x64 by C++ @author herumi - @version $Revision: 1.256 $ + @version $Revision: 1.260 $ @url http://homepage1.nifty.com/herumi/soft/xbyak.html - @date $Date: 2011/11/09 05:06:37 $ + @date $Date: 2012/01/05 00:34:07 $ @note modified new BSD license - http://www.opensource.org/licenses/bsd-license.php + http://opensource.org/licenses/BSD-3-Clause */ #if not +0 - #error "use -fno-operator-names" + #error "use -fno-operator-names to use 'not', 'xor, 'and' as function names" #endif #include // for debug print @@ -54,7 +54,7 @@ namespace Xbyak { enum { DEFAULT_MAX_CODE_SIZE = 4096, - VERSION = 0x3050, /* 0xABCD = A.BC(D) */ + VERSION = 0x3060, /* 0xABCD = A.BC(D) */ }; #ifndef MIE_INTEGER_TYPE_DEFINED @@ -1498,7 +1498,7 @@ public: #include "xbyak_mnemonic.h" void align(int x = 16) { - if (x != 4 && x != 8 && x != 16 && x != 32) throw ERR_BAD_ALIGN; + if (x < 2 || (x & (x - 1))) throw ERR_BAD_ALIGN; while (size_t(getCurr()) % x) { nop(); } diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h index 971948a..22b2e86 100644 --- a/xbyak/xbyak_mnemonic.h +++ b/xbyak/xbyak_mnemonic.h @@ -1,4 +1,4 @@ -const char *getVersionString() const { return "3.05"; } +const char *getVersionString() const { return "3.06"; } 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); } @@ -478,6 +478,10 @@ void pcmpistrm(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0x62 void pcmpistri(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0x63, 0x66, isXMM_XMMorMEM, static_cast(imm), 0x3A); } void pclmulqdq(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0x44, 0x66, isXMM_XMMorMEM, static_cast(imm), 0x3A); } void aeskeygenassist(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0xDF, 0x66, isXMM_XMMorMEM, static_cast(imm), 0x3A); } +void pclmullqlqdq(const Xmm& xmm, const Operand& op) { pclmulqdq(xmm, op, 0x00); } +void pclmulhqlqdq(const Xmm& xmm, const Operand& op) { pclmulqdq(xmm, op, 0x01); } +void pclmullqhdq(const Xmm& xmm, const Operand& op) { pclmulqdq(xmm, op, 0x10); } +void pclmulhqhdq(const Xmm& xmm, const Operand& op) { pclmulqdq(xmm, op, 0x11); } void ldmxcsr(const Address& addr) { opModM(addr, Reg32(2), 0x0F, 0xAE); } void stmxcsr(const Address& addr) { opModM(addr, Reg32(3), 0x0F, 0xAE); } void clflush(const Address& addr) { opModM(addr, Reg32(7), 0x0F, 0xAE); }