Bytecode compiler: add support for is4/imz2 operands
authorH. Peter Anvin <hpa@zytor.com>
Tue, 20 May 2008 04:07:08 +0000 (21:07 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 20 May 2008 04:07:48 +0000 (21:07 -0700)
insns.pl

index 4f92503..0b5e1a3 100644 (file)
--- a/insns.pl
+++ b/insns.pl
@@ -673,6 +673,19 @@ sub byte_code_compile($) {
                push(@codes, 0250+$oppos{'i'});
            }
            $prefix_ok = 0;
+       } elsif ($op eq 'is4' || $op eq 'imz2') {
+           if (!defined($oppos{'i'} || !defined($oppos{'s'}))) {
+               die "$0: $line: $op without 'i' and 's' operands\n";
+           }
+           push(@codes, 0172, ($oppos{'s'} << 3)+$oppos{'i'});
+       } elsif ($op =~ /^is4=([0-9]+)$/) {
+           if (!defined($oppos{'s'})) {
+               die "$0: $line: $op without 's' operand\n";
+           }
+           if ($1 < 0 || $1 > 15) {
+               die "$0: $line: invalid imm4 value for $op\n";
+           }
+           push(@codes, 0173, ($oppos{'s'} << 4) + $1);
        } elsif ($op =~ /^([0-9a-f]{2})\+s$/) {
            if (!defined($oppos{'i'})) {
                die "$0: $op without 'i' operand\n";