[PATCH] Compiler-rt: implement ARM atomic operations

Tim Northover t.p.northover at gmail.com
Tue Jan 21 05:46:45 PST 2014


Hi,

This patch implements the __sync_fetch_and_XXX operations that might be emitted on ARM. I went for an implementation compatible with C++'s sequentially-consistent requirements rather than anything more relaxed (i.e. two dmbs per operation).

The implementations require ldrex/strex, but I don't believe any sane generic choice can be made on CPUs without those instructions. Whatever passes for an OS will have to provide the facilities if they're needed.

They're in separate files to ensure they can be brought in with fine granularity by a linker, and the intent will be to use them at -Oz soon (currently, Clang probably only emits the calls for architectures that don't actually support ldrex/strex).

Ok to commit?

Cheers.

Tim

http://llvm-reviews.chandlerc.com/D2587

Files:
  lib/arm/Makefile.mk
  lib/arm/sync-ops.h
  lib/arm/sync_fetch_and_add_4.S
  lib/arm/sync_fetch_and_add_8.S
  lib/arm/sync_fetch_and_and_4.S
  lib/arm/sync_fetch_and_and_8.S
  lib/arm/sync_fetch_and_max_4.S
  lib/arm/sync_fetch_and_max_8.S
  lib/arm/sync_fetch_and_min_4.S
  lib/arm/sync_fetch_and_min_8.S
  lib/arm/sync_fetch_and_nand_4.S
  lib/arm/sync_fetch_and_nand_8.S
  lib/arm/sync_fetch_and_or_4.S
  lib/arm/sync_fetch_and_or_8.S
  lib/arm/sync_fetch_and_sub_4.S
  lib/arm/sync_fetch_and_sub_8.S
  lib/arm/sync_fetch_and_umax_4.S
  lib/arm/sync_fetch_and_umax_8.S
  lib/arm/sync_fetch_and_umin_4.S
  lib/arm/sync_fetch_and_umin_8.S
  lib/arm/sync_fetch_and_xor_4.S
  lib/arm/sync_fetch_and_xor_8.S
  make/platform/clang_macho_embedded.mk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2587.1.patch
Type: text/x-patch
Size: 20454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140121/348ccb36/attachment.bin>


More information about the llvm-commits mailing list