-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Arm64: Better addressing mode for array access whose elements are accessed byref #67981
Comments
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsContinuing on #64819, we should also improve the array accesses if the element is accessed using private int[] _srcData = new int[20];
public int[] Test(int m, int n, byte v)
{
for (int i = 0; i < n; i++) {
Consume(ref _srcData[i]);
}
return _srcData;
} G_M11249_IG03:
mov x0, x19
ldr x0, [x0,#8]
ldr w1, [x0,#8]
cmp w21, w1
bhs G_M11249_IG06
add x0, x0, #16
ubfiz x1, x21, #2, #32
add x1, x0, x1
mov x0, x19
movz x2, #0xd1ffab1e
movk x2, #0xd1ffab1e LSL #16
movk x2, #0xd1ffab1e LSL #32
ldr x2, [x2]
blr x2
add w21, w21, #1
cmp w21, w20
blt G_M11249_IG03 Without ref: private int[] _srcData = new int[20];
public int[] Test(int m, int n, byte v)
{
for (int i = 0; i < n; i++) {
Consume(ref _srcData[i]);
}
return _srcData;
} G_M11249_IG03:
mov x0, x19
ldr x0, [x0,#8]
ldr w1, [x0,#8]
cmp w21, w1
bhs G_M11249_IG06
add x0, x0, #16
ldr w1, [x0, w21, UXTW #2] ; <-- compact
mov x0, x19
movz x2, #0xd1ffab1e
movk x2, #0xd1ffab1e LSL #16
movk x2, #0xd1ffab1e LSL #32
ldr x2, [x2]
blr x2
add w21, w21, #1
cmp w21, w20
blt G_M11249_IG03
|
@dotnet/jit-contrib |
I don't understand the expected codegen - the first codegen doesn't contain any memory loads (because we don't dereference _srcData) |
Ah, I think the 2nd version had to be ubfiz x1, x21, #2, #32
add x1, x0, x1 |
@kunalspathak so can you tell what's the expected codegen here? I don't see loads and I don't see how we can combine these ubfix and add |
I was misreading that the |
Continuing on #64819, we should also improve the array accesses if the element is accessed using
ref
.Without ref:
The text was updated successfully, but these errors were encountered: