Uh oh!
There was an error while loading. Please reload this page.
arm64: Add support for BFI and BFX instruction - #123138
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
ce512bf to
1a8d58fCompare1a8d58f to
83a6004Comparea74nh
commented
Jan 26, 2026
Spmidiff errors |
- Remove Expect.cs
jonathandavies-arm
commented
Jan 29, 2026
Fixed |
jakobbotsch
commented
Feb 13, 2026
/azp run runtime-coreclr superpmi-replay |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jakobbotsch
commented
Feb 13, 2026
Looks like there are replay failures.
|
jakobbotsch
commented
May 21, 2026
The throughput regressions in the diffs seem large given the quite small number of diffs and the complexity of the transformation. All the diffs I looked at looked like: - lsr w2, w0, #6- and w2, w2, #63+ ubfx w2, w0, #6, #6and - lsr w2, w0, #6- and w2, w2, #63+ ubfx w2, w0, #6, #6Could we simplify things by only focusing on these cases? |
jonathandavies-arm
commented
May 26, 2026
I'll have a look at reducing what the PR does to concentrate on this pattern. |
jonathandavies-arm
commented
Jun 2, 2026
I've pushed a commit that only focuses on the small case you suggested. From my local testing the throughput regressions should be no more, I would check the build but I can't find the page with the results. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Remove BFX case from compiler.hpp and gentree.cpp
jakobbotsch
commented
Jun 12, 2026
/azp run runtime-coreclr superpmi-replay |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Uh oh!
There was an error while loading. Please reload this page.
This patch adds support for the Arm BFX instruction. When you extract a continuous range of bits from an integer e.g. `return (x >> 5) & 0x1F;` This is the node pattern it's looking for ``` N005 ( 5, 7) [000004] -----+----- \--* AND int $101 N003 ( 3, 4) [000002] -----+----- +--* RSH int $100 N001 ( 1, 1) [000000] -----+----- | +--* LCL_VAR int V00 arg0 u:1 (last use) $80 N002 ( 1, 2) [000001] -----+----- | \--* CNS_INT int 6 $42 N004 ( 1, 2) [000003] -----+----- \--* CNS_INT int 63 $43 ``` and changes to ``` ( 5, 7) [000007] ----------- \--* BFX int N001 ( 1, 1) [000000] -----+----- \--* LCL_VAR int V00 arg0 u:1 (last use) $80 ```
This patch adds support for the Arm BFI and BFX instructions. I've added a optimisation in lowering for bit packing and unpacking using each instruction respectively.
BFI
This is used when you pack 2 or more values into an integer. e.g.
return (a & 0xf) | ((b & 0x3) << 4);This is the node pattern it is looking for
and changes to
BFX
When you extract a continuous range of bits from an integer. This is the inverse of above. e.g.
return (x >> 5) & 0x1F;This is the node pattern it's looking for
and changes to