brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 8fed309 Raw
40 lines · plain
1; RUN: llc < %s | FileCheck %s --check-prefix NOATOMIC2; RUN: llc < %s -asm-verbose=false -wasm-disable-explicit-locals -wasm-keep-registers -mattr=+atomics | FileCheck %s3 4target triple = "wasm32-unknown-unknown"5 6; A multithread fence is lowered to an atomic.fence instruction.7; CHECK-LABEL: multithread_fence:8; CHECK:  atomic.fence9; NOATOMIC-NOT: i32.atomic.rmw.or10define void @multithread_fence() {11  fence seq_cst12  ret void13}14 15; Fences with weaker memory orderings than seq_cst should be treated the same16; because atomic memory access in wasm are sequentially consistent.17; CHECK-LABEL: multithread_weak_fence:18; CHECK:       atomic.fence19; CHECK-NEXT:  atomic.fence20; CHECK-NEXT:  atomic.fence21define void @multithread_weak_fence() {22  fence acquire23  fence release24  fence acq_rel25  ret void26}27 28; A singlethread fence becomes compiler_fence instruction, a pseudo instruction29; that acts as a compiler barrier. The barrier should not be emitted to .s file.30; CHECK-LABEL: singlethread_fence:31; CHECK-NOT: compiler_fence32; CHECK-NOT: atomic_fence33define void @singlethread_fence() {34  fence syncscope("singlethread") seq_cst35  fence syncscope("singlethread") acquire36  fence syncscope("singlethread") release37  fence syncscope("singlethread") acq_rel38  ret void39}40