Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/BASM    [ Add a report in this area ]  
Report #:  75206   Status: Closed
Incorrect CodeGen for SSSE3 and SSE4 instructions
Project:  Delphi Build #:  12.0.3420.21218
Version:    12.1 Submitted By:   Philipp S
Report Type:  Crash / Data loss / Total failure Date Reported:  6/24/2009 2:13:41 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   270416
Resolution: Fixed (Resolution Comments) Resolved in Build: : 14.0.3467.22472
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 10
Description
The compiler/assembler generates wrong machine code for all SSSE3, all SSE4.1 and some SSE4.2 instructions (all except POPCNT) when these instructions are used with certain register addressing combinations, i.e.

SOMEINSTRUCTION register, [register+register]

SOMEINSTRUCTION register, [register*scale]

SOMEINSTRUCTION register, [register+register*scale]

(E.g., try the combinations "[ECX+ESI]" or "[ECX*4]").

As far as I can see, the instructions affected are:

PMOVZX.., PMOVSX.., ROUND.., DPPS/DPPD,  PMULDQ.., PMULLD.., EXTRACTPS, INSERTPS, BLENDV.., PMIN.., PMAX.., MPSADBW.., PHMINPOSUW, PTEST, PCMPEQQ, PACKUSDW, CRC32, PCMPGTQ, PCmpXStrX, PALIGNR, PHADD..., PABS..., PMADDUBSW, PMULHRSW, PSHUFB, and  PSIGN...


This is apparently related to QC report 73742 for PMOVZXBW (which I can't access).

See also:
https://forums.embarcadero.com/thread.jspa?threadID=19508&tstart=0
and
https://forums.embarcadero.com/thread.jspa?threadID=16359&tstart=15


Steps to Reproduce:
Example:

asm
ret //Put a breakpoint here and inspect disassembly/machine code
  pshufb xmm0,  [ecx+esi]   //WRONG
  nop; nop; nop; nop; nop; nop;
  pshufb xmm0,  [esi+ecx*4]  //WRONG
  nop; nop; nop; nop; nop; nop;
  pshufb xmm0,  [ecx*4]  //WRONG
  nop; nop; nop; nop; nop; nop;
end;

Please have a look at the attached source code file, which includes similar cases for all affected SSSE3, SSE4.1 and SSE4.2 instructions that I found.

Workarounds
None
Attachment
75206.zip
Comments

None

Server Response from: ETNACODE01