Bug 21672 – [REG][ICE][SIMD] accessing SIMD type as a short causes compiler ice

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2021-03-01T23:39:50Z
Last change time
2021-03-23T11:22:52Z
Keywords
backend, pull, SIMD
Assigned to
No Owner
Creator
ponce

Comments

Comment #0 by aliloko — 2021-03-01T23:39:50Z
# Repro case This fails with DMD 2.096-b1 and -O in x86_64 ------------- repro.d ------------------ import core.simd; int4 _mm_loadu_si16(const(void)* mem_addr) pure @trusted { int r = *cast(short*)(mem_addr); short8 result = [0, 0, 0, 0, 0, 0, 0, 0]; result.ptr[0] = cast(short)r; return cast(int4)result; } ---------------------------------------- Works in 2.095.1 though. # Output tym = 0x6 dmd failed with exit code -1073741795. In Godbolt: https://d.godbolt.org/z/vx1j3r
Comment #1 by code — 2021-03-05T20:56:36Z
Thanks for your bug report, apparently never worked, not even with 2.081.1. That at lest says Internal error: dmd/backend/cgxmm.c 684 pointing to https://github.com/dlang/dmd/blob/343ebe868baa60ad39dd1e9d2d94177af3743e95/src/dmd/backend/cgxmm.d#L753 Looks like the load type isn't supported and you could bet that TYshort is 6. https://github.com/dlang/dmd/blob/7a0382177f35b2766c2d0ba60dae5e541d8033e0/src/dmd/backend/ty.d#L39 Would you have any chance to avoid modifying the "array" in between, from what I remember of the backend it was often only working when constructing simd values from literals. Could you maybe also try to manipulate a static short[8] array and load that, no?
Comment #2 by aliloko — 2021-03-05T23:44:59Z
> Would you have any chance to avoid modifying the "array" in between, from what I remember of the backend it was often only working when constructing simd values from literals. Could you maybe also try to manipulate a static short[8] array and load that, no? Sorry I don't understand what you mean. I'm not really looking for a workaround.
Comment #3 by dlang-bot — 2021-03-23T05:46:51Z
@WalterBright created dlang/dmd pull request #12297 "fix Issue 21672 - [REG][ICE][SIMD] accessing SIMD type as a short cau…" fixing this issue: - fix Issue 21672 - [REG][ICE][SIMD] accessing SIMD type as a short causes compiler ice https://github.com/dlang/dmd/pull/12297
Comment #4 by dlang-bot — 2021-03-23T11:22:52Z
dlang/dmd pull request #12297 "fix Issue 21672 - [REG][ICE][SIMD] accessing SIMD type as a short cau…" was merged into master: - 1ab1d61186f2a17d2854b3b9e9fef28b0e4ae2eb by Walter Bright: fix Issue 21672 - [REG][ICE][SIMD] accessing SIMD type as a short causes compiler ice https://github.com/dlang/dmd/pull/12297