summaryrefslogtreecommitdiff
path: root/test/lit/passes/gufa-refs.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/lit/passes/gufa-refs.wast')
-rw-r--r--test/lit/passes/gufa-refs.wast53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/lit/passes/gufa-refs.wast b/test/lit/passes/gufa-refs.wast
index 80fd32386..ec67cf40c 100644
--- a/test/lit/passes/gufa-refs.wast
+++ b/test/lit/passes/gufa-refs.wast
@@ -6137,3 +6137,56 @@
)
)
)
+
+;; Atomic accesses require special handling
+(module
+ ;; CHECK: (type $A (shared (struct (field i32))))
+ (type $A (shared (struct (field i32))))
+
+ ;; CHECK: (type $1 (func))
+
+ ;; CHECK: (func $gets (type $1)
+ ;; CHECK-NEXT: (local $0 (ref $A))
+ ;; CHECK-NEXT: (local.set $0
+ ;; CHECK-NEXT: (struct.new_default $A)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.const 0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (struct.atomic.get acqrel $A 0
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (struct.atomic.get $A 0
+ ;; CHECK-NEXT: (local.get $0)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $gets
+ (local (ref $A))
+ (local.set 0
+ (struct.new_default $A)
+ )
+ (drop
+ ;; This is optimizable. It reads from shared memory, but there is only one
+ ;; possible value that can be read.
+ (struct.get $A 0
+ (local.get 0)
+ )
+ )
+ (drop
+ ;; We do not (yet) optimize atomic gets.
+ (struct.atomic.get acqrel $A 0
+ (local.get 0)
+ )
+ )
+ (drop
+ ;; We do not (yet) optimize atomic gets.
+ (struct.atomic.get $A 0
+ (local.get 0)
+ )
+ )
+ )
+)