Bug 9304 – Unary minus operator doesn't work correctly with SIMD types.

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-12T11:01:00Z
Last change time
2013-01-15T13:51:34Z
Assigned to
nobody
Creator
jerro.public

Comments

Comment #0 by jerro.public — 2013-01-12T11:01:38Z
The following code does not work correctly when compiled with DMD 2.061 with -O flag: import std.stdio; import core.simd; // alias float4 T; // internal compiler error alias int4 T; // wrong result T foo(T a) { return -a; } void main() { auto a = foo([0, 1, 2, 3]); writeln(a.array); } If T is float4, I get internal compiler error: Internal error: ../ztc/cgxmm.c 57 If T is int4, the code compiles, but prints this when I run it (the first number is different each time, the other three stay the same): [-1111986510, 32712, 0, 0] If I don't use -O flag, the code compiles and works correctly for both int4 and float4.
Comment #1 by github-bugzilla — 2013-01-15T03:07:27Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ecb14d78cdd04813382676e9ff10e3c43c5bdb63 fix Issue 9304 - Unary minus operator doesn't work correctly with SIMD types.
Comment #2 by bugzilla — 2013-01-15T13:48:14Z
Comment #3 by github-bugzilla — 2013-01-15T13:49:52Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/d6eaab75bead8f17e4b045add7c4b5bd1bc91365 fix Issue 9304 - Unary minus operator doesn't work correctly with SIMD types. https://github.com/D-Programming-Language/dmd/commit/065f9861652a510c9afc0747c3f066927934e1e9 Merge pull request #1488 from WalterBright/b10 fix Issue 9304 - Unary minus operator doesn't work correctly with SIMD t...