Bläddra i källkod

+ x86 instruction tables for x86-64 extended

florian 21 år sedan
förälder
incheckning
541955ad91

+ 4 - 2
compiler/powerpc/cpupara.pas

@@ -331,7 +331,6 @@ unit cpupara;
                            inc(nextintreg);
                            if target_info.abi=abi_powerpc_aix then
                              inc(stack_offset,4);
-
                         end
                       else
                          begin
@@ -443,7 +442,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.55  2003-12-28 22:09:12  florian
+  Revision 1.56  2004-01-15 14:01:18  florian
+    + x86 instruction tables for x86-64 extended
+
+  Revision 1.55  2003/12/28 22:09:12  florian
     + setting of bit 6 of cr for c var args on ppc implemented
 
   Revision 1.54  2003/12/28 15:33:06  jonas

+ 34 - 12
compiler/utils/mkx86ins.pp

@@ -16,11 +16,12 @@
 program mkx86ins;
 
 const
-  Version = '1.00';
+  Version = '1.5.0';
 
 var
    s : string;
    i : longint;
+   x86_64 : boolean;
 
 {$ifndef FPC}
   procedure readln(var t:text;var s:string);
@@ -217,21 +218,36 @@ var
    optypes : array[1..3] of string;
 begin
    writeln('Nasm Instruction Table Converter Version ',Version);
+   x86_64:=paramstr(1)='x86_64';
    insns:=0;
    maxinfolen:=0;
    { open dat file }
    assign(infile,'..\x86\x86ins.dat');
-   reset(infile);
-   { create inc files }
-   openinc(insfile,'i386tab.inc');
-   openinc(opfile,'i386op.inc');
-   assign(nopfile,'i386nop.inc');
+   if x86_64 then
+     begin
+       { create inc files }
+       openinc(insfile,'x8664tab.inc');
+       openinc(opfile,'x8664op.inc');
+       assign(nopfile,'x8664nop.inc');
+       openinc(attfile,'x8664att.inc');
+       openinc(attsuffile,'x8664ats.inc');
+       openinc(intfile,'x8664int.inc');
+       openinc(propfile,'x8664pro.inc');
+     end
+   else
+     begin
+       { create inc files }
+       openinc(insfile,'i386tab.inc');
+       openinc(opfile,'i386op.inc');
+       assign(nopfile,'i386nop.inc');
+       openinc(attfile,'i386att.inc');
+       openinc(attsuffile,'i386atts.inc');
+       openinc(intfile,'i386int.inc');
+       openinc(propfile,'i386prop.inc');
+     end;
    rewrite(nopfile);
    writeln(nopfile,'{ don''t edit, this file is generated from x86ins.dat }');
-   openinc(attfile,'i386att.inc');
-   openinc(attsuffile,'i386atts.inc');
-   openinc(intfile,'i386int.inc');
-   openinc(propfile,'i386prop.inc');
+   reset(infile);
    first:=true;
    opcode:='';
    firstopcode:=true;
@@ -241,6 +257,8 @@ begin
         readln(infile,s);
         while (s[1]=' ') do
          delete(s,1,1);
+        if (s=';!!!x86_64') and not(x86_64) then
+          break;
         if (s='') or (s[1]=';') then
           continue;
         if (s[1]='[') then
@@ -386,7 +404,8 @@ begin
         while not(s[i] in [' ',#9,#13,#10]) and (i<=length(s)) do
           begin
              hs:=readstr;
-             if hs='ignore' then
+             if (hs='ignore') or
+               ((upcase(hs)='X86_64') and not(x86_64)) then
               begin
                 flags:='0';
                 break;
@@ -429,7 +448,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.3  2003-09-09 12:54:45  florian
+  Revision 1.4  2004-01-15 14:01:32  florian
+    + x86 instruction tables for x86-64 extended
+
+  Revision 1.3  2003/09/09 12:54:45  florian
     * x86 instruction table updated to nasm 0.98.37:
         - sse3 aka prescott support
         - small fixes

+ 7 - 4
compiler/x86/aasmcpu.pas

@@ -125,7 +125,7 @@ interface
 
       { Size of the instruction table converted by nasmconv.pas }
 {$ifdef x86_64}
-      instabentries = {$i x86_64no.inc}
+      instabentries = {$i x8664nop.inc}
 {$else x86_64}
       instabentries = {$i i386nop.inc}
 {$endif x86_64}
@@ -282,7 +282,7 @@ implementation
        IF_WILLAMETTE = $08000000;
        { Prescott instructions }
        IF_PRESCOTT = $09000000;
-       IF_ATHLON64 = $0a000000;
+       IF_X86_64 = $0a000000;
        IF_CYRIX  = $10000000;  { Cyrix-specific instruction  }
        IF_AMD    = $20000000;  { AMD-specific instruction  }
        { added flags }
@@ -295,7 +295,7 @@ implementation
 
      const
 {$ifdef x86_64}
-       InsTab:array[0..instabentries-1] of TInsEntry={$i x86_64ta.inc}
+       InsTab:array[0..instabentries-1] of TInsEntry={$i x8664tab.inc}
 {$else x86_64}
        InsTab:array[0..instabentries-1] of TInsEntry={$i i386tab.inc}
 {$endif x86_64}
@@ -1971,7 +1971,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.44  2004-01-12 16:37:59  peter
+  Revision 1.45  2004-01-15 14:01:32  florian
+    + x86 instruction tables for x86-64 extended
+
+  Revision 1.44  2004/01/12 16:37:59  peter
     * moved spilling code from taicpu to rg
 
   Revision 1.43  2003/12/26 14:02:30  peter

+ 5 - 2
compiler/x86/cpubase.pas

@@ -52,7 +52,7 @@ uses
 
     type
 {$ifdef x86_64}
-      TAsmOp={$i x86_64op.inc}
+      TAsmOp={$i x8664op.inc}
 {$else x86_64}
       TAsmOp={$i i386op.inc}
 {$endif x86_64}
@@ -535,7 +535,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.36  2004-01-14 23:39:05  florian
+  Revision 1.37  2004-01-15 14:01:32  florian
+    + x86 instruction tables for x86-64 extended
+
+  Revision 1.36  2004/01/14 23:39:05  florian
     * another bunch of x86-64 fixes mainly calling convention and
       assembler reader related
 

+ 6 - 3
compiler/x86/itcpugas.pas

@@ -35,8 +35,8 @@ interface
     const
 {$ifdef x86_64}
       {x86att.inc contains the name for each x86-64 mnemonic}
-      gas_op2str:op2strtable={$i x64att.inc}
-      gas_needsuffix:array[tasmop] of TAttSuffix={$i x64atts.inc}
+      gas_op2str:op2strtable={$i x8664att.inc}
+      gas_needsuffix:array[tasmop] of TAttSuffix={$i x8664ats.inc}
 {$else x86_64}
       {x86att.inc contains the name for each i386 mnemonic}
       gas_op2str:op2strtable={$i i386att.inc}
@@ -133,7 +133,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.1  2003-11-12 16:05:40  florian
+  Revision 1.2  2004-01-15 14:01:32  florian
+    + x86 instruction tables for x86-64 extended
+
+  Revision 1.1  2003/11/12 16:05:40  florian
     * assembler readers OOPed
     + typed currency constants
     + typed 128 bit float constants if the CPU supports it

+ 25 - 1
compiler/x86/x86ins.dat

@@ -12,6 +12,11 @@
 ; arguments   bytes   flags
 ;
 
+;*****************************************************************************************
+; Insert i386 instructions only above the line ;!!!x86_64 ! x86-64 only instructions go
+; below this line
+;*****************************************************************************************
+
 [NONE]
 (Ch_None, Ch_None, Ch_None)
 void                  void                            none
@@ -3399,9 +3404,28 @@ xmmreg,xmmreg		\3\xF3\x0F\x16\110		PRESCOTT,SSE3
 xmmreg,mem		\301\3\xF3\x0F\x12\110		PRESCOTT,SSE3
 xmmreg,xmmreg           \3\xF3\x0F\x12\110              PRESCOTT,SSE3
 
+;*****************************************************************************************
+; tell the i386 instruction table converter to stop here
+;!!!x86_64
+;
+;
+; x86-64 instructions
+;
+[MOVABS]
+(Ch_Wop2, Ch_Rop1, Ch_None)
+reg32,imm               \321\10\xB8\41                  X86_64
+
+;*****************************************************************************************
+; Insert i386 instructions only above the line ;!!!x86_64 !
+;*****************************************************************************************
+
+
 ;
 ; $Log$
-; Revision 1.6  2003-12-25 12:01:35  florian
+; Revision 1.7  2004-01-15 14:01:32  florian
+;   + x86 instruction tables for x86-64 extended
+;
+; Revision 1.6  2003/12/25 12:01:35  florian
 ;   + possible sse2 unit usage for double calculations
 ;   * some sse2 assembler issues fixed
 ;