-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JIT] X64 - Recognize patterns to emit bts
, btc
, btr
instructions
#81512
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak Issue Details@tannergooding and I were having a discussion and these examples were brought up. public class C {
static uint SetBit(int position, uint bits)
{
return bits | (1u << position);
}
static uint ToggleBit(int position, uint bits)
{
return bits ^ (1u << position);
}
static uint ResetBit(int position, uint bits)
{
return bits & ~(1u << position);
}
} These examples currently emit:
They could emit:
In XARCH LIR, we have a Related: #6815
|
We could also implement these as public APIs in |
Exposing the apis via public helpers is a separate consideration and one that would need to be in its own API proposal |
Merged in #83400: runtime/src/libraries/System.Private.CoreLib/src/System/Numerics/BitOperations.cs Lines 947 to 959 in c96c15c
|
@tannergooding and I were having a discussion and these examples were brought up.
These examples currently emit:
They could emit:
In XARCH LIR, we have a
GT_BT
already, we can just add three moreGT_BTS
,GT_BTC
,GT_BTR
and recognize the patterns above to transform to those ops in lowering.Related: #27382
The text was updated successfully, but these errors were encountered: