;;; TOOL: run-interp
;;; ARGS*: --enable-threads
(module
  (memory 1 1 shared)
  (data (i32.const 0) "\ff\ff\ff\ff")
  (data (i32.const 4) "\00\00\ce\41")
  (data (i32.const 8) "\00\00\00\00\00\ff\8f\40")

  (func (export "i32.atomic.load8_u") (result i32)
    i32.const 1 i32.atomic.load8_u)
  (func (export "i32.atomic.load16_u") (result i32)
    i32.const 2 i32.atomic.load16_u)
  (func (export "i32.atomic.load") (result i32)
    i32.const 4 i32.atomic.load)

  (func (export "i64.atomic.load8_u") (result i64)
    i32.const 1 i64.atomic.load8_u)
  (func (export "i64.atomic.load16_u") (result i64)
    i32.const 2 i64.atomic.load16_u)
  (func (export "i64.atomic.load32_u") (result i64)
    i32.const 4 i64.atomic.load32_u)
  (func (export "i64.atomic.load") (result i64)
    i32.const 0 i64.atomic.load)

  ;; Test bad alignment

  (func (export "bad.align-i32.atomic.load16_u") (result i32)
    i32.const 1 i32.atomic.load16_u)
  (func (export "bad.align-i32.atomic.load") (result i32)
    i32.const 2 i32.atomic.load)

  (func (export "bad.align-i64.atomic.load16_u") (result i64)
    i32.const 1 i64.atomic.load16_u)
  (func (export "bad.align-i64.atomic.load32_u") (result i64)
    i32.const 2 i64.atomic.load32_u)
  (func (export "bad.align-i64.atomic.load") (result i64)
    i32.const 4 i64.atomic.load)


)
(;; STDOUT ;;;
i32.atomic.load8_u() => i32:255
i32.atomic.load16_u() => i32:65535
i32.atomic.load() => i32:1104019456
i64.atomic.load8_u() => i64:255
i64.atomic.load16_u() => i64:65535
i64.atomic.load32_u() => i64:1104019456
i64.atomic.load() => i64:4741727461962678271
bad.align-i32.atomic.load16_u() => error: invalid atomic access at 1+0
bad.align-i32.atomic.load() => error: invalid atomic access at 2+0
bad.align-i64.atomic.load16_u() => error: invalid atomic access at 1+0
bad.align-i64.atomic.load32_u() => error: invalid atomic access at 2+0
bad.align-i64.atomic.load() => error: invalid atomic access at 4+0
;;; STDOUT ;;)
