Bug 11418 – bit test pattern not inlined core.bitop.bt useless

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-01T21:13:40Z
Last change time
2021-09-08T14:48:24Z
Assigned to
No Owner
Creator
Martin Nowak
Depends on
10985

Comments

Comment #0 by code — 2013-11-01T21:13:40Z
The core.bitop.bt function is no longer an intrinsic. Instead it's a function whose body the optimizer recognizes as bitop function. That would be OK iff the function was always inlined. The problem is, the function is never inlined due to Issue 10985. This forces me write copy the pattern verbatim into my code.
Comment #1 by dkorpel — 2021-09-08T14:48:24Z
Issue 10985 is now fixed, so testing with: -O -inline ``` import core.bitop: bt; int foo(ulong* p, ulong bitnum) { return bt(p, bitnum); } ``` ASM: ``` int onlineapp.foo(ulong*, ulong): push RBP mov RBP,RSP mov RCX,RDI shr RCX,6 mov EDX,EDI and EDX,03Fh bt [RCX*8][RSI],EDX setb AL and EAX,1 pop RBP ret add [RAX],AL ``` The function is inlined and a bt instruction is generated, so it looks like this issue is fixed as well.