Bug 10714 – inlining issue with core.bitop.bt no longer being an intrinsic

Status
NEW
Severity
normal
Priority
P3
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-25T15:55:22Z
Last change time
2024-12-07T13:32:49Z
Assigned to
No Owner
Creator
Martin Nowak
Moved to GitHub: dmd#17258 →

Comments

Comment #0 by code — 2013-07-25T15:55:22Z
With https://github.com/D-Programming-Language/druntime/pull/388 core.bitop.bt was changed from an intrinsic to a function and relies on the optimizer to recognize the pattern. While that work inlining the function call might fail resulting in a net performance drawback. I think we should keep the pattern recognition but to core.bitop.bt back into an intrinsic.
Comment #1 by bearophile_hugs — 2013-07-25T16:52:00Z
(In reply to comment #0) > I think we should keep the pattern recognition but to core.bitop.bt back into > an intrinsic. For the bit rotations the situation is even worse (see Issue 5728 and Issue 6829 ), because in Phobos we don't even have the function that contains the recognized pattern, so it's kind of easy for programmers to write the pattern wrong or for compilers to miss the pattern. (Currently both dmd and ldc2 don't recognize some rotations.)
Comment #2 by dmitry.olsh — 2013-11-18T06:37:30Z
Duplicate of 11418?
Comment #3 by blah38621 — 2013-11-18T06:46:59Z
The problem with making it an intrinsic again is that doing so would break some code that relies on bt being executable at compile time.
Comment #4 by bearophile_hugs — 2013-11-18T06:58:46Z
(In reply to comment #3) > The problem with making it an intrinsic again is that doing so would break some > code that relies on bt being executable at compile time. Can't __ctfe be used to solve that?
Comment #5 by blah38621 — 2013-11-18T07:06:25Z
(In reply to comment #4) > (In reply to comment #3) > > The problem with making it an intrinsic again is that doing so would break some > > code that relies on bt being executable at compile time. > > Can't __ctfe be used to solve that? Yes, but it would need to be done inside of bt, and a separate function declared that would be the actual intrinsic.
Comment #6 by yebblies — 2013-11-18T09:09:15Z
(In reply to comment #3) > The problem with making it an intrinsic again is that doing so would break some > code that relies on bt being executable at compile time. It is quite possible to have an intrinsic that is executable at compile time... It's even possible for a function to both have a body _and_ be an intrinsic.
Comment #7 by robert.schadek — 2024-12-07T13:32:49Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17258 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB