iflags: Add IF_EVEX for checking {evex} availability

For checking the availability of {evex} prefix, AVX512 iflag
has been used. But this is a flag for an instruction set
not for an encoding scheme. And there are some AVX512 instructions
encoded with VEX prefix.

So a new instruction flag (IF_EVEX) is added for the instructions
which are actually encoded with EVEX prefix.

This flag is automatically added by insns.pl, so no need to add manually
in insns.dat.

Signed-off-by: Jin Kyu Song <jin.kyu.song@intel.com>
This commit is contained in:
Jin Kyu Song 2013-11-26 17:27:48 -08:00
parent 08ae610ec9
commit 6cfa968e8d
3 changed files with 12 additions and 6 deletions

View file

@ -692,6 +692,9 @@ int64_t assemble(int32_t segment, int64_t offset, int bits, iflag_t cp,
error(ERR_NONFATAL, "instruction not supported in %d-bit mode",
bits);
break;
case MERR_ENCMISMATCH:
error(ERR_NONFATAL, "specific encoding scheme not available");
break;
case MERR_BADBND:
error(ERR_NONFATAL, "bnd prefix is not allowed");
break;
@ -2092,6 +2095,13 @@ static enum match_result matches(const struct itemplate *itemp,
if (!(optimizing > 0) && itemp_has(itemp, IF_OPT))
return MERR_INVALOP;
/*
* {evex} available?
*/
if (instruction->prefixes[PPS_EVEX] && !itemp_has(itemp, IF_EVEX)) {
return MERR_ENCMISMATCH;
}
/*
* Check that no spurious colons or TOs are present
*/
@ -2232,9 +2242,6 @@ static enum match_result matches(const struct itemplate *itemp,
*/
return MERR_BRNUMMISMATCH;
}
} else if (instruction->prefixes[PPS_EVEX] &&
!itemp_has(itemp, IF_AVX512)) {
return MERR_ENCMISMATCH;
}
}

View file

@ -120,6 +120,7 @@ my %insns_flag_bit = (
"TBM" => [ 60, ""],
"RTM" => [ 61, ""],
"INVPCID" => [ 62, ""],
"EVEX" => [ 63, ""],
#
# dword bound, index 2 - instruction filtering flags

View file

@ -495,9 +495,7 @@ sub format_insn($$$$$) {
$nd = 1 if $flags =~ /(^|\,)ND($|\,)/;
$flags =~ s/(^|\,)ND($|\,)/\1/g;
$flags =~ s/(^|\,)X64($|\,)/\1LONG,X86_64\2/g;
$flags =~ s/(^|\,)AVX512CD($|\,)/\1AVX512CD,AVX512\2/g;
$flags =~ s/(^|\,)AVX512ER($|\,)/\1AVX512ER,AVX512\2/g;
$flags =~ s/(^|\,)AVX512PF($|\,)/\1AVX512PF,AVX512\2/g;
$flags .= ",EVEX" if ($codes =~ /evex\./);
$rawflags = $flags;
$flagsindex = insns_flag_index(split(',',$flags));