From 41b028ffc087a408a809608eaec7ce2d0ea41058 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 5 Feb 2017 20:59:54 +0000 Subject: [PATCH] * unpcklp* require aligned memory, so do not spill replace their first operand by a memory location, resolves #31332 git-svn-id: trunk@35400 - --- .gitattributes | 1 + compiler/x86/rgx86.pas | 6 ++++-- tests/webtbs/tw31332.pp | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 tests/webtbs/tw31332.pp diff --git a/.gitattributes b/.gitattributes index 5dcffc31d5..199e694062 100644 --- a/.gitattributes +++ b/.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 diff --git a/compiler/x86/rgx86.pas b/compiler/x86/rgx86.pas index cc91fdba3c..b47ee8df8a 100644 --- a/compiler/x86/rgx86.pas +++ b/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; diff --git a/tests/webtbs/tw31332.pp b/tests/webtbs/tw31332.pp new file mode 100644 index 0000000000..8ee2c2eaa8 --- /dev/null +++ b/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. + +