Bug 12852 – 64 bit wrong code generated

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2014-06-04T09:40:00Z
Last change time
2014-06-07T20:54:52Z
Keywords
wrong-code
Assigned to
nobody
Creator
bugzilla

Comments

Comment #0 by bugzilla — 2014-06-04T09:40:48Z
Martin Nowak reports https://github.com/D-Programming-Language/dmd/pull/2561 : Here is a reduced test case for the std.numeric failure. bool normalize(double[] range, double sum = 1) { double s = 0; // Step 1: Compute sum and length of the range const length = range.length; foreach (e; range) { s += e; } // Step 2: perform normalization if (s == 0) { return false; } // The path most traveled return true; } This generate wrong code for s == 0 . It reuses rdx where it previously loaded the content of the xmm register from the stack. You can compare the old (at line 35) and the new (at line 32) dissassembly. If I remove the SFLexit flag from rtlsym.h it works, this seems to have some side-effect on the backend register usage.
Comment #1 by safety0ff.bugz — 2014-06-04T14:59:01Z
IIRC the both my local machine and the auto-tester did not benefit from removing SFLexit flag.
Comment #2 by bugzilla — 2014-06-05T05:41:22Z
Comment #3 by github-bugzilla — 2014-06-07T20:36:45Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/51b46358e1cb68dd113e84a528c6435b60ee5bb7 Issue 12852 - 64 bit wrong code generated https://github.com/D-Programming-Language/dmd/commit/a1304cb4d03e0475ba5b25aa38de302916d538dc Merge pull request #3624 from WalterBright/fix12852 Issue 12852 - 64 bit wrong code generated
Comment #4 by github-bugzilla — 2014-06-07T20:54:52Z
Commits pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8a3131716a213b62587248eba4d481fa6e9ae127 Issue 12852 - 64 bit wrong code generated Conflicts: test/runnable/testxmm.d https://github.com/D-Programming-Language/dmd/commit/5fd5212d7ae8d1bc34d9cb673a7e9b31a93b92a1 fix Issue 12852 - 64 bit wrong code generated