Files
wasmtime/cranelift/filetests/filetests/isa/s390x/atomic_store.clif
Ulrich Weigand 46b73431ca s390x: Add support for atomic operations (part 1)
This adds full back-end support for the Fence, AtomicLoad
and AtomicStore operations, and partial support for the
AtomicCas and AtomicRmw operations.

The missing pieces include sub-word operations, operations
on little-endian memory requiring byte-swapping, and some
of the subtypes of AtomicRmw -- everything that cannot be
implemented without a compare-and-swap loop.  This will be
done in a follow-up patch.

This patch already suffices to make the test suite green
again after a recent change that now requires atomic
operations when accessing the heap.
2021-06-15 17:12:11 +02:00

124 lines
2.0 KiB
Plaintext

test compile
target s390x
function %atomic_store_i64(i64, i64) {
block0(v0: i64, v1: i64):
atomic_store.i64 v0, v1
return
}
; check: stg %r2, 0(%r3)
; nextln: bcr 14, 0
; nextln: br %r14
function %atomic_store_i64_sym(i64) {
gv0 = symbol colocated %sym
block0(v0: i64):
v1 = symbol_value.i64 gv0
atomic_store.i64 v0, v1
return
}
; check: stgrl %r2, %sym + 0
; nextln: bcr 14, 0
; nextln: br %r14
function %atomic_store_imm_i64(i64) {
block0(v0: i64):
v1 = iconst.i64 12345
atomic_store.i64 v1, v0
return
}
; check: mvghi 0(%r2), 12345
; nextln: bcr 14, 0
; nextln: br %r14
function %atomic_store_i32(i32, i64) {
block0(v0: i32, v1: i64):
atomic_store.i32 v0, v1
return
}
; check: st %r2, 0(%r3)
; nextln: bcr 14, 0
; nextln: br %r14
function %atomic_store_i32_sym(i32) {
gv0 = symbol colocated %sym
block0(v0: i32):
v1 = symbol_value.i64 gv0
atomic_store.i32 v0, v1
return
}
; check: strl %r2, %sym + 0
; nextln: bcr 14, 0
; nextln: br %r14
function %atomic_store_imm_i32(i64) {
block0(v0: i64):
v1 = iconst.i32 12345
atomic_store.i32 v1, v0
return
}
; check: mvhi 0(%r2), 12345
; nextln: bcr 14, 0
; nextln: br %r14
function %atomic_store_i16(i16, i64) {
block0(v0: i16, v1: i64):
atomic_store.i16 v0, v1
return
}
; check: sth %r2, 0(%r3)
; nextln: bcr 14, 0
; nextln: br %r14
function %atomic_store_i16_sym(i16) {
gv0 = symbol colocated %sym
block0(v0: i16):
v1 = symbol_value.i64 gv0
atomic_store.i16 v0, v1
return
}
; check: sthrl %r2, %sym + 0
; nextln: bcr 14, 0
; nextln: br %r14
function %atomic_store_imm_i16(i64) {
block0(v0: i64):
v1 = iconst.i16 12345
atomic_store.i16 v1, v0
return
}
; check: mvhhi 0(%r2), 12345
; nextln: bcr 14, 0
; nextln: br %r14
function %atomic_store_i8(i8, i64) {
block0(v0: i8, v1: i64):
atomic_store.i8 v0, v1
return
}
; check: stc %r2, 0(%r3)
; nextln: bcr 14, 0
; nextln: br %r14
function %atomic_store_imm_i8(i64) {
block0(v0: i64):
v1 = iconst.i8 123
atomic_store.i8 v1, v0
return
}
; check: mvi 0(%r2), 123
; nextln: bcr 14, 0
; nextln: br %r14