brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 5bfe85c Raw
67 lines · plain
1# RUN: llc -mtriple=wasm32-unknown-unknown -run-pass wasm-reg-stackify -run-pass wasm-explicit-locals %s -o - | FileCheck %s2 3# In the two tests below, without compiler_fence or atomic.fence in between,4# memory.atomic.notify and i32.add will be reordered by register stackify pass5# to meet 'call @foo''s requirements. But because we have fences between6# memory.atomic.notify and i32.add, they cannot be reordered, and local.set and7# local.get are inserted to save and load memory.atomic.notify's return value.8 9--- |10  target triple = "wasm32-unknown-unknown"11 12  declare void @foo(i32, i32)13  define void @compiler_fence_test(i32) {14    ret void15  }16  define void @atomic_fence_test(i32) {17    ret void18  }19...20---21# CHECK-LABEL: name: compiler_fence_test22name: compiler_fence_test23liveins:24  - { reg: '$arguments' }25tracksRegLiveness: true26body: |27  bb.0:28    ; CHECK: %[[REG:[0-9]+]]:i32 = MEMORY_ATOMIC_NOTIFY_A3229    ; CHECK: LOCAL_SET_I32 [[LOCAL:[0-9]+]], %[[REG]]30    ; CHECK: COMPILER_FENCE31    ; CHECK: ADD_I3232    ; CHECK: LOCAL_GET_I32 [[LOCAL]]33    ; CHECK: CALL @foo34 35    liveins: $arguments36    %0:i32 = CONST_I32 0, implicit-def $arguments37    %1:i32 = MEMORY_ATOMIC_NOTIFY_A32 2, 0, %0:i32, %0:i32, implicit-def $arguments38    COMPILER_FENCE implicit-def $arguments39    %2:i32 = ADD_I32 %0:i32, %0:i32, implicit-def $arguments40    CALL @foo, %2:i32, %1:i32, implicit-def $arguments41    RETURN implicit-def $arguments42...43 44---45# CHECK-LABEL: name: atomic_fence_test46name: atomic_fence_test47liveins:48  - { reg: '$arguments' }49tracksRegLiveness: true50body: |51  bb.0:52    ; CHECK: %[[REG:[0-9]+]]:i32 = MEMORY_ATOMIC_NOTIFY_A3253    ; CHECK: LOCAL_SET_I32 [[LOCAL:[0-9]+]], %[[REG]]54    ; CHECK: ATOMIC_FENCE55    ; CHECK: ADD_I3256    ; CHECK: LOCAL_GET_I32 [[LOCAL]]57    ; CHECK: CALL @foo58 59    liveins: $arguments60    %0:i32 = CONST_I32 0, implicit-def $arguments61    %1:i32 = MEMORY_ATOMIC_NOTIFY_A32 2, 0, %0:i32, %0:i32, implicit-def $arguments62    ATOMIC_FENCE 0, implicit-def $arguments63    %2:i32 = ADD_I32 %0:i32, %0:i32, implicit-def $arguments64    CALL @foo, %2:i32, %1:i32, implicit-def $arguments65    RETURN implicit-def $arguments66...67