aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2016-05-05 12:14:04 +0900
committerMITSUNARI Shigeo <[email protected]>2016-05-05 12:14:04 +0900
commit72ca263c37daa7cb8e98ec175f72acdf2e7d7bc8 (patch)
tree76f2d8d1858875cea669a8b8b16fe10600c7d78d
parente51947e470b9cd50ec3b008b9c2d21397d8d23ba (diff)
downloadxbyak-72ca263c37daa7cb8e98ec175f72acdf2e7d7bc8.tar.gz
xbyak-72ca263c37daa7cb8e98ec175f72acdf2e7d7bc8.zip
add detection of avx-512
-rw-r--r--readme.md5
-rw-r--r--readme.txt5
-rw-r--r--sample/test_util.cpp9
-rw-r--r--xbyak/xbyak.h2
-rw-r--r--xbyak/xbyak_mnemonic.h2
-rw-r--r--xbyak/xbyak_util.h27
6 files changed, 44 insertions, 6 deletions
diff --git a/readme.md b/readme.md
index 4c01c3c..6cf2408 100644
--- a/readme.md
+++ b/readme.md
@@ -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)
diff --git a/readme.txt b/readme.txt
index fb569c9..dff3478 100644
--- a/readme.txt
+++ b/readme.txt
@@ -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)
diff --git a/sample/test_util.cpp b/sample/test_util.cpp
index b6f4472..7d5af42 100644
--- a/sample/test_util.cpp
+++ b/sample/test_util.cpp
@@ -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);
diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h
index 3483935..351de28 100644
--- a/xbyak/xbyak.h
+++ b/xbyak/xbyak.h
@@ -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
diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h
index fb18c5f..d1f2502 100644
--- a/xbyak/xbyak_mnemonic.h
+++ b/xbyak/xbyak_mnemonic.h
@@ -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); }
diff --git a/xbyak/xbyak_util.h b/xbyak/xbyak_util.h
index 3a7c2c2..67fba08 100644
--- a/xbyak/xbyak_util.h
+++ b/xbyak/xbyak_util.h
@@ -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) {