diff options
author | MITSUNARI Shigeo <[email protected]> | 2023-11-10 12:13:06 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2023-11-10 12:13:06 +0900 |
commit | a18e5aeb5bc3a3cc27dbf3d6aea37472ade72e20 (patch) | |
tree | c661fc72066c79b2c4ef1e816ef2b0856c793ece | |
parent | 5bb8461b43f1f1df682a40f8b1008d4a58428e49 (diff) | |
download | xbyak-a18e5aeb5bc3a3cc27dbf3d6aea37472ade72e20.tar.gz xbyak-a18e5aeb5bc3a3cc27dbf3d6aea37472ade72e20.zip |
rorx supports apx
-rw-r--r-- | gen/avx_type.hpp | 1 | ||||
-rw-r--r-- | gen/avx_type_def.h | 1 | ||||
-rw-r--r-- | gen/gen_code.cpp | 2 | ||||
-rw-r--r-- | test/apx.cpp | 7 | ||||
-rw-r--r-- | xbyak/xbyak.h | 2 | ||||
-rw-r--r-- | xbyak/xbyak_mnemonic.h | 2 |
6 files changed, 13 insertions, 2 deletions
diff --git a/gen/avx_type.hpp b/gen/avx_type.hpp index 6453b81..f66dec1 100644 --- a/gen/avx_type.hpp +++ b/gen/avx_type.hpp @@ -67,6 +67,7 @@ std::string type2String(uint64_t type) if (type & T_MEM_EVEX) str += "|T_MEM_EVEX"; if (type & T_NF) str += "|T_NF"; if (type & T_CODE1_IF1) str += "|T_CODE1_IF1"; + if (type & T_MAP3) str += "T_MAP3"; if (str[0] == '|') str = str.substr(1); return str; diff --git a/gen/avx_type_def.h b/gen/avx_type_def.h index 80c6623..208b077 100644 --- a/gen/avx_type_def.h +++ b/gen/avx_type_def.h @@ -44,6 +44,7 @@ static const uint64_t T_MAP6 = T_FP16 | T_0F38; static const uint64_t T_NF = 1ull << 32; // T_nf static const uint64_t T_CODE1_IF1 = 1ull << 33; // code|=1 if !r.isBit(8) + static const uint64_t T_MAP3 = 1ull << 34; // rorx only // T_66 = 1, T_F3 = 2, T_F2 = 3 static inline uint32_t getPP(uint64_t type) { return (type >> 5) & 3; } // @@@end of avx_type_def.h diff --git a/gen/gen_code.cpp b/gen/gen_code.cpp index eb6895f..c845119 100644 --- a/gen/gen_code.cpp +++ b/gen/gen_code.cpp @@ -1759,7 +1759,7 @@ void put() const Tbl& p = tbl[i]; printf("void %s(const Reg32e& r1, const Operand& op, const Reg32e& r2) { opRRO(r1, r2, op, %s, 0x%x); }\n", p.name, type2String(p.type).c_str(), p.code); } - puts("void rorx(const Reg32e& r, const Operand& op, uint8_t imm) { opRRO(r, Reg32e(0, r.getBit()), op, T_0F3A | T_F2, 0xF0, imm); }"); + puts("void rorx(const Reg32e& r, const Operand& op, uint8_t imm) { opRRO(r, Reg32e(0, r.getBit()), op, T_0F3A|T_F2|T_VEX|T_MAP3, 0xF0, imm); }"); } // gpr(reg, r/m) { diff --git a/test/apx.cpp b/test/apx.cpp index 65f6540..b9e6e9f 100644 --- a/test/apx.cpp +++ b/test/apx.cpp @@ -557,6 +557,9 @@ CYBOZU_TEST_AUTO(bextr_etc) blsr(ecx, r17d); blsr(r30, ptr [r31+r20*4]); + rorx(r30, r31, 3); + rorx(ecx, r17d, 5); + rorx(r30, ptr [r31+r20*4], 4); } } c; const uint8_t tbl[] = { @@ -605,6 +608,10 @@ CYBOZU_TEST_AUTO(bextr_etc) 0x62, 0xfa, 0x74, 0x08, 0xf3, 0xc9, 0x62, 0xda, 0x88, 0x00, 0xf3, 0x0c, 0xa7, + // rorx + 0x62, 0x4b, 0xff, 0x08, 0xf0, 0xf7, 0x03, + 0x62, 0xfb, 0x7f, 0x08, 0xf0, 0xc9, 0x05, + 0x62, 0x4b, 0xfb, 0x08, 0xf0, 0x34, 0xa7, 0x04, }; const size_t n = sizeof(tbl); CYBOZU_TEST_EQUAL(c.getSize(), n); diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h index 8bc45d2..e7136b4 100644 --- a/xbyak/xbyak.h +++ b/xbyak/xbyak.h @@ -1802,6 +1802,7 @@ private: static const uint64_t T_MAP6 = T_FP16 | T_0F38; static const uint64_t T_NF = 1ull << 32; // T_nf static const uint64_t T_CODE1_IF1 = 1ull << 33; // code|=1 if !r.isBit(8) + static const uint64_t T_MAP3 = 1ull << 34; // rorx only // T_66 = 1, T_F3 = 2, T_F2 = 3 static inline uint32_t getPP(uint64_t type) { return (type >> 5) & 3; } // @@@end of avx_type_def.h @@ -1897,6 +1898,7 @@ private: } static inline int getMap(uint64_t type) { + if (type & T_MAP3) return 3; if (type & (T_0F38|T_0F3A)) return 2; return 4; // legacy } diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h index 74c241e..4576fe5 100644 --- a/xbyak/xbyak_mnemonic.h +++ b/xbyak/xbyak_mnemonic.h @@ -745,7 +745,7 @@ void rol(const Operand& op, const Reg8& _cl) { opShift(op, _cl, 0); } void rol(const Operand& op, int imm) { opShift(op, imm, 0); } void ror(const Operand& op, const Reg8& _cl) { opShift(op, _cl, 1); } void ror(const Operand& op, int imm) { opShift(op, imm, 1); } -void rorx(const Reg32e& r, const Operand& op, uint8_t imm) { opRRO(r, Reg32e(0, r.getBit()), op, T_0F3A | T_F2, 0xF0, imm); } +void rorx(const Reg32e& r, const Operand& op, uint8_t imm) { opRRO(r, Reg32e(0, r.getBit()), op, T_0F3A|T_F2|T_VEX|T_MAP3, 0xF0, imm); } void roundpd(const Xmm& xmm, const Operand& op, uint8_t imm) { opSSE(xmm, op, T_66|T_0F3A|T_YMM, 0x09, isXMM_XMMorMEM, imm); } void roundps(const Xmm& xmm, const Operand& op, uint8_t imm) { opSSE(xmm, op, T_66|T_0F3A|T_YMM, 0x08, isXMM_XMMorMEM, imm); } void roundsd(const Xmm& xmm, const Operand& op, int imm) { opSSE(xmm, op, T_66 | T_0F3A, 0x0B, isXMM_XMMorMEM, static_cast<uint8_t>(imm)); } |