;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
;; RUN: wasm-opt -all %s --roundtrip -S -o - | filecheck %s --check-prefix=RTRIP

(module
 ;; RTRIP:      (memory $0 23 256 shared)
 (memory $0 23 256 shared)

 ;; RTRIP:      (func $acqrel (type $0)
 ;; RTRIP-NEXT:  (i32.atomic.store acqrel
 ;; RTRIP-NEXT:   (i32.const 1)
 ;; RTRIP-NEXT:   (i32.const 1)
 ;; RTRIP-NEXT:  )
 ;; RTRIP-NEXT:  (drop
 ;; RTRIP-NEXT:   (i32.atomic.load acqrel
 ;; RTRIP-NEXT:    (i32.const 1)
 ;; RTRIP-NEXT:   )
 ;; RTRIP-NEXT:  )
 ;; RTRIP-NEXT: )
 (func $acqrel
   (i32.atomic.store acqrel (i32.const 1) (i32.const 1))
   (drop
    (i32.atomic.load acqrel
     (i32.const 1)
   ))
 )

 ;; Optional seqcst ordering is dropped in text output.
 ;; RTRIP:      (func $seqcst (type $0)
 ;; RTRIP-NEXT:  (i32.atomic.store
 ;; RTRIP-NEXT:   (i32.const 1)
 ;; RTRIP-NEXT:   (i32.const 1)
 ;; RTRIP-NEXT:  )
 ;; RTRIP-NEXT:  (i32.atomic.store
 ;; RTRIP-NEXT:   (i32.const 1)
 ;; RTRIP-NEXT:   (i32.const 1)
 ;; RTRIP-NEXT:  )
 ;; RTRIP-NEXT:  (drop
 ;; RTRIP-NEXT:   (i32.atomic.load
 ;; RTRIP-NEXT:    (i32.const 1)
 ;; RTRIP-NEXT:   )
 ;; RTRIP-NEXT:  )
 ;; RTRIP-NEXT:  (drop
 ;; RTRIP-NEXT:   (i32.atomic.load
 ;; RTRIP-NEXT:    (i32.const 1)
 ;; RTRIP-NEXT:   )
 ;; RTRIP-NEXT:  )
 ;; RTRIP-NEXT: )
 (func $seqcst
   (i32.atomic.store seqcst (i32.const 1) (i32.const 1))
   (i32.atomic.store 0 seqcst (i32.const 1) (i32.const 1))
   (drop (i32.atomic.load seqcst
    (i32.const 1)
   ))
   ;; allows memory index before memory ordering immediate
   (drop
    (i32.atomic.load 0 seqcst
    (i32.const 1)
   ))
 )
)
