Open knn-k opened 1 year ago
AArch64 JIT generates the following instructions for the node n49184n
.
0x131cdbfe4 000042d0 [ 0x17d2f7270] 52800082 0 movzw w2, 0x0004
0x131cdbfe8 000042d4 [ 0x17d2f73c0] f9417a80 0 ldrimmx w0, [w20, 752] # SymRef <pending push temp 0>[#2684 Auto +752] [flags 0x4007 0x800 ]
0x131cdbfec 000042d8 [ 0x17d2f7450] f822c820 0 stroffx w0, [w1, w2, sxtw 0] # SymRef <generic int shadow>[#5853 Shadow] [flags 0x603 0x0 ]
It uses w2
as a temporary register for iconst 4
.
But we can throw away the movzw
instruction, and change the store operation to strimmx w0, [w1, 0x4]
without using the temporary register for the index in this case.
AArch64 codegen is capable of generating the store instruction with baseReg + immediate offset when the second child of aladd
is lconst
.
I sometimes find JIT IL trees like shown below, typically with
OSRScratchBuffer
. Thealadd
noden49179n
has ani2l
node as the second child, whose child node is aniconst
. It is the same for thealadd
noden49183n
.Is it possible for the optimizer to simply the
iconst n
-i2l
sequence into alconst n
node?