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.
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
@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
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