D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 21490 - Optimizer can add SSE integer multiply for machines less than SSE4.1 which do not have it
Summary: Optimizer can add SSE integer multiply for machines less than SSE4.1 which do...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 normal
Assignee: No Owner
URL:
Keywords: pull, SIMD
Depends on:
Blocks:
 
Reported: 2020-12-19 10:08 UTC by Walter Bright
Modified: 2020-12-20 10:55 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2020-12-19 10:08:52 UTC
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 Walter Bright 2020-12-20 08:12:35 UTC
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 Dlang Bot 2020-12-20 08:17:47 UTC
@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 Dlang Bot 2020-12-20 10:55:20 UTC
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