add detection of avx-512

This commit is contained in:
MITSUNARI Shigeo 2016-05-05 12:14:04 +09:00
parent e51947e470
commit 72ca263c37
6 changed files with 44 additions and 6 deletions

View file

@ -1,5 +1,5 @@
Xbyak 4.901 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
Xbyak 4.91 ; JIT assembler for x86(IA32), x64(AMD64, x86-64) by C++
=============
Abstract
@ -285,7 +285,8 @@ The header files under xbyak/ are independent of cybozulib.
History
-------------
* 2016/May/14 ver 4.901 comment to ready() function(thanks to skmp)
* 2016/May/05 ver 4.91 add detection of AVX-512 to Xbyak::util::Cpu
* 2016/Mar/14 ver 4.901 comment to ready() function(thanks to skmp)
* 2016/Feb/04 ver 4.90 add jcc(const void *addr);
* 2016/Jan/30 ver 4.89 vpblendvb supports ymm reg(thanks to John Funnell)
* 2016/Jan/24 ver 4.88 lea, cmov supports 16-bit register(thanks to whyisthisfieldhere)

View file

@ -1,5 +1,5 @@
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.901
C++用x86(IA-32), x64(AMD64, x86-64) JITアセンブラ Xbyak 4.91
-----------------------------------------------------------------------------
◎概要
@ -301,7 +301,8 @@ cybozulibは単体テストでのみ利用されていて、xbyak/ディレク
-----------------------------------------------------------------------------
◎履歴
2016/03/14 ver 4.90 ready()関数にコメント加筆(thanks to skmp)
2016/05/05 ver 4.91 AVX-512命令の検出サポート
2016/03/14 ver 4.901 ready()関数にコメント加筆(thanks to skmp)
2016/02/04 ver 4.90 条件分岐命令にjcc(const void *addr);のタイプを追加
2016/01/30 ver 4.89 vpblendvbがymmレジスタをサポートしていなかった(thanks to John Funnell)
2016/01/24 ver 4.88 lea, cmovの16bitレジスタ対応(thanks to whyisthisfieldhere)

View file

@ -55,6 +55,15 @@ void putCPUinfo()
{ Cpu::tRTM, "rtm" },
{ Cpu::tF16C, "f16c" },
{ Cpu::tMOVBE, "movbe" },
{ Cpu::tAVX512F, "avx512f" },
{ Cpu::tAVX512DQ, "avx512dq" },
{ Cpu::tAVX512IFMA, "avx512ifma" },
{ Cpu::tAVX512PF, "avx512pf" },
{ Cpu::tAVX512ER, "avx512er" },
{ Cpu::tAVX512CD, "avx512cd" },
{ Cpu::tAVX512BW, "avx512bw" },
{ Cpu::tAVX512VL, "avx512vl" },
{ Cpu::tAVX512VBMI, "avx512vbmi" },
};
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
if (cpu.has(tbl[i].type)) printf(" %s", tbl[i].str);

View file

@ -101,7 +101,7 @@ namespace Xbyak {
enum {
DEFAULT_MAX_CODE_SIZE = 4096,
VERSION = 0x4901 /* 0xABCD = A.BC(D) */
VERSION = 0x4910 /* 0xABCD = A.BC(D) */
};
#ifndef MIE_INTEGER_TYPE_DEFINED

View file

@ -1,4 +1,4 @@
const char *getVersionString() const { return "4.901"; }
const char *getVersionString() const { return "4.91"; }
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); }

View file

@ -96,6 +96,9 @@ public:
int extFamily;
int displayFamily; // family + extFamily
int displayModel; // model + extModel
/*
data[] = { eax, ebx, ecx, edx }
*/
static inline void getCpuid(unsigned int eaxIn, unsigned int data[4])
{
#ifdef _MSC_VER
@ -164,6 +167,15 @@ public:
static const Type tRTM = uint64(1) << 32; // xbegin, xend, xabort
static const Type tF16C = uint64(1) << 33; // vcvtph2ps, vcvtps2ph
static const Type tMOVBE = uint64(1) << 34; // mobve
static const Type tAVX512F = uint64(1) << 35;
static const Type tAVX512DQ = uint64(1) << 36;
static const Type tAVX512IFMA = uint64(1) << 37;
static const Type tAVX512PF = uint64(1) << 38;
static const Type tAVX512ER = uint64(1) << 39;
static const Type tAVX512CD = uint64(1) << 40;
static const Type tAVX512BW = uint64(1) << 41;
static const Type tAVX512VL = uint64(1) << 42;
static const Type tAVX512VBMI = uint64(1) << 43;
Cpu()
: type_(NONE)
@ -212,6 +224,21 @@ public:
if ((bv & 6) == 6) {
if (data[2] & (1U << 28)) type_ |= tAVX;
if (data[2] & (1U << 12)) type_ |= tFMA;
if (((bv >> 5) & 7) == 7) {
getCpuid(7, data);
if (data[1] & (1U << 16)) type_ |= tAVX512F;
if (type_ & tAVX512F) {
getCpuidEx(7, 0, data);
if (data[1] & (1U << 17)) type_ |= tAVX512DQ;
if (data[1] & (1U << 21)) type_ |= tAVX512IFMA;
if (data[1] & (1U << 26)) type_ |= tAVX512PF;
if (data[1] & (1U << 27)) type_ |= tAVX512ER;
if (data[1] & (1U << 28)) type_ |= tAVX512CD;
if (data[1] & (1U << 30)) type_ |= tAVX512BW;
if (data[1] & (1U << 31)) type_ |= tAVX512VL;
if (data[2] & (1U << 1)) type_ |= tAVX512VBMI;
}
}
}
}
if (maxNum >= 7) {