Browse Source

Instruction match tests supported register numbers. Thx to VMPSADBW.

Margers 2 months ago
parent
commit
1a5ca1e4bb
1 changed files with 17 additions and 0 deletions
  1. 17 0
      compiler/x86/aasmcpu.pas

+ 17 - 0
compiler/x86/aasmcpu.pas

@@ -1758,6 +1758,7 @@ implementation
         i,j,asize,oprs : longint;
         i,j,asize,oprs : longint;
         insflags:tinsflags;
         insflags:tinsflags;
         vopext: int64;
         vopext: int64;
+        EvexRegs :boolean;
         siz : array[0..max_operands-1] of longint;
         siz : array[0..max_operands-1] of longint;
       begin
       begin
         result:=false;
         result:=false;
@@ -1777,11 +1778,16 @@ implementation
           exit;
           exit;
 {$endif i8086}
 {$endif i8086}
 
 
+        EvexRegs:=false;
         for i:=0 to p^.ops-1 do
         for i:=0 to p^.ops-1 do
          begin
          begin
            insot:=p^.optypes[i];
            insot:=p^.optypes[i];
            currot:=oper[i]^.ot;
            currot:=oper[i]^.ot;
 
 
+           if (oper[i]^.typ=top_reg) and
+              (getregtype(oper[i]^.reg) = R_MMREGISTER) then
+            if getsupreg(oper[i]^.reg) and $10 = $10 then
+              EvexRegs:=true;
            { Check the operand flags }
            { Check the operand flags }
            if (insot and (not currot) and OT_NON_SIZE)<>0 then
            if (insot and (not currot) and OT_NON_SIZE)<>0 then
              exit;
              exit;
@@ -1801,6 +1807,17 @@ implementation
              exit;
              exit;
          end;
          end;
 
 
+        { Chack Evex support in encoding }
+        if EvexRegs then
+        begin
+          for i:=0 to  maxinfolen do
+          begin
+            if byte(p^.code[i]) = &350 then break;
+            if byte(p^.code[i]) = 0 then break;
+          end;
+          if byte(p^.code[i]) <> &350 then exit;
+        end;
+
         { Check operand sizes }
         { Check operand sizes }
         insflags:=p^.flags;
         insflags:=p^.flags;
         if (insflags*IF_SMASK)<>[] then
         if (insflags*IF_SMASK)<>[] then