aboutsummaryrefslogtreecommitdiffhomepage
path: root/compiler/atomic.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2022-05-05 14:52:20 +0200
committerRon Evans <[email protected]>2022-05-07 17:15:35 +0200
commit5c23f6fb6c64c4de46a3cf2374490a2c3b7401f3 (patch)
treee5048ec49679778313cb3db5416bbbb0b4b3bddd /compiler/atomic.go
parent5afb63df60427bd5ddf7adb8e2d43258c2544ce6 (diff)
downloadtinygo-5c23f6fb6c64c4de46a3cf2374490a2c3b7401f3.tar.gz
tinygo-5c23f6fb6c64c4de46a3cf2374490a2c3b7401f3.zip
all: remove support for LLVM 11 and LLVM 12
This removes a lot of backwards compatibility cruft and makes it possible to start using features that need LLVM 13 or newer. For example: * https://github.com/tinygo-org/tinygo/pull/2637 * https://github.com/tinygo-org/tinygo/pull/2830
Diffstat (limited to 'compiler/atomic.go')
-rw-r--r--compiler/atomic.go24
1 files changed, 0 insertions, 24 deletions
diff --git a/compiler/atomic.go b/compiler/atomic.go
index 7a931b7fe..c6938bdd0 100644
--- a/compiler/atomic.go
+++ b/compiler/atomic.go
@@ -52,30 +52,6 @@ func (b *builder) createAtomicOp(call *ssa.CallCommon) (llvm.Value, bool) {
ptr := b.getValue(call.Args[0])
old := b.getValue(call.Args[1])
newVal := b.getValue(call.Args[2])
- if strings.HasSuffix(name, "64") {
- if strings.HasPrefix(b.Triple, "thumb") {
- // Work around a bug in LLVM, at least LLVM 11:
- // https://reviews.llvm.org/D95891
- // Check for thumbv6m, thumbv7, thumbv7em, and perhaps others.
- // See also: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html
- compareAndSwap := b.mod.NamedFunction("__sync_val_compare_and_swap_8")
- if compareAndSwap.IsNil() {
- // Declare the function if it isn't already declared.
- i64Type := b.ctx.Int64Type()
- fnType := llvm.FunctionType(i64Type, []llvm.Type{llvm.PointerType(i64Type, 0), i64Type, i64Type}, false)
- compareAndSwap = llvm.AddFunction(b.mod, "__sync_val_compare_and_swap_8", fnType)
- }
- actualOldValue := b.CreateCall(compareAndSwap, []llvm.Value{ptr, old, newVal}, "")
- // The __sync_val_compare_and_swap_8 function returns the old
- // value. However, we shouldn't return the old value, we should
- // return whether the compare/exchange was successful. This is
- // easily done by comparing the returned (actual) old value with
- // the expected old value passed to
- // __sync_val_compare_and_swap_8.
- swapped := b.CreateICmp(llvm.IntEQ, old, actualOldValue, "")
- return swapped, true
- }
- }
tuple := b.CreateAtomicCmpXchg(ptr, old, newVal, llvm.AtomicOrderingSequentiallyConsistent, llvm.AtomicOrderingSequentiallyConsistent, true)
swapped := b.CreateExtractValue(tuple, 1, "")
return swapped, true