gallivm: fix issue with AtomicCmpXchg wrapper on llvm 3.5-3.8
authorRoland Scheidegger <sroland@vmware.com>
Tue, 30 Jul 2019 21:35:49 +0000 (23:35 +0200)
committerRoland Scheidegger <sroland@vmware.com>
Fri, 2 Aug 2019 18:16:17 +0000 (20:16 +0200)
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>
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp

index 79d10293e8006110a104f3c698d57977a96a11b0..5fe697346fe2dd0b50d0c81719592a0019bc9e11 100644 (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