Wire Sysio
Wire Sysion 1.0.0
Loading...
Searching...
No Matches
gen_avx512.cpp
Go to the documentation of this file.
1
#define XBYAK_DONT_READ_LIST
2
#include <stdio.h>
3
#include <string.h>
4
#include "
../xbyak/xbyak.h
"
5
#define NUM_OF_ARRAY(x) (sizeof(x) / sizeof(x[0]))
6
7
using namespace
Xbyak
;
8
#ifdef _MSC_VER
9
#pragma warning(disable : 4996)
// scanf
10
#define snprintf _snprintf_s
11
#endif
12
13
#include "
avx_type.hpp
"
14
15
void
putOpmask
(
bool
only64bit)
16
{
17
if
(only64bit) {
18
puts(
"void kmovq(const Opmask& k, const Reg64& r) { opVex(k, 0, r, T_L0 | T_0F | T_F2 | T_W1, 0x92); }"
);
19
puts(
"void kmovq(const Reg64& r, const Opmask& k) { opVex(r, 0, k, T_L0 | T_0F | T_F2 | T_W1, 0x93); }"
);
20
return
;
21
}
22
23
{
24
const
struct
Tbl {
25
const
char
*
name
;
26
uint8
code;
27
}
tbl
[] = {
28
{
"kadd"
, 0x4A },
29
{
"kand"
, 0x41 },
30
{
"kandn"
, 0x42 },
31
{
"kor"
, 0x45 },
32
{
"kxnor"
, 0x46 },
33
{
"kxor"
, 0x47 },
34
};
35
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
36
const
Tbl&
p
=
tbl
[i];
37
printf(
"void %sw(const Opmask& r1, const Opmask& r2, const Opmask& r3) { opVex(r1, &r2, r3, T_L1 | T_0F | T_W0, 0x%02X); }\n"
,
p
.name,
p
.code);
38
printf(
"void %sq(const Opmask& r1, const Opmask& r2, const Opmask& r3) { opVex(r1, &r2, r3, T_L1 | T_0F | T_W1, 0x%02X); }\n"
,
p
.name,
p
.code);
39
printf(
"void %sb(const Opmask& r1, const Opmask& r2, const Opmask& r3) { opVex(r1, &r2, r3, T_L1 | T_0F | T_66 | T_W0, 0x%02X); }\n"
,
p
.name,
p
.code);
40
printf(
"void %sd(const Opmask& r1, const Opmask& r2, const Opmask& r3) { opVex(r1, &r2, r3, T_L1 | T_0F | T_66 | T_W1, 0x%02X); }\n"
,
p
.name,
p
.code);
41
}
42
printf(
"void kunpckbw(const Opmask& r1, const Opmask& r2, const Opmask& r3) { opVex(r1, &r2, r3, T_L1 | T_0F | T_66 | T_W0, 0x4B); }\n"
);
43
printf(
"void kunpckwd(const Opmask& r1, const Opmask& r2, const Opmask& r3) { opVex(r1, &r2, r3, T_L1 | T_0F | T_W0, 0x4B); }\n"
);
44
printf(
"void kunpckdq(const Opmask& r1, const Opmask& r2, const Opmask& r3) { opVex(r1, &r2, r3, T_L1 | T_0F | T_W1, 0x4B); }\n"
);
45
}
46
{
47
const
struct
Tbl {
48
const
char
*
name
;
49
uint8
code;
50
}
tbl
[] = {
51
{
"knot"
, 0x44 },
52
{
"kortest"
, 0x98 },
53
{
"ktest"
, 0x99 },
54
};
55
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
56
const
Tbl&
p
=
tbl
[i];
57
printf(
"void %sw(const Opmask& r1, const Opmask& r2) { opVex(r1, 0, r2, T_0F | T_W0, 0x%02X); }\n"
,
p
.name,
p
.code);
58
printf(
"void %sq(const Opmask& r1, const Opmask& r2) { opVex(r1, 0, r2, T_0F | T_W1, 0x%02X); }\n"
,
p
.name,
p
.code);
59
printf(
"void %sb(const Opmask& r1, const Opmask& r2) { opVex(r1, 0, r2, T_0F | T_66 | T_W0, 0x%02X); }\n"
,
p
.name,
p
.code);
60
printf(
"void %sd(const Opmask& r1, const Opmask& r2) { opVex(r1, 0, r2, T_0F | T_66 | T_W1, 0x%02X); }\n"
,
p
.name,
p
.code);
61
}
62
}
63
{
64
const
struct
Tbl {
65
const
char
*
name
;
66
uint8
code;
67
}
tbl
[] = {
68
{
"kshiftl"
, 0x32 },
69
{
"kshiftr"
, 0x30 },
70
};
71
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
72
const
Tbl&
p
=
tbl
[i];
73
printf(
"void %sw(const Opmask& r1, const Opmask& r2, uint8 imm) { opVex(r1, 0, r2, T_66 | T_0F3A | T_W1, 0x%02X, imm); }\n"
,
p
.name,
p
.code);
74
printf(
"void %sq(const Opmask& r1, const Opmask& r2, uint8 imm) { opVex(r1, 0, r2, T_66 | T_0F3A | T_W1, 0x%02X, imm); }\n"
,
p
.name,
p
.code + 1);
75
printf(
"void %sb(const Opmask& r1, const Opmask& r2, uint8 imm) { opVex(r1, 0, r2, T_66 | T_0F3A | T_W0, 0x%02X, imm); }\n"
,
p
.name,
p
.code);
76
printf(
"void %sd(const Opmask& r1, const Opmask& r2, uint8 imm) { opVex(r1, 0, r2, T_66 | T_0F3A | T_W0, 0x%02X, imm); }\n"
,
p
.name,
p
.code + 1);
77
}
78
}
79
puts(
"void kmovw(const Opmask& k, const Operand& op) { opVex(k, 0, op, T_L0 | T_0F | T_W0, 0x90); }"
);
80
puts(
"void kmovq(const Opmask& k, const Operand& op) { opVex(k, 0, op, T_L0 | T_0F | T_W1, 0x90); }"
);
81
puts(
"void kmovb(const Opmask& k, const Operand& op) { opVex(k, 0, op, T_L0 | T_0F | T_66 | T_W0, 0x90); }"
);
82
puts(
"void kmovd(const Opmask& k, const Operand& op) { opVex(k, 0, op, T_L0 | T_0F | T_66 | T_W1, 0x90); }"
);
83
84
puts(
"void kmovw(const Address& addr, const Opmask& k) { opVex(k, 0, addr, T_L0 | T_0F | T_W0, 0x91); }"
);
85
puts(
"void kmovq(const Address& addr, const Opmask& k) { opVex(k, 0, addr, T_L0 | T_0F | T_W1, 0x91); }"
);
86
puts(
"void kmovb(const Address& addr, const Opmask& k) { opVex(k, 0, addr, T_L0 | T_0F | T_66 | T_W0, 0x91); }"
);
87
puts(
"void kmovd(const Address& addr, const Opmask& k) { opVex(k, 0, addr, T_L0 | T_0F | T_66 | T_W1, 0x91); }"
);
88
89
puts(
"void kmovw(const Opmask& k, const Reg32& r) { opVex(k, 0, r, T_L0 | T_0F | T_W0, 0x92); }"
);
90
puts(
"void kmovw(const Reg32& r, const Opmask& k) { opVex(r, 0, k, T_L0 | T_0F | T_W0, 0x93); }"
);
91
puts(
"void kmovb(const Opmask& k, const Reg32& r) { opVex(k, 0, r, T_L0 | T_0F | T_66 | T_W0, 0x92); }"
);
92
puts(
"void kmovb(const Reg32& r, const Opmask& k) { opVex(r, 0, k, T_L0 | T_0F | T_66 | T_W0, 0x93); }"
);
93
puts(
"void kmovd(const Opmask& k, const Reg32& r) { opVex(k, 0, r, T_L0 | T_0F | T_F2 | T_W0, 0x92); }"
);
94
puts(
"void kmovd(const Reg32& r, const Opmask& k) { opVex(r, 0, k, T_L0 | T_0F | T_F2 | T_W0, 0x93); }"
);
95
}
96
97
// vcmppd(k, x, op)
98
void
putVcmp
()
99
{
100
const
struct
Tbl {
101
uint8
code;
102
const
char
*
name
;
103
int
type
;
104
bool
hasIMM;
105
}
tbl
[] = {
106
{ 0xC2,
"vcmppd"
,
T_0F
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
|
T_YMM
|
T_66
,
true
},
107
{ 0xC2,
"vcmpps"
,
T_0F
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_YMM
,
true
},
108
{ 0xC2,
"vcmpsd"
,
T_0F
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
|
T_F2
|
T_N8
,
true
},
109
{ 0xC2,
"vcmpss"
,
T_0F
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_F3
|
T_N4
,
true
},
110
111
{ 0x74,
"vpcmpeqb"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
,
false
},
112
{ 0x75,
"vpcmpeqw"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
,
false
},
113
{ 0x76,
"vpcmpeqd"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_B32
,
false
},
114
{ 0x29,
"vpcmpeqq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
115
116
{ 0x64,
"vpcmpgtb"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
,
false
},
117
{ 0x65,
"vpcmpgtw"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
,
false
},
118
{ 0x66,
"vpcmpgtd"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
,
false
},
119
{ 0x37,
"vpcmpgtq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
120
121
{ 0x3F,
"vpcmpb"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
,
true
},
122
{ 0x3E,
"vpcmpub"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
,
true
},
123
124
{ 0x3F,
"vpcmpw"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
,
true
},
125
{ 0x3E,
"vpcmpuw"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
,
true
},
126
{ 0x1F,
"vpcmpd"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
,
true
},
127
{ 0x1E,
"vpcmpud"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
,
true
},
128
{ 0x1F,
"vpcmpq"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
true
},
129
{ 0x1E,
"vpcmpuq"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
true
},
130
131
{ 0x26,
"vptestmb"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
,
false
},
132
{ 0x26,
"vptestmw"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
,
false
},
133
{ 0x27,
"vptestmd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
,
false
},
134
{ 0x27,
"vptestmq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
135
136
{ 0x26,
"vptestnmb"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
,
false
},
137
{ 0x26,
"vptestnmw"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
,
false
},
138
{ 0x27,
"vptestnmd"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
,
false
},
139
{ 0x27,
"vptestnmq"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
140
};
141
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
142
const
Tbl *
p
= &
tbl
[i];
143
std::string type =
type2String
(
p
->type);
144
printf(
"void %s(const Opmask& k, const Xmm& x, const Operand& op%s) { opAVX_K_X_XM(k, x, op, %s, 0x%02X%s); }\n"
145
,
p
->name,
p
->hasIMM ?
", uint8 imm"
:
""
, type.c_str(),
p
->code,
p
->hasIMM ?
", imm"
:
""
);
146
}
147
}
148
149
// XM_X
150
void
putX_XM
()
151
{
152
const
struct
Tbl {
153
uint8
code;
154
const
char
*
name
;
155
int
type
;
156
}
tbl
[] = {
157
{ 0x6F,
"vmovdqa32"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
},
158
{ 0x6F,
"vmovdqa64"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
},
159
{ 0x6F,
"vmovdqu8"
,
T_F2
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
},
160
{ 0x6F,
"vmovdqu16"
,
T_F2
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
},
161
{ 0x6F,
"vmovdqu32"
,
T_F3
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
},
162
{ 0x6F,
"vmovdqu64"
,
T_F3
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
},
163
{ 0x7B,
"vcvtpd2qq"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
|
T_ER_Z
},
164
// putCvt
165
{ 0x79,
"vcvtpd2uqq"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
|
T_ER_Z
},
166
{ 0x79,
"vcvtps2udq"
,
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
|
T_ER_Z
},
167
{ 0xE6,
"vcvtqq2pd"
,
T_F3
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
|
T_ER_Z
},
168
{ 0x7A,
"vcvttpd2qq"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
|
T_SAE_Z
},
169
{ 0x78,
"vcvttpd2uqq"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
|
T_SAE_Z
},
170
{ 0x78,
"vcvttps2udq"
,
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
|
T_SAE_Z
},
171
{ 0x7A,
"vcvtudq2ps"
,
T_F2
|
T_0F
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
|
T_ER_Z
},
172
{ 0x7A,
"vcvtuqq2pd"
,
T_F3
|
T_0F
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
|
T_ER_Z
},
173
174
{ 0x88,
"vexpandpd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_N8
},
175
{ 0x88,
"vexpandps"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N4
},
176
177
{ 0x89,
"vpexpandd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N4
},
178
{ 0x89,
"vpexpandq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_N8
},
179
{ 0x42,
"vgetexppd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
|
T_SAE_Z
},
180
{ 0x42,
"vgetexpps"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
|
T_SAE_Z
},
181
};
182
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
183
const
Tbl *
p
= &
tbl
[i];
184
std::string type =
type2String
(
p
->type);
185
printf(
"void %s(const Xmm& x, const Operand& op) { opAVX_X_XM_IMM(x, op, %s, 0x%02X); }\n"
,
p
->name, type.c_str(),
p
->code);
186
}
187
puts(
"void vpabsq(const Xmm& x, const Operand& op) { opAVX_X_XM_IMM(x, op, T_66 | T_0F38 | T_MUST_EVEX | T_EW1 | T_B64 | T_YMM, 0x1F); }"
);
188
189
puts(
"void vexp2pd(const Zmm& z, const Operand& op) { opAVX_X_XM_IMM(z, op, T_66 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW1 | T_B64 | T_SAE_Z, 0xC8); }"
);
190
puts(
"void vexp2ps(const Zmm& z, const Operand& op) { opAVX_X_XM_IMM(z, op, T_66 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW0 | T_B32 | T_SAE_Z, 0xC8); }"
);
191
puts(
"void vrcp28pd(const Zmm& z, const Operand& op) { opAVX_X_XM_IMM(z, op, T_66 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW1 | T_B64 | T_SAE_Z, 0xCA); }"
);
192
puts(
"void vrcp28ps(const Zmm& z, const Operand& op) { opAVX_X_XM_IMM(z, op, T_66 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW0 | T_B32 | T_SAE_Z, 0xCA); }"
);
193
194
puts(
"void vrsqrt28pd(const Zmm& z, const Operand& op) { opAVX_X_XM_IMM(z, op, T_66 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW1 | T_B64 | T_SAE_Z, 0xCC); }"
);
195
puts(
"void vrsqrt28ps(const Zmm& z, const Operand& op) { opAVX_X_XM_IMM(z, op, T_66 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW0 | T_B32 | T_SAE_Z, 0xCC); }"
);
196
}
197
198
void
putM_X
()
199
{
200
const
struct
Tbl {
201
uint8
code;
202
const
char
*
name
;
203
int
type
;
204
}
tbl
[] = {
205
{ 0x7F,
"vmovdqa32"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
|
T_M_K
},
206
{ 0x7F,
"vmovdqa64"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
|
T_M_K
},
207
{ 0x7F,
"vmovdqu8"
,
T_F2
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
|
T_M_K
},
208
{ 0x7F,
"vmovdqu16"
,
T_F2
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
|
T_M_K
},
209
{ 0x7F,
"vmovdqu32"
,
T_F3
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
|
T_M_K
},
210
{ 0x7F,
"vmovdqu64"
,
T_F3
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_ER_X
|
T_ER_Y
|
T_ER_Z
|
T_M_K
},
211
};
212
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
213
const
Tbl *
p
= &
tbl
[i];
214
std::string type =
type2String
(
p
->type);
215
printf(
"void %s(const Address& addr, const Xmm& x) { opAVX_X_XM_IMM(x, addr, %s, 0x%02X); }\n"
,
p
->name, type.c_str(),
p
->code);
216
}
217
}
218
219
void
putXM_X
()
220
{
221
const
struct
Tbl {
222
uint8
code;
223
const
char
*
name
;
224
int
type
;
225
}
tbl
[] = {
226
{ 0x8A,
"vcompresspd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_N8
},
227
{ 0x8A,
"vcompressps"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N4
},
228
229
{ 0x8B,
"vpcompressd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N4
},
230
{ 0x8B,
"vpcompressq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_N8
},
231
232
{ 0x63,
"vcompressb"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N1
},
233
{ 0x63,
"vcompressw"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_N2
},
234
};
235
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
236
const
Tbl *
p
= &
tbl
[i];
237
std::string type =
type2String
(
p
->type);
238
printf(
"void %s(const Operand& op, const Xmm& x) { opAVX_X_XM_IMM(x, op, %s, 0x%02X); }\n"
,
p
->name, type.c_str(),
p
->code);
239
}
240
}
241
242
void
putX_X_XM_IMM
()
243
{
244
const
struct
Tbl {
245
uint8
code;
246
const
char
*
name
;
247
int
type
;
248
bool
hasIMM;
249
}
tbl
[] = {
250
{ 0x03,
"valignd"
,
T_MUST_EVEX
|
T_66
|
T_0F3A
|
T_EW0
|
T_YMM
,
true
},
251
{ 0x03,
"valignq"
,
T_MUST_EVEX
|
T_66
|
T_0F3A
|
T_EW1
|
T_YMM
,
true
},
252
{ 0xDB,
"vpandd"
,
T_MUST_EVEX
|
T_YMM
|
T_66
|
T_0F
|
T_EW0
|
T_B32
,
false
},
253
{ 0xDB,
"vpandq"
,
T_MUST_EVEX
|
T_YMM
|
T_66
|
T_0F
|
T_EW1
|
T_B64
,
false
},
254
{ 0xDF,
"vpandnd"
,
T_MUST_EVEX
|
T_YMM
|
T_66
|
T_0F
|
T_EW0
|
T_B32
,
false
},
255
{ 0xDF,
"vpandnq"
,
T_MUST_EVEX
|
T_YMM
|
T_66
|
T_0F
|
T_EW1
|
T_B64
,
false
},
256
{ 0x3D,
"vpmaxsq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
257
{ 0x3F,
"vpmaxuq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
258
{ 0x39,
"vpminsq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
259
{ 0x3B,
"vpminuq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
260
{ 0xE2,
"vpsraq"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_N16
,
false
},
261
{ 0x46,
"vpsravq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
262
{ 0x11,
"vpsravw"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
,
false
},
263
{ 0x12,
"vpsllvw"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
,
false
},
264
{ 0x10,
"vpsrlvw"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
,
false
},
265
{ 0xEB,
"vpord"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
,
false
},
266
{ 0xEB,
"vporq"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
267
268
{ 0xEF,
"vpxord"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
,
false
},
269
{ 0xEF,
"vpxorq"
,
T_66
|
T_0F
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
270
271
{ 0x40,
"vpmullq"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
,
false
},
272
273
{ 0x8D,
"vpermb"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
,
false
},
274
{ 0x8D,
"vpermw"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
,
false
},
275
276
{ 0x65,
"vblendmpd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
277
{ 0x65,
"vblendmps"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
278
{ 0x66,
"vpblendmb"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
,
false
},
279
{ 0x66,
"vpblendmw"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
,
false
},
280
{ 0x64,
"vpblendmd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
281
{ 0x64,
"vpblendmq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
282
283
{ 0x7D,
"vpermt2b"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
,
false
},
284
{ 0x7D,
"vpermt2w"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
,
false
},
285
{ 0x7E,
"vpermt2d"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
286
{ 0x7E,
"vpermt2q"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
287
{ 0x7F,
"vpermt2ps"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
288
{ 0x7F,
"vpermt2pd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
289
290
{ 0x75,
"vpermi2b"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
,
false
},
291
{ 0x75,
"vpermi2w"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
,
false
},
292
{ 0x76,
"vpermi2d"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
293
{ 0x76,
"vpermi2q"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
294
{ 0x77,
"vpermi2ps"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
295
{ 0x77,
"vpermi2pd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
296
297
{ 0x25,
"vpternlogd"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
true
},
298
{ 0x25,
"vpternlogq"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
true
},
299
300
{ 0x43,
"vgetexpsd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_X
|
T_N8
,
false
},
301
{ 0x43,
"vgetexpss"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_X
|
T_N4
,
false
},
302
{ 0x27,
"vgetmantsd"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_X
|
T_N8
,
true
},
303
{ 0x27,
"vgetmantss"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_X
|
T_N4
,
true
},
304
305
{ 0x54,
"vfixupimmpd"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_YMM
|
T_EW1
|
T_B64
|
T_SAE_Z
,
true
},
306
{ 0x54,
"vfixupimmps"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_B32
|
T_SAE_Z
,
true
},
307
{ 0x55,
"vfixupimmsd"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
|
T_N8
,
true
},
308
{ 0x55,
"vfixupimmss"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_N4
,
true
},
309
310
{ 0x4D,
"vrcp14sd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_EW1
|
T_N8
,
false
},
311
{ 0x4D,
"vrcp14ss"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_EW0
|
T_N4
,
false
},
312
313
{ 0x4F,
"vrsqrt14sd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_N8
,
false
},
314
{ 0x4F,
"vrsqrt14ss"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_N4
,
false
},
315
316
{ 0x0B,
"vrndscalesd"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_N8
,
true
},
317
{ 0x0A,
"vrndscaless"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_N4
,
true
},
318
319
{ 0x2C,
"vscalefpd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
|
T_ER_Z
,
false
},
320
{ 0x2C,
"vscalefps"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
|
T_ER_Z
,
false
},
321
{ 0x2D,
"vscalefsd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_EW1
|
T_ER_X
|
T_N8
,
false
},
322
{ 0x2D,
"vscalefss"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_EW0
|
T_ER_X
|
T_N4
,
false
},
323
324
{ 0x42,
"vdbpsadbw"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
,
true
},
325
{ 0x83,
"vpmultishiftqb"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
326
327
{ 0x15,
"vprolvd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
328
{ 0x15,
"vprolvq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
329
330
{ 0x14,
"vprorvd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
331
{ 0x14,
"vprorvq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
332
333
{ 0xCB,
"vrcp28sd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_EW1
|
T_N8
|
T_SAE_X
,
false
},
334
{ 0xCB,
"vrcp28ss"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_EW0
|
T_N4
|
T_SAE_X
,
false
},
335
336
{ 0xCD,
"vrsqrt28sd"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_EW1
|
T_N8
|
T_SAE_X
,
false
},
337
{ 0xCD,
"vrsqrt28ss"
,
T_66
|
T_0F38
|
T_MUST_EVEX
|
T_EW0
|
T_N4
|
T_SAE_X
,
false
},
338
339
{ 0x50,
"vrangepd"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
|
T_SAE_Z
,
true
},
340
{ 0x50,
"vrangeps"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
|
T_SAE_Z
,
true
},
341
{ 0x51,
"vrangesd"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_X
|
T_N8
,
true
},
342
{ 0x51,
"vrangess"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_X
|
T_N4
,
true
},
343
344
{ 0x57,
"vreducesd"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_X
|
T_N8
,
true
},
345
{ 0x57,
"vreducess"
,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_X
|
T_N4
,
true
},
346
347
{ 0xB4,
"vpmadd52luq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
348
{ 0xB5,
"vpmadd52huq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
349
350
{ 0x70,
"vpshldw"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
,
true
},
351
{ 0x71,
"vpshldd"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_B32
,
true
},
352
{ 0x71,
"vpshldq"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
|
T_B64
,
true
},
353
354
{ 0x70,
"vpshldvw"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
,
false
},
355
{ 0x71,
"vpshldvd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_B32
,
false
},
356
{ 0x71,
"vpshldvq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
|
T_B64
,
false
},
357
358
{ 0x72,
"vpshrdw"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
,
true
},
359
{ 0x73,
"vpshrdd"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_B32
,
true
},
360
{ 0x73,
"vpshrdq"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
|
T_B64
,
true
},
361
362
{ 0x72,
"vpshrdvw"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
,
false
},
363
{ 0x73,
"vpshrdvd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_B32
,
false
},
364
{ 0x73,
"vpshrdvq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
|
T_B64
,
false
},
365
366
{ 0x50,
"vpdpbusd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_B32
,
false
},
367
{ 0x51,
"vpdpbusds"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_B32
,
false
},
368
369
{ 0x52,
"vpdpwssd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_B32
,
false
},
370
{ 0x53,
"vpdpwssds"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_B32
,
false
},
371
};
372
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
373
const
Tbl *
p
= &
tbl
[i];
374
std::string type =
type2String
(
p
->type);
375
printf(
"void %s(const Xmm& x1, const Xmm& x2, const Operand& op%s) { opAVX_X_X_XM(x1, x2, op, %s, 0x%02X%s); }\n"
376
,
p
->name,
p
->hasIMM ?
", uint8 imm"
:
""
, type.c_str(),
p
->code,
p
->hasIMM ?
", imm"
:
""
);
377
}
378
}
379
380
void
putShift
()
381
{
382
const
struct
Tbl {
383
const
char
*
name
;
384
uint8
code;
385
int
idx;
386
int
type
;
387
}
tbl
[] = {
388
{
"vpsraq"
, 0x72, 4,
T_0F
|
T_66
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
},
389
{
"vprold"
, 0x72, 1,
T_66
|
T_0F
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
},
390
{
"vprolq"
, 0x72, 1,
T_66
|
T_0F
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
},
391
{
"vprord"
, 0x72, 0,
T_66
|
T_0F
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
},
392
{
"vprorq"
, 0x72, 0,
T_66
|
T_0F
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
},
393
};
394
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
395
const
Tbl&
p
=
tbl
[i];
396
std::string type =
type2String
(
p
.type);
397
printf(
"void %s(const Xmm& x, const Operand& op, uint8 imm) { opAVX_X_X_XM(Xmm(x.getKind(), %d), x, op, %s, 0x%02X, imm); }\n"
,
p
.name,
p
.idx, type.c_str(),
p
.code);
398
}
399
}
400
401
void
putExtractInsert
()
402
{
403
{
404
const
struct
Tbl {
405
const
char
*
name
;
406
uint8
code;
407
int
type
;
408
bool
isZMM;
409
}
tbl
[] = {
410
{
"vextractf32x4"
, 0x19,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_YMM
|
T_N16
,
false
},
411
{
"vextractf64x2"
, 0x19,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_YMM
|
T_N16
,
false
},
412
{
"vextractf32x8"
, 0x1B,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_YMM
|
T_N32
,
true
},
413
{
"vextractf64x4"
, 0x1B,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_YMM
|
T_N32
,
true
},
414
415
{
"vextracti32x4"
, 0x39,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_YMM
|
T_N16
,
false
},
416
{
"vextracti64x2"
, 0x39,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_YMM
|
T_N16
,
false
},
417
{
"vextracti32x8"
, 0x3B,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_YMM
|
T_N32
,
true
},
418
{
"vextracti64x4"
, 0x3B,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_YMM
|
T_N32
,
true
},
419
};
420
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
421
const
Tbl&
p
=
tbl
[i];
422
std::string type =
type2String
(
p
.type);
423
const
char
*kind =
p
.isZMM ?
"Operand::MEM | Operand::YMM"
:
"Operand::MEM | Operand::XMM"
;
424
printf(
"void %s(const Operand& op, const %s& r, uint8 imm) { if (!op.is(%s)) throw Error(ERR_BAD_COMBINATION); opVex(r, 0, op, %s, 0x%2X, imm); }\n"
,
p
.name,
p
.isZMM ?
"Zmm"
:
"Ymm"
, kind, type.c_str(),
p
.code);
425
}
426
}
427
{
428
const
struct
Tbl {
429
const
char
*
name
;
430
uint8
code;
431
int
type
;
432
bool
isZMM;
433
}
tbl
[] = {
434
{
"vinsertf32x4"
, 0x18,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_YMM
|
T_N16
,
false
},
435
{
"vinsertf64x2"
, 0x18,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_YMM
|
T_N16
,
false
},
436
{
"vinsertf32x8"
, 0x1A,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_YMM
|
T_N32
,
true
},
437
{
"vinsertf64x4"
, 0x1A,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_YMM
|
T_N32
,
true
},
438
439
{
"vinserti32x4"
, 0x38,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_YMM
|
T_N16
,
false
},
440
{
"vinserti64x2"
, 0x38,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_YMM
|
T_N16
,
false
},
441
{
"vinserti32x8"
, 0x3A,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW0
|
T_YMM
|
T_N32
,
true
},
442
{
"vinserti64x4"
, 0x3A,
T_66
|
T_0F3A
|
T_MUST_EVEX
|
T_EW1
|
T_YMM
|
T_N32
,
true
},
443
};
444
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
445
const
Tbl&
p
=
tbl
[i];
446
std::string type =
type2String
(
p
.type);
447
const
char
*x =
p
.isZMM ?
"Zmm"
:
"Ymm"
;
448
const
char
*cond =
p
.isZMM ?
"op.is(Operand::MEM | Operand::YMM)"
:
"(r1.getKind() == r2.getKind() && op.is(Operand::MEM | Operand::XMM))"
;
449
printf(
"void %s(const %s& r1, const %s& r2, const Operand& op, uint8 imm) {"
450
"if (!%s) throw Error(ERR_BAD_COMBINATION); "
451
"opVex(r1, &r2, op, %s, 0x%2X, imm); }\n"
,
p
.name, x, x, cond, type.c_str(),
p
.code);
452
}
453
}
454
}
455
456
void
putBroadcast
(
bool
only64bit)
457
{
458
{
459
const
struct
Tbl {
460
uint8
code;
461
const
char
*
name
;
462
int
type
;
463
int
reg;
464
}
tbl
[] = {
465
{ 0x7A,
"vpbroadcastb"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
, 8 },
466
{ 0x7B,
"vpbroadcastw"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
, 16 },
467
{ 0x7C,
"vpbroadcastd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
, 32 },
468
{ 0x7C,
"vpbroadcastq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
, 64},
469
};
470
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
471
const
Tbl&
p
=
tbl
[i];
472
std::string type =
type2String
(
p
.type);
473
if
((only64bit &&
p
.reg == 64) || (!only64bit &&
p
.reg != 64)) {
474
printf(
"void %s(const Xmm& x, const Reg%d& r) { opVex(x, 0, r, %s, 0x%02X); }\n"
,
p
.name,
p
.reg, type.c_str(),
p
.code);
475
}
476
}
477
}
478
if
(only64bit)
return
;
479
puts(
"void vbroadcastf32x2(const Ymm& y, const Operand& op) { opAVX_X_XM_IMM(y, op, T_66 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW0 | T_N8, 0x19); }"
);
480
puts(
"void vbroadcastf32x4(const Ymm& y, const Address& addr) { opAVX_X_XM_IMM(y, addr, T_66 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW0 | T_N16, 0x1A); }"
);
481
puts(
"void vbroadcastf64x2(const Ymm& y, const Address& addr) { opAVX_X_XM_IMM(y, addr, T_66 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW1 | T_N16, 0x1A); }"
);
482
puts(
"void vbroadcastf64x4(const Zmm& y, const Address& addr) { opAVX_X_XM_IMM(y, addr, T_66 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW1 | T_N32, 0x1B); }"
);
483
puts(
"void vbroadcastf32x8(const Zmm& y, const Address& addr) { opAVX_X_XM_IMM(y, addr, T_66 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW0 | T_N32, 0x1B); }"
);
484
485
puts(
"void vbroadcasti32x2(const Xmm& x, const Operand& op) { opAVX_X_XM_IMM(x, op, T_66 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW0 | T_N8, 0x59); }"
);
486
puts(
"void vbroadcasti32x4(const Ymm& y, const Operand& op) { opAVX_X_XM_IMM(y, op, T_66 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW0 | T_N16, 0x5A); }"
);
487
puts(
"void vbroadcasti64x2(const Ymm& y, const Operand& op) { opAVX_X_XM_IMM(y, op, T_66 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW1 | T_N16, 0x5A); }"
);
488
puts(
"void vbroadcasti32x8(const Zmm& z, const Operand& op) { opAVX_X_XM_IMM(z, op, T_66 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW0 | T_N32, 0x5B); }"
);
489
puts(
"void vbroadcasti64x4(const Zmm& z, const Operand& op) { opAVX_X_XM_IMM(z, op, T_66 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW1 | T_N32, 0x5B); }"
);
490
}
491
492
void
putCvt
()
493
{
494
puts(
"void vcvtpd2udq(const Xmm& x, const Operand& op) { opCvt2(x, op, T_0F | T_YMM | T_MUST_EVEX | T_EW1 | T_B64 | T_ER_Z, 0x79); }"
);
495
puts(
"void vcvtps2qq(const Xmm& x, const Operand& op) { checkCvt1(x, op); opVex(x, 0, op, T_66 | T_0F | T_YMM | T_MUST_EVEX | T_EW0 | T_B32 | T_N8 | T_N_VL | T_ER_Y, 0x7B); }"
);
496
puts(
"void vcvtps2uqq(const Xmm& x, const Operand& op) { checkCvt1(x, op); opVex(x, 0, op, T_66 | T_0F | T_YMM | T_MUST_EVEX | T_EW0 | T_B32 | T_N8 | T_N_VL | T_ER_Y, 0x79); }"
);
497
puts(
"void vcvtqq2ps(const Xmm& x, const Operand& op) { opCvt2(x, op, T_0F | T_YMM | T_MUST_EVEX | T_EW1 | T_B64 | T_ER_Z, 0x5B); }"
);
498
puts(
"void vcvttpd2udq(const Xmm& x, const Operand& op) { opCvt2(x, op, T_0F | T_YMM | T_MUST_EVEX | T_EW1 | T_B64 | T_SAE_Z, 0x78); }"
);
499
puts(
"void vcvttps2qq(const Xmm& x, const Operand& op) { checkCvt1(x, op); opVex(x, 0, op, T_66 | T_0F | T_YMM | T_MUST_EVEX | T_EW0 | T_B32 | T_N8 | T_N_VL | T_SAE_Y, 0x7A); }"
);
500
puts(
"void vcvttps2uqq(const Xmm& x, const Operand& op) { checkCvt1(x, op); opVex(x, 0, op, T_66 | T_0F | T_YMM | T_MUST_EVEX | T_EW0 | T_B32 | T_N8 | T_N_VL | T_SAE_Y, 0x78); }"
);
501
puts(
"void vcvtudq2pd(const Xmm& x, const Operand& op) { checkCvt1(x, op); opVex(x, 0, op, T_F3 | T_0F | T_YMM | T_MUST_EVEX | T_EW0 | T_B32 | T_N8 | T_N_VL, 0x7A); }"
);
502
503
puts(
"void vcvtsd2usi(const Reg32e& r, const Operand& op) { int type = (T_F2 | T_0F | T_MUST_EVEX | T_N8 | T_ER_X) | (r.isREG(64) ? T_EW1 : T_EW0); opAVX_X_X_XM(Xmm(r.getIdx()), xm0, op, type, 0x79); }"
);
504
puts(
"void vcvtss2usi(const Reg32e& r, const Operand& op) { int type = (T_F3 | T_0F | T_MUST_EVEX | T_N4 | T_ER_X) | (r.isREG(64) ? T_EW1 : T_EW0); opAVX_X_X_XM(Xmm(r.getIdx()), xm0, op, type, 0x79); }"
);
505
puts(
"void vcvttsd2usi(const Reg32e& r, const Operand& op) { int type = (T_F2 | T_0F | T_MUST_EVEX | T_N8 | T_SAE_X) | (r.isREG(64) ? T_EW1 : T_EW0); opAVX_X_X_XM(Xmm(r.getIdx()), xm0, op, type, 0x78); }"
);
506
puts(
"void vcvttss2usi(const Reg32e& r, const Operand& op) { int type = (T_F3 | T_0F | T_MUST_EVEX | T_N4 | T_SAE_X) | (r.isREG(64) ? T_EW1 : T_EW0); opAVX_X_X_XM(Xmm(r.getIdx()), xm0, op, type, 0x78); }"
);
507
puts(
"void vcvtuqq2ps(const Xmm& x, const Operand& op) { opCvt2(x, op, T_F2 | T_0F | T_YMM | T_MUST_EVEX | T_EW1 | T_B64 | T_ER_Z, 0x7A); }"
);
508
puts(
"void vcvtusi2sd(const Xmm& x1, const Xmm& x2, const Operand& op) { opCvt3(x1, x2, op, T_F2 | T_0F | T_MUST_EVEX, T_W1 | T_EW1 | T_ER_X | T_N8, T_W0 | T_EW0 | T_N4, 0x7B); }"
);
509
puts(
"void vcvtusi2ss(const Xmm& x1, const Xmm& x2, const Operand& op) { opCvt3(x1, x2, op, T_F3 | T_0F | T_MUST_EVEX | T_ER_X, T_W1 | T_EW1 | T_N8, T_W0 | T_EW0 | T_N4, 0x7B); }"
);
510
}
511
512
enum
{
// same as xbyak.h
513
xx_yy_zz
= 0,
514
xx_yx_zy
= 1,
515
xx_xy_yz
= 2,
516
};
517
void
putGather
()
518
{
519
const
struct
Tbl {
520
const
char
*
name
;
521
int
type
;
522
uint8
code;
523
int
mode;
524
}
tbl
[] = {
525
{
"vpgatherdd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_N4
, 0x90,
xx_yy_zz
},
526
{
"vpgatherdq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_N8
, 0x90,
xx_yx_zy
},
527
{
"vpgatherqd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_N4
, 0x91,
xx_xy_yz
},
528
{
"vpgatherqq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_N8
, 0x91,
xx_yy_zz
},
529
{
"vgatherdps"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_N4
, 0x92,
xx_yy_zz
},
530
{
"vgatherdpd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_N8
, 0x92,
xx_yx_zy
},
531
{
"vgatherqps"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_N4
, 0x93,
xx_xy_yz
},
532
{
"vgatherqpd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_N8
, 0x93,
xx_yy_zz
},
533
};
534
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
535
const
Tbl&
p
=
tbl
[i];
536
std::string type =
type2String
(
p
.type);
537
printf(
"void %s(const Xmm& x, const Address& addr) { opGather2(x, addr, %s, 0x%02X, %d); }\n"
,
p
.name, type.c_str(),
p
.code,
p
.mode);
538
}
539
}
540
void
putScatter
()
541
{
542
const
struct
Tbl {
543
const
char
*
name
;
544
int
type
;
545
uint8
code;
546
int
mode;
// reverse of gather
547
}
tbl
[] = {
548
{
"vpscatterdd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_N4
|
T_M_K
, 0xA0,
xx_yy_zz
},
549
{
"vpscatterdq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_N8
|
T_M_K
, 0xA0,
xx_yx_zy
},
550
{
"vpscatterqd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_N4
|
T_M_K
, 0xA1,
xx_xy_yz
},
551
{
"vpscatterqq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_N8
|
T_M_K
, 0xA1,
xx_yy_zz
},
552
553
{
"vscatterdps"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_N4
|
T_M_K
, 0xA2,
xx_yy_zz
},
554
{
"vscatterdpd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_N8
|
T_M_K
, 0xA2,
xx_yx_zy
},
555
{
"vscatterqps"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_N4
|
T_M_K
, 0xA3,
xx_xy_yz
},
556
{
"vscatterqpd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_N8
|
T_M_K
, 0xA3,
xx_yy_zz
},
557
};
558
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
559
const
Tbl&
p
=
tbl
[i];
560
std::string type =
type2String
(
p
.type);
561
printf(
"void %s(const Address& addr, const Xmm& x) { opGather2(x, addr, %s, 0x%02X, %d); }\n"
,
p
.name, type.c_str(),
p
.code,
p
.mode);
562
}
563
}
564
565
void
putShuff
()
566
{
567
puts(
"void vshuff32x4(const Ymm& y1, const Ymm& y2, const Operand& op, uint8 imm) { opAVX_X_X_XM(y1, y2, op, T_66 | T_0F3A | T_YMM | T_MUST_EVEX | T_EW0 | T_B32, 0x23, imm); }"
);
568
puts(
"void vshuff64x2(const Ymm& y1, const Ymm& y2, const Operand& op, uint8 imm) { opAVX_X_X_XM(y1, y2, op, T_66 | T_0F3A | T_YMM | T_MUST_EVEX | T_EW1 | T_B64, 0x23, imm); }"
);
569
puts(
"void vshufi32x4(const Ymm& y1, const Ymm& y2, const Operand& op, uint8 imm) { opAVX_X_X_XM(y1, y2, op, T_66 | T_0F3A | T_YMM | T_MUST_EVEX | T_EW0 | T_B32, 0x43, imm); }"
);
570
puts(
"void vshufi64x2(const Ymm& y1, const Ymm& y2, const Operand& op, uint8 imm) { opAVX_X_X_XM(y1, y2, op, T_66 | T_0F3A | T_YMM | T_MUST_EVEX | T_EW1 | T_B64, 0x43, imm); }"
);
571
}
572
573
void
putMov
()
574
{
575
puts(
"void vpmovm2b(const Xmm& x, const Opmask& k) { opVex(x, 0, k, T_F3 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW0, 0x28); }"
);
576
puts(
"void vpmovm2w(const Xmm& x, const Opmask& k) { opVex(x, 0, k, T_F3 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW1, 0x28); }"
);
577
puts(
"void vpmovm2d(const Xmm& x, const Opmask& k) { opVex(x, 0, k, T_F3 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW0, 0x38); }"
);
578
puts(
"void vpmovm2q(const Xmm& x, const Opmask& k) { opVex(x, 0, k, T_F3 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW1, 0x38); }"
);
579
580
puts(
"void vpmovb2m(const Opmask& k, const Xmm& x) { opVex(k, 0, x, T_F3 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW0, 0x29); }"
);
581
puts(
"void vpmovw2m(const Opmask& k, const Xmm& x) { opVex(k, 0, x, T_F3 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW1, 0x29); }"
);
582
puts(
"void vpmovd2m(const Opmask& k, const Xmm& x) { opVex(k, 0, x, T_F3 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW0, 0x39); }"
);
583
puts(
"void vpmovq2m(const Opmask& k, const Xmm& x) { opVex(k, 0, x, T_F3 | T_0F38 | T_MUST_EVEX | T_YMM | T_EW1, 0x39); }"
);
584
585
{
586
const
struct
Tbl {
587
uint8_t
code;
588
const
char
*
name
;
589
int
type
;
590
int
mode;
591
}
tbl
[] = {
592
{ 0x32,
"vpmovqb"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N2
|
T_N_VL
,
false
},
593
{ 0x22,
"vpmovsqb"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N2
|
T_N_VL
,
false
},
594
{ 0x12,
"vpmovusqb"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N2
|
T_N_VL
,
false
},
595
596
{ 0x34,
"vpmovqw"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N4
|
T_N_VL
,
false
},
597
{ 0x24,
"vpmovsqw"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N4
|
T_N_VL
,
false
},
598
{ 0x14,
"vpmovusqw"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N4
|
T_N_VL
,
false
},
599
600
{ 0x35,
"vpmovqd"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N8
|
T_N_VL
,
true
},
601
{ 0x25,
"vpmovsqd"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N8
|
T_N_VL
,
true
},
602
{ 0x15,
"vpmovusqd"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N8
|
T_N_VL
,
true
},
603
604
{ 0x31,
"vpmovdb"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N4
|
T_N_VL
,
false
},
605
{ 0x21,
"vpmovsdb"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N4
|
T_N_VL
,
false
},
606
{ 0x11,
"vpmovusdb"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N4
|
T_N_VL
,
false
},
607
608
{ 0x33,
"vpmovdw"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N8
|
T_N_VL
,
true
},
609
{ 0x23,
"vpmovsdw"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N8
|
T_N_VL
,
true
},
610
{ 0x13,
"vpmovusdw"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N8
|
T_N_VL
,
true
},
611
612
{ 0x30,
"vpmovwb"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N8
|
T_N_VL
,
true
},
613
{ 0x20,
"vpmovswb"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N8
|
T_N_VL
,
true
},
614
{ 0x10,
"vpmovuswb"
,
T_F3
|
T_0F38
|
T_MUST_EVEX
|
T_YMM
|
T_EW0
|
T_N8
|
T_N_VL
,
true
},
615
};
616
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
617
const
Tbl&
p
=
tbl
[i];
618
std::string type =
type2String
(
p
.type);
619
printf(
"void %s(const Operand& op, const Xmm& x) { opVmov(op, x, %s, 0x%02X, %s); }\n"
,
p
.name, type.c_str(),
p
.code,
p
.mode ?
"true"
:
"false"
);
620
}
621
}
622
}
623
624
void
putX_XM_IMM
()
625
{
626
const
struct
Tbl {
627
uint8
code;
628
const
char
*
name
;
629
int
type
;
630
bool
hasIMM;
631
}
tbl
[] = {
632
{ 0x26,
"vgetmantpd"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
|
T_SAE_Z
,
true
},
633
{ 0x26,
"vgetmantps"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
|
T_SAE_Z
,
true
},
634
{ 0x4C,
"vrcp14pd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
635
{ 0x4C,
"vrcp14ps"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
636
637
{ 0x4E,
"vrsqrt14pd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
638
{ 0x4E,
"vrsqrt14ps"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
639
640
{ 0x09,
"vrndscalepd"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
true
},
641
{ 0x08,
"vrndscaleps"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
true
},
642
643
{ 0xC4,
"vpconflictd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
644
{ 0xC4,
"vpconflictq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
645
646
{ 0x44,
"vplzcntd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
,
false
},
647
{ 0x44,
"vplzcntq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
,
false
},
648
649
{ 0x56,
"vreducepd"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_B64
|
T_SAE_Z
,
true
},
650
{ 0x56,
"vreduceps"
,
T_66
|
T_0F3A
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_B32
|
T_SAE_Z
,
true
},
651
652
{ 0x54,
"vpopcntb"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
,
false
},
653
{ 0x54,
"vpopcntw"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
,
false
},
654
{ 0x55,
"vpopcntd"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_B32
,
false
},
655
{ 0x55,
"vpopcntq"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
|
T_B64
,
false
},
656
657
{ 0x62,
"vpexpandb"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW0
|
T_SAE_Z
|
T_N1
,
false
},
658
{ 0x62,
"vpexpandw"
,
T_66
|
T_0F38
|
T_YMM
|
T_MUST_EVEX
|
T_EW1
|
T_SAE_Z
|
T_N2
,
false
},
659
};
660
for
(
size_t
i = 0; i <
NUM_OF_ARRAY
(
tbl
); i++) {
661
const
Tbl *
p
= &
tbl
[i];
662
std::string type =
type2String
(
p
->type);
663
printf(
"void %s(const Xmm& x, const Operand& op%s) { opAVX_X_XM_IMM(x, op, %s, 0x%02X%s); }\n"
664
,
p
->name,
p
->hasIMM ?
", uint8 imm"
:
""
, type.c_str(),
p
->code,
p
->hasIMM ?
", imm"
:
""
);
665
}
666
}
667
668
void
putMisc
()
669
{
670
puts(
"void vpbroadcastmb2q(const Xmm& x, const Opmask& k) { opVex(x, 0, k, T_F3 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW1, 0x2A); }"
);
671
puts(
"void vpbroadcastmw2d(const Xmm& x, const Opmask& k) { opVex(x, 0, k, T_F3 | T_0F38 | T_YMM | T_MUST_EVEX | T_EW0, 0x3A); }"
);
672
673
puts(
"void vgatherpf0dps(const Address& addr) { opGatherFetch(addr, zm1, T_66 | T_0F38 | T_EW0 | T_MUST_EVEX | T_N4 | T_M_K, 0xC6, Operand::ZMM); }"
);
674
puts(
"void vgatherpf0qps(const Address& addr) { opGatherFetch(addr, zm1, T_66 | T_0F38 | T_EW0 | T_MUST_EVEX | T_N4 | T_M_K, 0xC7, Operand::ZMM); }"
);
675
puts(
"void vgatherpf0dpd(const Address& addr) { opGatherFetch(addr, zm1, T_66 | T_0F38 | T_EW1 | T_MUST_EVEX | T_N8 | T_M_K, 0xC6, Operand::YMM); }"
);
676
puts(
"void vgatherpf0qpd(const Address& addr) { opGatherFetch(addr, zm1, T_66 | T_0F38 | T_EW1 | T_MUST_EVEX | T_N8 | T_M_K, 0xC7, Operand::ZMM); }"
);
677
678
puts(
"void vgatherpf1dps(const Address& addr) { opGatherFetch(addr, zm2, T_66 | T_0F38 | T_EW0 | T_MUST_EVEX | T_N4 | T_M_K, 0xC6, Operand::ZMM); }"
);
679
puts(
"void vgatherpf1qps(const Address& addr) { opGatherFetch(addr, zm2, T_66 | T_0F38 | T_EW0 | T_MUST_EVEX | T_N4 | T_M_K, 0xC7, Operand::ZMM); }"
);
680
puts(
"void vgatherpf1dpd(const Address& addr) { opGatherFetch(addr, zm2, T_66 | T_0F38 | T_EW1 | T_MUST_EVEX | T_N8 | T_M_K, 0xC6, Operand::YMM); }"
);
681
puts(
"void vgatherpf1qpd(const Address& addr) { opGatherFetch(addr, zm2, T_66 | T_0F38 | T_EW1 | T_MUST_EVEX | T_N8 | T_M_K, 0xC7, Operand::ZMM); }"
);
682
683
puts(
"void vscatterpf0dps(const Address& addr) { opGatherFetch(addr, zm5, T_66 | T_0F38 | T_EW0 | T_MUST_EVEX | T_N4 | T_M_K, 0xC6, Operand::ZMM); }"
);
684
puts(
"void vscatterpf0qps(const Address& addr) { opGatherFetch(addr, zm5, T_66 | T_0F38 | T_EW0 | T_MUST_EVEX | T_N4 | T_M_K, 0xC7, Operand::ZMM); }"
);
685
puts(
"void vscatterpf0dpd(const Address& addr) { opGatherFetch(addr, zm5, T_66 | T_0F38 | T_EW1 | T_MUST_EVEX | T_N8 | T_M_K, 0xC6, Operand::YMM); }"
);
686
puts(
"void vscatterpf0qpd(const Address& addr) { opGatherFetch(addr, zm5, T_66 | T_0F38 | T_EW1 | T_MUST_EVEX | T_N8 | T_M_K, 0xC7, Operand::ZMM); }"
);
687
688
puts(
"void vscatterpf1dps(const Address& addr) { opGatherFetch(addr, zm6, T_66 | T_0F38 | T_EW0 | T_MUST_EVEX | T_N4 | T_M_K, 0xC6, Operand::ZMM); }"
);
689
puts(
"void vscatterpf1qps(const Address& addr) { opGatherFetch(addr, zm6, T_66 | T_0F38 | T_EW0 | T_MUST_EVEX | T_N4 | T_M_K, 0xC7, Operand::ZMM); }"
);
690
puts(
"void vscatterpf1dpd(const Address& addr) { opGatherFetch(addr, zm6, T_66 | T_0F38 | T_EW1 | T_MUST_EVEX | T_N8 | T_M_K, 0xC6, Operand::YMM); }"
);
691
puts(
"void vscatterpf1qpd(const Address& addr) { opGatherFetch(addr, zm6, T_66 | T_0F38 | T_EW1 | T_MUST_EVEX | T_N8 | T_M_K, 0xC7, Operand::ZMM); }"
);
692
693
puts(
"void vfpclasspd(const Opmask& k, const Operand& op, uint8 imm) { if (!op.isBit(128|256|512)) throw Error(ERR_BAD_MEM_SIZE); Reg x = k; x.setBit(op.getBit()); opVex(x, 0, op, T_66 | T_0F3A | T_MUST_EVEX | T_YMM | T_EW1 | T_B64, 0x66, imm); }"
);
694
puts(
"void vfpclassps(const Opmask& k, const Operand& op, uint8 imm) { if (!op.isBit(128|256|512)) throw Error(ERR_BAD_MEM_SIZE); Reg x = k; x.setBit(op.getBit()); opVex(x, 0, op, T_66 | T_0F3A | T_MUST_EVEX | T_YMM | T_EW0 | T_B32, 0x66, imm); }"
);
695
puts(
"void vfpclasssd(const Opmask& k, const Operand& op, uint8 imm) { if (!op.isXMEM()) throw Error(ERR_BAD_MEM_SIZE); opVex(k, 0, op, T_66 | T_0F3A | T_MUST_EVEX | T_EW1 | T_N8, 0x67, imm); }"
);
696
puts(
"void vfpclassss(const Opmask& k, const Operand& op, uint8 imm) { if (!op.isXMEM()) throw Error(ERR_BAD_MEM_SIZE); opVex(k, 0, op, T_66 | T_0F3A | T_MUST_EVEX | T_EW0 | T_N4, 0x67, imm); }"
);
697
698
puts(
"void vpshufbitqmb(const Opmask& k, const Xmm& x, const Operand& op) { opVex(k, &x, op, T_66 | T_0F38 | T_EW0 | T_YMM | T_MUST_EVEX, 0x8F); }"
);
699
}
700
701
void
putV4FMA
()
702
{
703
puts(
"void v4fmaddps(const Zmm& z1, const Zmm& z2, const Address& addr) { opAVX_X_X_XM(z1, z2, addr, T_0F38 | T_F2 | T_EW0 | T_YMM | T_MUST_EVEX | T_N16, 0x9A); }"
);
704
puts(
"void v4fnmaddps(const Zmm& z1, const Zmm& z2, const Address& addr) { opAVX_X_X_XM(z1, z2, addr, T_0F38 | T_F2 | T_EW0 | T_YMM | T_MUST_EVEX | T_N16, 0xAA); }"
);
705
puts(
"void v4fmaddss(const Xmm& x1, const Xmm& x2, const Address& addr) { opAVX_X_X_XM(x1, x2, addr, T_0F38 | T_F2 | T_EW0 | T_MUST_EVEX | T_N16, 0x9B); }"
);
706
puts(
"void v4fnmaddss(const Xmm& x1, const Xmm& x2, const Address& addr) { opAVX_X_X_XM(x1, x2, addr, T_0F38 | T_F2 | T_EW0 | T_MUST_EVEX | T_N16, 0xAB); }"
);
707
puts(
"void vp4dpwssd(const Zmm& z1, const Zmm& z2, const Address& addr) { opAVX_X_X_XM(z1, z2, addr, T_0F38 | T_F2 | T_EW0 | T_YMM | T_MUST_EVEX | T_N16, 0x52); }"
);
708
puts(
"void vp4dpwssds(const Zmm& z1, const Zmm& z2, const Address& addr) { opAVX_X_X_XM(z1, z2, addr, T_0F38 | T_F2 | T_EW0 | T_YMM | T_MUST_EVEX | T_N16, 0x53); }"
);
709
}
710
711
int
main
(
int
argc,
char
*[])
712
{
713
bool
only64bit = argc == 2;
714
putOpmask
(only64bit);
715
putBroadcast
(only64bit);
716
if
(only64bit)
return
0;
717
putVcmp
();
718
putX_XM
();
719
putM_X
();
720
putXM_X
();
721
putX_X_XM_IMM
();
722
putShift
();
723
putExtractInsert
();
724
putCvt
();
725
putGather
();
726
putShuff
();
727
putMov
();
728
putX_XM_IMM
();
729
putMisc
();
730
putScatter
();
731
putV4FMA
();
732
}
avx_type.hpp
T_ER_Z
@ T_ER_Z
Definition
avx_type.hpp:31
T_B32
@ T_B32
Definition
avx_type.hpp:36
T_0F38
@ T_0F38
Definition
avx_type.hpp:19
T_YMM
@ T_YMM
Definition
avx_type.hpp:27
T_EW0
@ T_EW0
Definition
avx_type.hpp:25
T_N2
@ T_N2
Definition
avx_type.hpp:6
T_MUST_EVEX
@ T_MUST_EVEX
Definition
avx_type.hpp:35
T_0F3A
@ T_0F3A
Definition
avx_type.hpp:20
T_ER_Y
@ T_ER_Y
Definition
avx_type.hpp:30
T_SAE_Z
@ T_SAE_Z
Definition
avx_type.hpp:34
T_N_VL
@ T_N_VL
Definition
avx_type.hpp:13
T_SAE_X
@ T_SAE_X
Definition
avx_type.hpp:32
T_F2
@ T_F2
Definition
avx_type.hpp:17
T_EW1
@ T_EW1
Definition
avx_type.hpp:26
T_N32
@ T_N32
Definition
avx_type.hpp:10
T_N16
@ T_N16
Definition
avx_type.hpp:9
T_N4
@ T_N4
Definition
avx_type.hpp:7
T_66
@ T_66
Definition
avx_type.hpp:15
T_B64
@ T_B64
Definition
avx_type.hpp:37
T_M_K
@ T_M_K
Definition
avx_type.hpp:38
T_F3
@ T_F3
Definition
avx_type.hpp:16
T_N1
@ T_N1
Definition
avx_type.hpp:5
T_0F
@ T_0F
Definition
avx_type.hpp:18
T_N8
@ T_N8
Definition
avx_type.hpp:8
T_ER_X
@ T_ER_X
Definition
avx_type.hpp:29
type2String
std::string type2String(int type)
Definition
avx_type.hpp:44
p
const mie::Vuint & p
Definition
bn.cpp:27
name
std::string name
Definition
catch_reporter_console.cpp:186
tbl
const struct Ptn tbl[]
putExtractInsert
void putExtractInsert()
Definition
gen_avx512.cpp:401
putX_XM_IMM
void putX_XM_IMM()
Definition
gen_avx512.cpp:624
NUM_OF_ARRAY
#define NUM_OF_ARRAY(x)
Definition
gen_avx512.cpp:5
putShift
void putShift()
Definition
gen_avx512.cpp:380
putGather
void putGather()
Definition
gen_avx512.cpp:517
putX_X_XM_IMM
void putX_X_XM_IMM()
Definition
gen_avx512.cpp:242
putX_XM
void putX_XM()
Definition
gen_avx512.cpp:150
putV4FMA
void putV4FMA()
Definition
gen_avx512.cpp:701
putShuff
void putShuff()
Definition
gen_avx512.cpp:565
putVcmp
void putVcmp()
Definition
gen_avx512.cpp:98
putMisc
void putMisc()
Definition
gen_avx512.cpp:668
putScatter
void putScatter()
Definition
gen_avx512.cpp:540
putXM_X
void putXM_X()
Definition
gen_avx512.cpp:219
putM_X
void putM_X()
Definition
gen_avx512.cpp:198
putOpmask
void putOpmask(bool only64bit)
Definition
gen_avx512.cpp:15
putCvt
void putCvt()
Definition
gen_avx512.cpp:492
putMov
void putMov()
Definition
gen_avx512.cpp:573
xx_xy_yz
@ xx_xy_yz
Definition
gen_avx512.cpp:515
xx_yx_zy
@ xx_yx_zy
Definition
gen_avx512.cpp:514
xx_yy_zz
@ xx_yy_zz
Definition
gen_avx512.cpp:513
putBroadcast
void putBroadcast(bool only64bit)
Definition
gen_avx512.cpp:456
Xbyak
Definition
xbyak.h:104
uint8
unsigned char uint8
Definition
normalize_prefix.cpp:9
main
int main()
Definition
platform_timer_posix_test.c:5
uint8_t
unsigned char uint8_t
Definition
stdint.h:124
xbyak.h
Xbyak ; JIT assembler for x86(IA32)/x64 by C++.
type
yh_object_type type
Definition
yubihsm.h:672
libraries
fc
libraries
ff
depends
xbyak
gen
gen_avx512.cpp
Generated by
1.12.0