Bug 20111 – asm VCVTPS2PH is not encoded correctly
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-08-07T00:52:46Z
Last change time
2020-12-24T07:52:41Z
Keywords
iasm, pull, SIMD
Assigned to
No Owner
Creator
thomas.bockman
Comments
Comment #0 by thomas.bockman — 2019-08-07T00:52:46Z
Compiling and then disassembling this test function shows that DMD does not emit the correct machine code for the VCVTPS2PH instruction. Trying to use this instruction crashes the program. The equivalent program works on LDC and GDC, so this is a back-end problem.
__vector(short[8]) vcvtps2ph(__vector(float[4]) value) {
asm {
naked;
vcvtps2ph XMM0, XMM0, 0; // BAD
ret;
}
}
I believe that this is the correct encoding (copied from LDC output):
__vector(short[8]) vcvtps2ph(__vector(float[4]) value) {
asm {
naked;
db 0xc4, 0xe3, 0x79, 0x1d, 0xc0, 0x00; // OK?
ret;
}
}
The related VCVTPH2PS works - perhaps because it lacks the extra rounding control argument?
extern(C) __vector(float[4]) vcvtph2ps(__vector(short[8]) bin16s) {
asm {
naked;
vcvtph2ps XMM0, XMM0;
ret;
}
}
Comment #1 by dlang-bot — 2020-12-24T07:03:44Z
@WalterBright created dlang/dmd pull request #12050 "fix Issue 20111 - asm VCVTPS2PH is not encoded correctly" fixing this issue:
- fix Issue 20111 - asm VCVTPS2PH is not encoded correctly
https://github.com/dlang/dmd/pull/12050
Comment #2 by dlang-bot — 2020-12-24T07:52:41Z
dlang/dmd pull request #12050 "fix Issue 20111 - asm VCVTPS2PH is not encoded correctly" was merged into master:
- 0430255064ecf49fef283d70e9b74f35d63ecfe2 by Walter Bright:
fix Issue 20111 - asm VCVTPS2PH is not encoded correctly
https://github.com/dlang/dmd/pull/12050