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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to