From 0256ab1af501f7d465a9143780f42715eb53589b Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Thu, 30 May 2013 14:59:16 +0900 Subject: [PATCH] fix disp of Vsib ; add all patterns of Vsib --- test/make_nm.cpp | 43 ++++++++++++++++++++++++++++++++++++++++--- xbyak/xbyak.h | 2 +- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/test/make_nm.cpp b/test/make_nm.cpp index 6f45565..fa804ce 100644 --- a/test/make_nm.cpp +++ b/test/make_nm.cpp @@ -2016,9 +2016,45 @@ public: exit(1); } } - // all pattern - const char *name = "vgatherdpd"; - put(name, "xmm1, ptr [xmm2], xmm3", "xmm1, [xmm2], xmm3"); + } + void putGath(const std::string& vsib) + { + std::string x = "xmm1, "; + std::string a = std::string("[") + vsib + "], xmm3"; + put("vgatherdpd", (x + "ptr" + a).c_str(), (x + a).c_str()); + } + + void putGatherAll() + { + const char *xmmTbl[] = { + "xmm2", + "xmm4", + "xmm2*1", + "xmm2*4", + }; + for (size_t i = 0; i < NUM_OF_ARRAY(xmmTbl); i++) { + std::string s = xmmTbl[i]; + putGath(s); + putGath(s + "+3"); + putGath(s + "+eax"); + putGath("3+" + s); + putGath("eax+" + s); + } + for (size_t i = 0; i < NUM_OF_ARRAY(xmmTbl); i++) { + int ord[] = { 0, 1, 2 }; + do { + std::string s; + for (int j = 0; j < 3; j++) { + if (j > 0) s += '+'; + switch (ord[j]) { + case 0: s += xmmTbl[i]; break; + case 1: s += "123"; break; + case 2: s += "ebp"; break; + } + } + putGath(s); + } while (std::next_permutation(ord, ord + 3)); + } } void put() { @@ -2030,6 +2066,7 @@ public: putGprR_RM(); putGprOtherwise(); putGather(); + putGatherAll(); #else putAVX1(); putAVX2(); diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h index da6eb00..b11ea62 100644 --- a/xbyak/xbyak.h +++ b/xbyak/xbyak.h @@ -494,7 +494,7 @@ inline Vsib operator*(const Xmm& x, int scale) } inline Vsib operator+(const Xmm& x, uint32 disp) { - return Vsib(x.getIdx(), 1, x.isYMM(), disp); + return Vsib(x.getIdx(), 1, x.isYMM(), 0, 0, disp); } inline Vsib operator+(const Xmm& x, const Reg32e& r) {