www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22656] New: SSE2 instructions have inconsistent layouts in

https://issues.dlang.org/show_bug.cgi?id=22656

          Issue ID: 22656
           Summary: SSE2 instructions have inconsistent layouts in the
                    disassembler output
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: backend
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxhaton gmail.com

I have listed this as SSE2 instructions however there may be more affected (it
could be the prefix in general rather than these particular instructions).

```
extern(C)
void blah()
{
    asm {
        naked;
        xor EAX, EAX;
        jmp [RIP];
        cvttpd2dq XMM0, XMM1;
        movq [RAX], XMM0;
    }
}
```
Yields
```
blah:
0000:   31 C0                   xor     EAX,EAX
0002:   48 FF 25 00 00 00 00    jmp     qword ptr [00h][RIP]
0009:66         0F E6 C1                cvttpd2dq       XMM0,XMM1
000d:66         0F D6 00                movq    [RAX],XMM0
```

The latter two instructions are not displayed properly.

From llvm's objdump we get:
``` 0000000000000000 blah: 0: 31 c0 xor eax, eax 2: 48 ff 25 00 00 00 00 jmp qword ptr [rip] 9: 66 0f e6 c1 cvttpd2dq xmm0, xmm1 d: 66 0f d6 00 movq qword ptr [rax], xmm0 11: 00 00 add byte ptr [rax], al 13: 00 <unknown> ```
From GNU:
``` 0000000000000000 <blah>: 0: 31 c0 xor eax,eax <blah+0x9> 9: 66 0f e6 c1 cvttpd2dq xmm0,xmm1 d: 66 0f d6 00 movq QWORD PTR [rax],xmm0 11: 00 00 add BYTE PTR [rax],al ``` --
Jan 07 2022