add pclmullqlqdq

This commit is contained in:
MITSUNARI Shigeo 2012-02-09 16:06:41 +09:00
parent 08bb1a0433
commit f73a88b01d
5 changed files with 41 additions and 10 deletions

View file

@ -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<uint8>(imm), 0x3A); }\n", p->name, p->code); printf("void %s(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0x%02X, 0x66, isXMM_XMMorMEM, static_cast<uint8>(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 { const struct Tbl {
uint8 code; uint8 code;

View file

@ -197,7 +197,7 @@ License
------------- -------------
modified new BSD License modified new BSD License
http://www.opensource.org/licenses/bsd-license.php http://opensource.org/licenses/BSD-3-Clause
History History
------------- -------------
@ -252,5 +252,5 @@ Author
MITSUNARI Shigeo(herumi at nifty dot com) MITSUNARI Shigeo(herumi at nifty dot com)
--- ---
$Revision: 1.15 $ $Revision: 1.16 $
$Date: 2011/11/09 02:50:21 $ $Date: 2011/12/22 01:43:13 $

View file

@ -1096,6 +1096,18 @@ class Test {
const char *p = tbl[i]; const char *p = tbl[i];
put(p, XMM, XMM|MEM, IMM); 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("extractps", REG32e|MEM, XMM, IMM);
put("pextrw", REG32e|MEM, XMM, IMM); // pextrw for REG32 is for MMX2 put("pextrw", REG32e|MEM, XMM, IMM); // pextrw for REG32 is for MMX2
put("pextrb", REG32e|MEM, XMM, IMM); put("pextrb", REG32e|MEM, XMM, IMM);

View file

@ -5,14 +5,14 @@
@file xbyak.h @file xbyak.h
@brief Xbyak ; JIT assembler for x86(IA32)/x64 by C++ @brief Xbyak ; JIT assembler for x86(IA32)/x64 by C++
@author herumi @author herumi
@version $Revision: 1.256 $ @version $Revision: 1.260 $
@url http://homepage1.nifty.com/herumi/soft/xbyak.html @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 @note modified new BSD license
http://www.opensource.org/licenses/bsd-license.php http://opensource.org/licenses/BSD-3-Clause
*/ */
#if not +0 #if not +0
#error "use -fno-operator-names" #error "use -fno-operator-names to use 'not', 'xor, 'and' as function names"
#endif #endif
#include <stdio.h> // for debug print #include <stdio.h> // for debug print
@ -54,7 +54,7 @@ namespace Xbyak {
enum { enum {
DEFAULT_MAX_CODE_SIZE = 4096, DEFAULT_MAX_CODE_SIZE = 4096,
VERSION = 0x3050, /* 0xABCD = A.BC(D) */ VERSION = 0x3060, /* 0xABCD = A.BC(D) */
}; };
#ifndef MIE_INTEGER_TYPE_DEFINED #ifndef MIE_INTEGER_TYPE_DEFINED
@ -1498,7 +1498,7 @@ public:
#include "xbyak_mnemonic.h" #include "xbyak_mnemonic.h"
void align(int x = 16) 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) { while (size_t(getCurr()) % x) {
nop(); nop();
} }

View file

@ -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 packssdw(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x6B); }
void packsswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x63); } void packsswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x63); }
void packuswb(const Mmx& mmx, const Operand& op) { opMMX(mmx, op, 0x67); } 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<uint8>(imm), 0x3A); } void pcmpistri(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0x63, 0x66, isXMM_XMMorMEM, static_cast<uint8>(imm), 0x3A); }
void pclmulqdq(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0x44, 0x66, isXMM_XMMorMEM, static_cast<uint8>(imm), 0x3A); } void pclmulqdq(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0x44, 0x66, isXMM_XMMorMEM, static_cast<uint8>(imm), 0x3A); }
void aeskeygenassist(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0xDF, 0x66, isXMM_XMMorMEM, static_cast<uint8>(imm), 0x3A); } void aeskeygenassist(const Xmm& xmm, const Operand& op, int imm) { opGen(xmm, op, 0xDF, 0x66, isXMM_XMMorMEM, static_cast<uint8>(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 ldmxcsr(const Address& addr) { opModM(addr, Reg32(2), 0x0F, 0xAE); }
void stmxcsr(const Address& addr) { opModM(addr, Reg32(3), 0x0F, 0xAE); } void stmxcsr(const Address& addr) { opModM(addr, Reg32(3), 0x0F, 0xAE); }
void clflush(const Address& addr) { opModM(addr, Reg32(7), 0x0F, 0xAE); } void clflush(const Address& addr) { opModM(addr, Reg32(7), 0x0F, 0xAE); }