OSDN Git Service

[NVPTX] Select atomic loads and stores
authorJonas Hahnfeld <hahnjo@hahnjo.de>
Thu, 9 Aug 2018 07:45:49 +0000 (07:45 +0000)
committerJonas Hahnfeld <hahnjo@hahnjo.de>
Thu, 9 Aug 2018 07:45:49 +0000 (07:45 +0000)
commit8da71ffd55fd6dd83df028ba76e65780e03bd90e
tree80a41d279d1e55f8439dcfcccfa03d0f9a27fd58
parent8e0b205f3bd731e8b133f5a378d65712e1be441e
[NVPTX] Select atomic loads and stores

According to PTX ISA .volatile has the same memory synchronization
semantics as .relaxed.sys, so it can be used to implement monotonic
atomic loads and stores. This is important for OpenMP's atomic
construct where
 - 'read's and 'write's are lowered to atomic loads and stores, and
 - an update of float or double types are lowered into a cmpxchg loop.
(Note that PTX could do better because it has atom.add.f{32,64} but
LLVM's atomicrmw instruction only allows integer types.)

Higher levels of atomicity (like acquire and release) need additional
synchronization properties which were added with PTX ISA 6.0 / sm_70.
So using these instructions still results in an error.

Differential Revision: https://reviews.llvm.org/D50391

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339316 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
test/CodeGen/NVPTX/load-store.ll [new file with mode: 0644]