insns.pl: error if we have a 'v' operand and no vex.nds/ndd

Although redundant, the presence of a 'v' operand should match the
existence of a nds or ndd flag on vex; this should help catch typos.
This commit is contained in:
H. Peter Anvin 2008-05-21 18:09:17 -07:00
parent a69ce1d19d
commit 2637aca805

View File

@ -599,6 +599,7 @@ sub byte_code_compile($) {
$prefix_ok = 0;
} elsif ($op =~ /^vex(|\..*)$/) {
my ($m,$w,$l,$p) = (undef,2,undef,0);
my $has_nds = 0;
foreach $oq (split(/\./, $op)) {
if ($oq eq 'vex') {
# prefix
@ -628,6 +629,7 @@ sub byte_code_compile($) {
if (!defined($oppos{'v'})) {
die "$0: $line: vex.$oq without 'v' operand\n";
}
$has_nds = 1;
} else {
die "$0: $line: undefined VEX subcode: $oq\n";
}
@ -635,6 +637,9 @@ sub byte_code_compile($) {
if (!defined($m) || !defined($w) || !defined($l) || !defined($p)) {
die "$0: $line: missing fields in VEX specification\n";
}
if (defined($oppos{'v'}) && !$has_nds) {
die "$0: $line: 'v' operand without vex.nds or vex.ndd\n";
}
push(@codes, defined($oppos{'v'}) ? 0260+$oppos{'v'} : 0270,
$m, ($w << 3)+($l << 2)+$p);
$prefix_ok = 0;