Closed
Description
Right now the body of the following method
public static long BigMul(int a, int b)
{
return ((long)a) * b;
}
is compiled by the JIT as two sign extensions sxtw
followed by mul
instruction:
G_M36318_IG01: ;; offset=0000H
A9BF7BFD stp fp, lr, [sp,#-16]!
910003FD mov fp, sp
;; bbWeight=1 PerfScore 1.50
G_M36318_IG02: ;; offset=0008H
93407C00 sxtw x0, w0
93407C21 sxtw x1, w1
9B017C00 mul x0, x0, x1
;; bbWeight=1 PerfScore 3.00
G_M36318_IG03: ;; offset=0014H
A8C17BFD ldp fp, lr, [sp],#16
D65F03C0 ret lr
As @TamarChristinaArm pointed out in #47362 that could be simplified down to
smull x0, w0, w1
The same applies to unsigned version of the method
public static ulong BigMul(uint a, uint b)
{
return ((ulong)a) * b;
}
that should be compiled to
umull x0, w0, w1
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done