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.