Bug 21490 – Optimizer can add SSE integer multiply for machines less than SSE4.1 which do not have it
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-12-19T10:08:52Z
Last change time
2020-12-20T10:55:20Z
Keywords
pull, SIMD
Assigned to
No Owner
Creator
Walter Bright
Comments
Comment #0 by bugzilla — 2020-12-19T10:08:52Z
Adding -O to test/runnable/testxmm.d results in a seg fault when testxmm is run because a PMULLD instruction is generated as a result of:
static if (__traits(compiles, { v1 = v2 * v3; })) // SSE4.1
succeeding, yet my 64 bit linux box does not support that instruction. Weirdly, this only goes awry with -O.
Comment #1 by bugzilla — 2020-12-20T08:12:35Z
Test case clipped from dmd/test/runnable/testxmm.d:
-------
import core.simd;
void test2e()
{
int4 v1, v2 = 1, v3 = 1;
v1 = v2 + v3;
static if (__traits(compiles, { v1 = v2 * v3; })) // SSE4.1
v1 = v2 * v3;
}
int main() { test2e(); return 0; }
------
This will seg fault on illegal PMULLD instruction if running on a machine
without SSE4.1
Comment #2 by dlang-bot — 2020-12-20T08:17:47Z
@WalterBright created dlang/dmd pull request #12038 "fix Issue 21490 - Optimizer can add SSE integer multiply for machines…" fixing this issue:
- fix Issue 21490 - Optimizer can add SSE integer multiply for machines less than SSE4.1 which do not have it
https://github.com/dlang/dmd/pull/12038
Comment #3 by dlang-bot — 2020-12-20T10:55:20Z
dlang/dmd pull request #12038 "fix Issue 21490 - Optimizer can add SSE integer multiply for machines…" was merged into master:
- c3a3456f248784e029af056b4d0a383e9c29974a by Walter Bright:
fix Issue 21490 - Optimizer can add SSE integer multiply for machines less than SSE4.1 which do not have it
https://github.com/dlang/dmd/pull/12038