Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Debugger/CPU    [ Add a report in this area ]  
Report #:  68693   Status: Closed
SSSE3 Instructions PMULHRSW  is Disassembled Incorrectly
Project:  Delphi Build #:  3210
Version:    12.0 Submitted By:   Dennis Christensen
Report Type:  Minor failure / Design problem Date Reported:  11/7/2008 2:33:12 AM
Severity:    Infrequently encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   266421
Resolution: Fixed (Resolution Comments) Resolved in Build: : 14.0.3367.20128
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
The SSSE3 instruction PMULHRSW is disassembled incorrectly.

Unit1.pas.112: pmulhrsw xmm0, xmm1
660F380BC166 palignr xmm0,xmm1,$66

The Intel reference manual

http://download.intel.com/design/processor/manuals/253667.pdf

p. 4-184

Opcode Instruction 64-Bit
Mode
Compat/
Leg Mode
Description
0F 38 0B /r PMULHRSW
mm1, mm2/m64
Valid Valid Multiply 16-bit signed
words, scale and round
signed doublewords, pack
high 16 bits to MM1.
66 0F 38 0B /r PMULHRSW
xmm1,
xmm2/m128
Valid Valid Multiply 16-bit signed
words, scale and round
signed doublewords, pack
high 16 bits to XMM1.

It looks like the opcode is correct and the bug is in the CPU view disassembler.

The version operating on MMX registers has the same problem

Unit1.pas.115: pmulhrsw mm0, mm1
00465FE8 0F380BC10F palignr xmm0,xmm1,$0f
Steps to Reproduce:
Make a new Win32 Delphi VCL project and add this code.

TWord128 = packed record
I1,I2,I3,I4,I5,I6,I7,I8 : SmallInt;
end;

function SSSE3_PMULHRSW(var Word128a, Word128b : TWord128) : TWord128;
asm
movupd xmm0, [Word128a]
movupd xmm1, [Word128b]
pmulhrsw xmm0, xmm1
movupd [Result], xmm0
end;

procedure TForm1.Button3Click(Sender: TObject);
var
Word128a, Word128b, ResWord128 : TWord128;

begin
Word128a.I1 := 1 shl 8;
Word128a.I2 := 2 shl 8;
Word128a.I3 := 3 shl 8;
Word128a.I4 := 4 shl 8;
Word128a.I5 := 5 shl 8;
Word128a.I6 := 6 shl 8;
Word128a.I7 := 7 shl 8;
Word128a.I8 := 8 shl 8;
Word128b.I1 := 1 shl 8;
Word128b.I2 := 2 shl 8;
Word128b.I3 := 3 shl 8;
Word128b.I4 := 4 shl 8;
Word128b.I5 := 5 shl 8;
Word128b.I6 := 6 shl 8;
Word128b.I7 := 7 shl 8;
Word128b.I8 := 8 shl 8;
ResWord128 := SSSE3_PMULHRSW(Word128a, Word128b);
end;
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01