]> granicus.if.org Git - yasm/commitdiff
Don't do REG_E?AX combining with reg8/reg8x instructions, to allow things like
authorPeter Johnson <peter@tortall.net>
Tue, 20 Nov 2001 21:02:17 +0000 (21:02 -0000)
committerPeter Johnson <peter@tortall.net>
Tue, 20 Nov 2001 21:02:17 +0000 (21:02 -0000)
"ADD AX, byte 8" to generate the same code as NASM does (OT: this doesn't save
any space because the reg8x form needs a ModRM, but if it's what the user
wants, do it).

svn path=/trunk/yasm/; revision=353

modules/parsers/nasm/gen_instr.pl
src/parsers/nasm/gen_instr.pl

index 464807718e2a2678febdc30640c144890677f186..26108c3134aeb23c5207d2cde2128906365c2758 100755 (executable)
@@ -749,14 +749,14 @@ sub output_yacc ($@)
 
                            print GRAMMAR cond_action ($rule, $tokens, $count++, $regarg, 0, $func, $AL->[3], \@args);
                        }
-                       elsif ($AX and ($inst->[OPERANDS]||"") =~ m/reg16,imm/)
+                       elsif ($AX and ($inst->[OPERANDS]||"") =~ m/reg16,imm(16|16x)?$/)
                        {
                            $AX->[4] = 1;
                            my $regarg = get_token_number ($tokens, "reg16");
 
                            print GRAMMAR cond_action ($rule, $tokens, $count++, $regarg, 0, $func, $AX->[3], \@args);
                        }
-                       elsif ($EAX and ($inst->[OPERANDS]||"") =~ m/reg32,imm/)
+                       elsif ($EAX and ($inst->[OPERANDS]||"") =~ m/reg32,imm(32|32x)?$/)
                        {
                            $EAX->[4] = 1;
                            my $regarg = get_token_number ($tokens, "reg32");
index 464807718e2a2678febdc30640c144890677f186..26108c3134aeb23c5207d2cde2128906365c2758 100755 (executable)
@@ -749,14 +749,14 @@ sub output_yacc ($@)
 
                            print GRAMMAR cond_action ($rule, $tokens, $count++, $regarg, 0, $func, $AL->[3], \@args);
                        }
-                       elsif ($AX and ($inst->[OPERANDS]||"") =~ m/reg16,imm/)
+                       elsif ($AX and ($inst->[OPERANDS]||"") =~ m/reg16,imm(16|16x)?$/)
                        {
                            $AX->[4] = 1;
                            my $regarg = get_token_number ($tokens, "reg16");
 
                            print GRAMMAR cond_action ($rule, $tokens, $count++, $regarg, 0, $func, $AX->[3], \@args);
                        }
-                       elsif ($EAX and ($inst->[OPERANDS]||"") =~ m/reg32,imm/)
+                       elsif ($EAX and ($inst->[OPERANDS]||"") =~ m/reg32,imm(32|32x)?$/)
                        {
                            $EAX->[4] = 1;
                            my $regarg = get_token_number ($tokens, "reg32");