From 2637aca8053d50e5976994140646e270312c4399 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 21 May 2008 18:09:17 -0700 Subject: [PATCH] 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. --- insns.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/insns.pl b/insns.pl index af494101..7d667786 100644 --- a/insns.pl +++ b/insns.pl @@ -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;