Ver Fonte

* Fixed memory reference size for MOVSS instruction, Mantis #29954.

git-svn-id: trunk@34943 -
sergei há 8 anos atrás
pai
commit
ebe134febc

+ 1 - 0
.gitattributes

@@ -15200,6 +15200,7 @@ tests/webtbs/tw29912.pp svneol=native#text/plain
 tests/webtbs/tw29923.pp svneol=native#text/plain
 tests/webtbs/tw29930.pp svneol=native#text/plain
 tests/webtbs/tw29933.pp svneol=native#text/plain
+tests/webtbs/tw29954.pp svneol=native#text/pascal
 tests/webtbs/tw29957.pp svneol=native#text/pascal
 tests/webtbs/tw29958.pp svneol=native#text/pascal
 tests/webtbs/tw29964.pp svneol=native#text/plain

+ 1 - 1
compiler/i386/i386nop.inc

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

+ 16 - 2
compiler/i386/i386tab.inc

@@ -6324,14 +6324,28 @@
   (
     opcode  : A_MOVSS;
     ops     : 2;
-    optypes : (ot_xmmreg,ot_xmmrm,ot_none,ot_none);
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none,ot_none);
     code    : #219#2#15#16#72;
     flags   : if_katmai or if_sse
   ),
   (
     opcode  : A_MOVSS;
     ops     : 2;
-    optypes : (ot_xmmrm,ot_xmmreg,ot_none,ot_none);
+    optypes : (ot_xmmreg,ot_memory or ot_bits32,ot_none,ot_none);
+    code    : #219#2#15#16#72;
+    flags   : if_katmai or if_sse
+  ),
+  (
+    opcode  : A_MOVSS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none,ot_none);
+    code    : #219#2#15#17#65;
+    flags   : if_katmai or if_sse
+  ),
+  (
+    opcode  : A_MOVSS;
+    ops     : 2;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_none,ot_none);
     code    : #219#2#15#17#65;
     flags   : if_katmai or if_sse
   ),

+ 1 - 1
compiler/i8086/i8086nop.inc

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

+ 16 - 2
compiler/i8086/i8086tab.inc

@@ -6352,14 +6352,28 @@
   (
     opcode  : A_MOVSS;
     ops     : 2;
-    optypes : (ot_xmmreg,ot_xmmrm,ot_none,ot_none);
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none,ot_none);
     code    : #219#2#15#16#72;
     flags   : if_katmai or if_sse
   ),
   (
     opcode  : A_MOVSS;
     ops     : 2;
-    optypes : (ot_xmmrm,ot_xmmreg,ot_none,ot_none);
+    optypes : (ot_xmmreg,ot_memory or ot_bits32,ot_none,ot_none);
+    code    : #219#2#15#16#72;
+    flags   : if_katmai or if_sse
+  ),
+  (
+    opcode  : A_MOVSS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none,ot_none);
+    code    : #219#2#15#17#65;
+    flags   : if_katmai or if_sse
+  ),
+  (
+    opcode  : A_MOVSS;
+    ops     : 2;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_none,ot_none);
     code    : #219#2#15#17#65;
     flags   : if_katmai or if_sse
   ),

+ 4 - 4
compiler/x86/aasmcpu.pas

@@ -3622,9 +3622,9 @@ implementation
             else
               case getsubreg(r) of
                 R_SUBMMD:
-                  result:=taicpu.op_ref_reg(A_MOVSD,reg2opsize(r),tmpref,r);
+                  result:=taicpu.op_ref_reg(A_MOVSD,S_NO,tmpref,r);
                 R_SUBMMS:
-                  result:=taicpu.op_ref_reg(A_MOVSS,reg2opsize(r),tmpref,r);
+                  result:=taicpu.op_ref_reg(A_MOVSS,S_NO,tmpref,r);
                 R_SUBQ,
                 R_SUBMMWHOLE:
                   result:=taicpu.op_ref_reg(A_MOVQ,S_NO,tmpref,r);
@@ -3680,9 +3680,9 @@ implementation
             else
               case getsubreg(r) of
                 R_SUBMMD:
-                  result:=taicpu.op_reg_ref(A_MOVSD,reg2opsize(r),r,tmpref);
+                  result:=taicpu.op_reg_ref(A_MOVSD,S_NO,r,tmpref);
                 R_SUBMMS:
-                  result:=taicpu.op_reg_ref(A_MOVSS,reg2opsize(r),r,tmpref);
+                  result:=taicpu.op_reg_ref(A_MOVSS,S_NO,r,tmpref);
                 R_SUBQ,
                 R_SUBMMWHOLE:
                   result:=taicpu.op_reg_ref(A_MOVQ,S_NO,r,tmpref);

+ 4 - 2
compiler/x86/x86ins.dat

@@ -2305,8 +2305,10 @@ mem,xmmreg            \2\x0F\x2B\101                  KATMAI,SSE
 
 [MOVSS]
 (Ch_Wop2, Ch_Rop1, Ch_None)
-xmmreg,xmmrm          \333\2\x0F\x10\110              KATMAI,SSE
-xmmrm,xmmreg          \333\2\x0F\x11\101              KATMAI,SSE
+xmmreg,xmmreg         \333\2\x0F\x10\110              KATMAI,SSE
+xmmreg,mem32          \333\2\x0F\x10\110              KATMAI,SSE
+xmmreg,xmmreg         \333\2\x0F\x11\101              KATMAI,SSE
+mem32,xmmreg          \333\2\x0F\x11\101              KATMAI,SSE
 
 [MOVUPS]
 (Ch_All, Ch_None, Ch_None)

+ 1 - 1
compiler/x86_64/x8664nop.inc

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

+ 16 - 2
compiler/x86_64/x8664tab.inc

@@ -6275,14 +6275,28 @@
   (
     opcode  : A_MOVSS;
     ops     : 2;
-    optypes : (ot_xmmreg,ot_xmmrm,ot_none,ot_none);
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none,ot_none);
     code    : #219#2#15#16#72;
     flags   : if_katmai or if_sse
   ),
   (
     opcode  : A_MOVSS;
     ops     : 2;
-    optypes : (ot_xmmrm,ot_xmmreg,ot_none,ot_none);
+    optypes : (ot_xmmreg,ot_memory or ot_bits32,ot_none,ot_none);
+    code    : #219#2#15#16#72;
+    flags   : if_katmai or if_sse
+  ),
+  (
+    opcode  : A_MOVSS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none,ot_none);
+    code    : #219#2#15#17#65;
+    flags   : if_katmai or if_sse
+  ),
+  (
+    opcode  : A_MOVSS;
+    ops     : 2;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_none,ot_none);
     code    : #219#2#15#17#65;
     flags   : if_katmai or if_sse
   ),

+ 33 - 0
tests/webtbs/tw29954.pp

@@ -0,0 +1,33 @@
+{ %cpu=i386,x86_64 }
+{ %opt=-Sew -vw }
+{$mode objfpc}
+{$asmmode intel}
+uses cpu;
+
+type
+   TVector4 = packed record
+     X, Y, Z, W: Single;
+   end;
+
+ function _VectorDotProductSSE4(Vector1, Vector2: TVector4): Single; assembler;
+ asm
+   MOVUPS XMM0, [Vector1]
+   MOVUPS XMM1, [Vector2]
+   DPPS XMM0, XMM1, $71 { Only perform calculations on the X, Y and Z coordinates; only store result in the first element }
+   MOVSS Result, XMM0 { Store result - first element of XMM0 }
+ end;
+
+var
+  v: tvector4;
+  r: single;
+begin
+  v.x:=1;
+  v.y:=1;
+  v.z:=1;
+  v.w:=1;
+  r:=_vectordotproductSSE4(v,v);
+  if r<>3 then
+    halt(1);
+  writeln('ok');
+end.
+