atomic-rmw-and.txt 4.14 KB
Newer Older
1 2 3 4 5 6 7
;;; TOOL: run-interp
;;; ARGS*: --enable-threads
(module
  (memory 1 1 shared)

  ;; i32

8
  (func (export "i32.atomic.rmw8.and_u-result") (result i32)
9
    i32.const 0 i32.const 1000000 i32.store
10
    i32.const 0 i32.const 64      i32.atomic.rmw8.and_u)
11

12
  (func (export "i32.atomic.rmw8.and_u-memory") (result i32)
13
    i32.const 0 i32.const 1000000 i32.store
14
    i32.const 0 i32.const 64      i32.atomic.rmw8.and_u drop
15 16
    i32.const 0 i32.load8_u)

17
  (func (export "i32.atomic.rmw16.and_u-result") (result i32)
18
    i32.const 0 i32.const 1000000 i32.store
19
    i32.const 0 i32.const 64      i32.atomic.rmw16.and_u)
20

21
  (func (export "i32.atomic.rmw16.and_u-memory") (result i32)
22
    i32.const 0 i32.const 1000000 i32.store
23
    i32.const 0 i32.const 64      i32.atomic.rmw16.and_u drop
24 25 26 27 28 29 30 31 32 33 34 35 36 37
    i32.const 0 i32.load16_u)

  (func (export "i32.atomic.rmw.and-result") (result i32)
    i32.const 0 i32.const 1000000 i32.store
    i32.const 0 i32.const 64      i32.atomic.rmw.and)

  (func (export "i32.atomic.rmw.and-memory") (result i32)
    i32.const 0 i32.const 1000000 i32.store
    i32.const 0 i32.const 64      i32.atomic.rmw.and drop
    i32.const 0 i32.load)


  ;; i64

38
  (func (export "i64.atomic.rmw8.and_u-result") (result i64)
39
    i32.const 0 i64.const 10000000000 i64.store
40
    i32.const 0 i64.const 64          i64.atomic.rmw8.and_u)
41

42
  (func (export "i64.atomic.rmw8.and_u-memory") (result i64)
43
    i32.const 0 i64.const 10000000000 i64.store
44
    i32.const 0 i64.const 64          i64.atomic.rmw8.and_u drop
45 46
    i32.const 0 i64.load8_u)

47
  (func (export "i64.atomic.rmw16.and_u-result") (result i64)
48
    i32.const 0 i64.const 10000000000 i64.store
49
    i32.const 0 i64.const 1024        i64.atomic.rmw16.and_u)
50

51
  (func (export "i64.atomic.rmw16.and_u-memory") (result i64)
52
    i32.const 0 i64.const 10000000000 i64.store
53
    i32.const 0 i64.const 1024        i64.atomic.rmw16.and_u drop
54 55
    i32.const 0 i64.load16_u)

56
  (func (export "i64.atomic.rmw32.and_u-result") (result i64)
57
    i32.const 0 i64.const 10000000000 i64.store
58
    i32.const 0 i64.const 1024        i64.atomic.rmw32.and_u)
59

60
  (func (export "i64.atomic.rmw32.and_u-memory") (result i64)
61
    i32.const 0 i64.const 10000000000 i64.store
62
    i32.const 0 i64.const 1024        i64.atomic.rmw32.and_u drop
63 64 65 66 67 68 69 70 71 72 73 74 75 76
    i32.const 0 i64.load32_u)

  (func (export "i64.atomic.rmw.and-result") (result i64)
    i32.const 0 i64.const 10000000000 i64.store
    i32.const 0 i64.const 1024        i64.atomic.rmw.and)

  (func (export "i64.atomic.rmw.and-memory") (result i64)
    i32.const 0 i64.const 10000000000 i64.store
    i32.const 0 i64.const 1024        i64.atomic.rmw.and drop
    i32.const 0 i64.load)


  ;; Test bad alignment

77 78
  (func (export "bad_align-i32.atomic.rmw16.and_u")
    i32.const 1 i32.const 0 i32.atomic.rmw16.and_u drop)
79 80 81
  (func (export "bad_align-i32.atomic.rmw.and")
    i32.const 2 i32.const 0 i32.atomic.rmw.and drop)

82 83 84 85
  (func (export "bad_align-i64.atomic.rmw16.and_u")
    i32.const 1 i64.const 0 i64.atomic.rmw16.and_u drop)
  (func (export "bad_align-i64.atomic.rmw32.and_u")
    i32.const 2 i64.const 0 i64.atomic.rmw32.and_u drop)
86 87 88 89 90
  (func (export "bad_align-i64.atomic.rmw.and")
    i32.const 4 i64.const 0 i64.atomic.rmw.and drop)

)
(;; STDOUT ;;;
91 92 93 94
i32.atomic.rmw8.and_u-result() => i32:64
i32.atomic.rmw8.and_u-memory() => i32:64
i32.atomic.rmw16.and_u-result() => i32:16960
i32.atomic.rmw16.and_u-memory() => i32:64
95 96
i32.atomic.rmw.and-result() => i32:1000000
i32.atomic.rmw.and-memory() => i32:64
97 98 99 100 101 102
i64.atomic.rmw8.and_u-result() => i64:0
i64.atomic.rmw8.and_u-memory() => i64:0
i64.atomic.rmw16.and_u-result() => i64:58368
i64.atomic.rmw16.and_u-memory() => i64:1024
i64.atomic.rmw32.and_u-result() => i64:1410065408
i64.atomic.rmw32.and_u-memory() => i64:1024
103 104
i64.atomic.rmw.and-result() => i64:10000000000
i64.atomic.rmw.and-memory() => i64:1024
105
bad_align-i32.atomic.rmw16.and_u() => error: atomic memory access is unaligned
106
bad_align-i32.atomic.rmw.and() => error: atomic memory access is unaligned
107 108
bad_align-i64.atomic.rmw16.and_u() => error: atomic memory access is unaligned
bad_align-i64.atomic.rmw32.and_u() => error: atomic memory access is unaligned
109 110
bad_align-i64.atomic.rmw.and() => error: atomic memory access is unaligned
;;; STDOUT ;;)