gallivm: fix issue with AtomicCmpXchg wrapper on llvm 3.5-3.8

These versions still need wrapper but already have both success and
failure ordering.
(Compile tested on llvm 3.3, 3.7, 3.8.)

v2: don't duplicate whole function (suggested by Brian).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111102

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Roland Scheidegger 2019-07-30 23:35:49 +02:00
parent dcf9d91a80
commit 74baeacafc
1 changed files with 3 additions and 1 deletions

View File

@ -828,9 +828,11 @@ LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr,
LLVMAtomicOrdering FailureOrdering,
LLVMBool SingleThread)
{
/* LLVM 3.8 doesn't have a second ordering and uses old SynchronizationScope enum */
return llvm::wrap(llvm::unwrap(B)->CreateAtomicCmpXchg(llvm::unwrap(Ptr), llvm::unwrap(Cmp),
llvm::unwrap(New), mapFromLLVMOrdering(SuccessOrdering),
#if HAVE_LLVM >= 0x305
mapFromLLVMOrdering(FailureOrdering),
#endif
SingleThread ? llvm::SynchronizationScope::SingleThread : llvm::SynchronizationScope::CrossThread));
}
#endif