Просмотр исходного кода

* unpcklp* require aligned memory, so do not spill replace their first operand by a memory location, resolves #31332

git-svn-id: trunk@35400 -
florian 8 лет назад
Родитель
Сommit
41b028ffc0
3 измененных файлов с 45 добавлено и 2 удалено
  1. 1 0
      .gitattributes
  2. 4 2
      compiler/x86/rgx86.pas
  3. 40 0
      tests/webtbs/tw31332.pp

+ 1 - 0
.gitattributes

@@ -15364,6 +15364,7 @@ tests/webtbs/tw31201.pp svneol=native#text/pascal
 tests/webtbs/tw3124.pp svneol=native#text/plain
 tests/webtbs/tw31305.pp svneol=native#text/pascal
 tests/webtbs/tw3131.pp svneol=native#text/plain
+tests/webtbs/tw31332.pp svneol=native#text/pascal
 tests/webtbs/tw3137.pp svneol=native#text/plain
 tests/webtbs/tw3143.pp svneol=native#text/plain
 tests/webtbs/tw3144.pp svneol=native#text/plain

+ 4 - 2
compiler/x86/rgx86.pas

@@ -274,10 +274,12 @@ implementation
                               A_BTC,
                               A_BTR,
 
-                              { shufp* would require 16 byte alignment for memory locations so we force the source
+                              { shufp*/unpcklp* would require 16 byte alignment for memory locations so we force the source
                                 operand into a register }
                               A_SHUFPD,
-                              A_SHUFPS :
+                              A_SHUFPS,
+                              A_UNPCKLPD,
+                              A_UNPCKLPS :
                                 replaceoper:=-1;
                             end;
                           end;

+ 40 - 0
tests/webtbs/tw31332.pp

@@ -0,0 +1,40 @@
+{ %CPU=i388,x86_64 }
+{$OPTIMIZATION ON}
+{$FPUTYPE SSE3}
+
+uses
+  cpu;
+
+var  map    : array [0..63,0..63,0..63] of smallint;
+
+procedure makeMap( ) ;
+var x,y,z,i : longword;
+    yd,zd,th : single;
+    begin
+    // add random blocks to the map
+    for x := 0 to 63 do begin
+        for y := 0 to 63 do begin
+             for z := 0 to 63 do begin
+               yd := (y - 32.5) * 0.4;
+               zd := (z - 32.5) * 0.4;
+               map[z,y,x] := random( 16 );
+               th := random;
+              if th > sqrt( sqrt( yd * yd + zd * zd ) ) - 0.8 then
+                 map[z,y,x] := 0;
+              end;
+        end;
+    end;
+end;
+
+procedure init( );
+begin
+  makeMap( );
+end;
+
+
+begin
+ if is_sse3_cpu then
+   init ();
+end.
+
+