-
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
[RyuJIT/arm32] CQ: enable InterlockedCmpXchg32 intrinsic #9982
Comments
Related: #8626 |
But does ARM has the necessary instruction(s) to implement this? AFAIR I once looked at this and couldn't find anything clear. And ARM codegenlegacy is also NYI. |
I see that ARM32 GCC generates a call to a library function for |
The right answer very well might be that this is something we won't change. In which case, we can remove these TODOs and NYI. The VM helper must do something, though, so it's a matter of "inline" that, or not. I'm just auditing existing NYI and splitting them into separate issues. |
Also CORINFO_INTRINSIC_InterlockedAdd32, CORINFO_INTRINSIC_InterlockedXAdd32, CORINFO_INTRINSIC_InterlockedXchg32 (GT_LOCKADD, GT_XADD, GT_XCHG). See impIntrinsic(). |
Arm32 would use a load exclusive, store exclusive sequence similar to Arm64 base implementation. |
Yes, but it seems that ARM32 has different instructions for this - |
@mikedn dmb is definitely needed with ldrex/strex. ARMv7 really introduced multiprocessor coherent ARM. So I would believe ldrex/strex were part of that. It would be reasonable to assume that if we are on a multiprocessor OS, then ldrex, strex and dmb must be present. I would guess all realistic .NET Core targets have these instructions. We can certainly pick up capabilities from the OS like we do for arm64. |
So if I understand the ARM documentation correctly the generated code should look something like: ; CompareExchange(r0, r1, r2)
dmb
LOOP:
ldrex r3, [r0]
cmp r3, r1
bne DONE
strex r4, r2, [r0]
tst r4, r4
bne LOOP
DONE:
dmb
; result in r3 |
Currently, ARM does not generate GT_CMPXCHG nodes; all other targets do.
From the importer:
Also, in codegenarmarch.cpp, genCodeForTreeNode:
category:cq
theme:hardware-intrinsics
skill-level:intermediate
cost:small
The text was updated successfully, but these errors were encountered: