Ver Fonte

+ support for RDTSCP, resolves issue #28916

git-svn-id: trunk@32652 -
florian há 9 anos atrás
pai
commit
a3964d9ee0

+ 1 - 0
.gitattributes

@@ -14875,6 +14875,7 @@ tests/webtbs/tw2885.pp svneol=native#text/plain
 tests/webtbs/tw28850.pp svneol=native#text/plain
 tests/webtbs/tw2886.pp svneol=native#text/plain
 tests/webtbs/tw2891.pp svneol=native#text/plain
+tests/webtbs/tw28916.pp svneol=native#text/pascal
 tests/webtbs/tw2892.pp svneol=native#text/plain
 tests/webtbs/tw28934.pp svneol=native#text/plain
 tests/webtbs/tw28964.pp svneol=native#text/plain

+ 1 - 0
compiler/i386/i386att.inc

@@ -670,6 +670,7 @@
 'aesdeclast',
 'aesimc',
 'aeskeygenassist',
+'rdtscp',
 'vaddpd',
 'vaddps',
 'vaddsd',

+ 1 - 0
compiler/i386/i386atts.inc

@@ -701,6 +701,7 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufNONE,
 attsufMM,
 attsufMM,
 attsufNONE,

+ 1 - 0
compiler/i386/i386int.inc

@@ -670,6 +670,7 @@
 'aesdeclast',
 'aesimc',
 'aeskeygenassist',
+'rdtscp',
 'vaddpd',
 'vaddps',
 'vaddsd',

+ 1 - 1
compiler/i386/i386nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-1942;
+1943;

+ 1 - 0
compiler/i386/i386op.inc

@@ -670,6 +670,7 @@ A_AESDEC,
 A_AESDECLAST,
 A_AESIMC,
 A_AESKEYGENASSIST,
+A_RDTSCP,
 A_VADDPD,
 A_VADDPS,
 A_VADDSD,

+ 1 - 0
compiler/i386/i386prop.inc

@@ -670,6 +670,7 @@
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_WEAX, Ch_WEDX, Ch_None)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),

+ 7 - 0
compiler/i386/i386tab.inc

@@ -8449,6 +8449,13 @@
     code    : #241#3#15#58#223#72#22;
     flags   : if_sse4 or if_sb or if_ar2
   ),
+  (
+    opcode  : A_RDTSCP;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #3#15#1#249;
+    flags   : if_sse4 or if_sm
+  ),
   (
     opcode  : A_VADDPD;
     ops     : 3;

+ 1 - 0
compiler/i8086/i8086att.inc

@@ -670,6 +670,7 @@
 'aesdeclast',
 'aesimc',
 'aeskeygenassist',
+'rdtscp',
 'vaddpd',
 'vaddps',
 'vaddsd',

+ 1 - 0
compiler/i8086/i8086atts.inc

@@ -701,6 +701,7 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufNONE,
 attsufMM,
 attsufMM,
 attsufNONE,

+ 1 - 0
compiler/i8086/i8086int.inc

@@ -670,6 +670,7 @@
 'aesdeclast',
 'aesimc',
 'aeskeygenassist',
+'rdtscp',
 'vaddpd',
 'vaddps',
 'vaddsd',

+ 1 - 1
compiler/i8086/i8086nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-1972;
+1973;

+ 1 - 0
compiler/i8086/i8086op.inc

@@ -670,6 +670,7 @@ A_AESDEC,
 A_AESDECLAST,
 A_AESIMC,
 A_AESKEYGENASSIST,
+A_RDTSCP,
 A_VADDPD,
 A_VADDPS,
 A_VADDSD,

+ 1 - 0
compiler/i8086/i8086prop.inc

@@ -670,6 +670,7 @@
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_WEAX, Ch_WEDX, Ch_None)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),

+ 7 - 0
compiler/i8086/i8086tab.inc

@@ -8463,6 +8463,13 @@
     code    : #241#3#15#58#223#72#22;
     flags   : if_sse4 or if_sb or if_ar2
   ),
+  (
+    opcode  : A_RDTSCP;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #3#15#1#249;
+    flags   : if_sse4 or if_sm
+  ),
   (
     opcode  : A_VADDPD;
     ops     : 3;

+ 8 - 0
compiler/x86/x86ins.dat

@@ -3433,6 +3433,14 @@ xmmreg,xmmrm          \361\3\x0F\x38\xDB\110               SSE4,SM
 (Ch_All, Ch_None, Ch_None)
 xmmreg,xmmrm,imm      \361\3\x0F\x3A\xDF\110\26            SSE4,SB,AR2
 
+;*******************************************************************************
+;*******************************************************************************
+;*******************************************************************************
+;Use SSE4, but actually a special flag would be needed
+[RDTSCP]
+(Ch_WEAX, Ch_WEDX, Ch_None)
+void                  \3\x0F\x01\xf9                       SSE4,SM
+
 ;*******************************************************************************
 ;*******************************************************************************
 ;*******************************************************************************

+ 1 - 0
compiler/x86_64/x8664ats.inc

@@ -695,6 +695,7 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufNONE,
 attsufMM,
 attsufMM,
 attsufNONE,

+ 1 - 0
compiler/x86_64/x8664att.inc

@@ -661,6 +661,7 @@
 'aesdeclast',
 'aesimc',
 'aeskeygenassist',
+'rdtscp',
 'stosq',
 'lodsq',
 'cmpsq',

+ 1 - 0
compiler/x86_64/x8664int.inc

@@ -661,6 +661,7 @@
 'aesdeclast',
 'aesimc',
 'aeskeygenassist',
+'rdtscp',
 'stosq',
 'lodsq',
 'cmpsq',

+ 1 - 1
compiler/x86_64/x8664nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-1963;
+1964;

+ 1 - 0
compiler/x86_64/x8664op.inc

@@ -661,6 +661,7 @@ A_AESDEC,
 A_AESDECLAST,
 A_AESIMC,
 A_AESKEYGENASSIST,
+A_RDTSCP,
 A_STOSQ,
 A_LODSQ,
 A_CMPSQ,

+ 1 - 0
compiler/x86_64/x8664pro.inc

@@ -661,6 +661,7 @@
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_WEAX, Ch_WEDX, Ch_None)),
 (Ch: (Ch_RRAX, Ch_WMemEDI, Ch_RWRDI)),
 (Ch: (Ch_WRAX, Ch_RWRSI, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),

+ 7 - 0
compiler/x86_64/x8664tab.inc

@@ -8533,6 +8533,13 @@
     code    : #241#3#15#58#223#72#22;
     flags   : if_sse4 or if_sb or if_ar2
   ),
+  (
+    opcode  : A_RDTSCP;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #3#15#1#249;
+    flags   : if_sse4 or if_sm
+  ),
   (
     opcode  : A_STOSQ;
     ops     : 0;

+ 16 - 0
tests/webtbs/tw28916.pp

@@ -0,0 +1,16 @@
+{ %cpu=i386,x86_64 }
+program Project1;
+
+{$mode delphi}
+{$asmmode intel}
+
+function RDTSCP: Int64; assembler;
+asm
+  RDTSCP
+end;
+
+begin
+  if (PByte(@RDTSCP)[0]<>$0f) or (PByte(@RDTSCP)[1]<>$01) or (PByte(@RDTSCP)[2]<>$f9) then
+    halt(1);
+  writeln('ok');
+end.