[PATCH] D116088: [compiler-rt] Implement ARM atomic operations for architectures without SMP support
Pavel Kosov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 18 06:28:20 PDT 2022
kpdev42 added a comment.
In D116088#3393350 <https://reviews.llvm.org/D116088#3393350>, @efriedma wrote:
> D120026 <https://reviews.llvm.org/D120026> is merged now, which addresses the issue of the compiler generating __sync calls where it isn't supposed to.
>
> Does anyone want to continue discussing what changes to compiler-rt would be appropriate? I didn't mean to completely shut down discussion with my comment.
@efriedma
Imagine we have the following piece of code in the program:
volatile int G;
int foo() { return __sync_add_and_fetch(&G, 1); }
Now we want having this built and running on armv5 platform. At the moment the only option we have is to use libgcc. Unfortunately this have one big disadvantage: we're only limited to Linux, because call to __sync_add_and_fetch boils down to Linux kernel user helper. We want this to work on other platforms also, and here is what compiler-rt good for.
However sync ops operations in compiler-rt use memory barriers, which doesn't work on armv5: any attempt to use memory barrier on the latter will result in SIGILL. As armv5 doesn't support SMP (but still supports preemptive multitasking) it's possible in out opinion to implement sync ops as a compare and swap loop without memory barriers. What's your opinion on this?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116088/new/
https://reviews.llvm.org/D116088
More information about the llvm-commits
mailing list