writer/wgsl: Emit atomic types

Bug: tint:892
Change-Id: Ie483167bcf669e5f2d6b5489a915584fc3678183
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/54649
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: David Neto <dneto@google.com>
diff --git a/test/intrinsics/gen/atomicMin/278235.wgsl.expected.hlsl b/test/intrinsics/gen/atomicMin/278235.wgsl.expected.hlsl
index 83c0306..1279197 100644
--- a/test/intrinsics/gen/atomicMin/278235.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/atomicMin/278235.wgsl.expected.hlsl
@@ -1,5 +1,15 @@
 SKIP: FAILED
 
 
-var<workgroup> arg_0 : 
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicMin_278235() {
+  var res : i32 = atomicMin(&(arg_0), 1);
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_278235();
+}
+
 Failed to generate: error: unknown type in EmitType
diff --git a/test/intrinsics/gen/atomicMin/278235.wgsl.expected.spvasm b/test/intrinsics/gen/atomicMin/278235.wgsl.expected.spvasm
index ef25b4f..4e939fd 100644
--- a/test/intrinsics/gen/atomicMin/278235.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/atomicMin/278235.wgsl.expected.spvasm
@@ -1,5 +1,15 @@
 SKIP: FAILED
 
 
-var<workgroup> arg_0 : 
+var<workgroup> arg_0 : atomic<i32>;
+
+fn atomicMin_278235() {
+  var res : i32 = atomicMin(&(arg_0), 1);
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_278235();
+}
+
 Failed to generate: unable to convert type: __atomic__i32
diff --git a/test/intrinsics/gen/atomicMin/278235.wgsl.expected.wgsl b/test/intrinsics/gen/atomicMin/278235.wgsl.expected.wgsl
index d42e421..ff99e71 100644
--- a/test/intrinsics/gen/atomicMin/278235.wgsl.expected.wgsl
+++ b/test/intrinsics/gen/atomicMin/278235.wgsl.expected.wgsl
@@ -1,5 +1,10 @@
-SKIP: FAILED
+var<workgroup> arg_0 : atomic<i32>;
 
+fn atomicMin_278235() {
+  var res : i32 = atomicMin(&(arg_0), 1);
+}
 
-var<workgroup> arg_0 : 
-Failed to generate: error: unknown type in EmitType: __atomic__i32
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_278235();
+}
diff --git a/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.hlsl b/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.hlsl
index 83c0306..b697f7f 100644
--- a/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.hlsl
+++ b/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.hlsl
@@ -1,5 +1,15 @@
 SKIP: FAILED
 
 
-var<workgroup> arg_0 : 
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicMin_69d383() {
+  var res : u32 = atomicMin(&(arg_0), 1u);
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_69d383();
+}
+
 Failed to generate: error: unknown type in EmitType
diff --git a/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.spvasm b/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.spvasm
index 9fdcd87..dfce4dd 100644
--- a/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.spvasm
@@ -1,5 +1,15 @@
 SKIP: FAILED
 
 
-var<workgroup> arg_0 : 
+var<workgroup> arg_0 : atomic<u32>;
+
+fn atomicMin_69d383() {
+  var res : u32 = atomicMin(&(arg_0), 1u);
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_69d383();
+}
+
 Failed to generate: unable to convert type: __atomic__u32
diff --git a/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.wgsl b/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.wgsl
index caa65d2..c2190ea 100644
--- a/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.wgsl
+++ b/test/intrinsics/gen/atomicMin/69d383.wgsl.expected.wgsl
@@ -1,5 +1,10 @@
-SKIP: FAILED
+var<workgroup> arg_0 : atomic<u32>;
 
+fn atomicMin_69d383() {
+  var res : u32 = atomicMin(&(arg_0), 1u);
+}
 
-var<workgroup> arg_0 : 
-Failed to generate: error: unknown type in EmitType: __atomic__u32
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_69d383();
+}
diff --git a/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.msl b/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.msl
index 6088b5a..dc15ddd 100644
--- a/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.msl
+++ b/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.msl
@@ -3,5 +3,23 @@
 
 [[block]]
 struct SB_RW {
-  arg_0 : 
+  arg_0 : atomic<i32>;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicMin_8e38dc() {
+  var res : i32 = atomicMin(&(sb_rw.arg_0), 1);
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  atomicMin_8e38dc();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_8e38dc();
+}
+
 Failed to generate: error: unknown type in EmitType: __atomic__i32
diff --git a/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.spvasm b/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.spvasm
index 17354c3..40fc25c 100644
--- a/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.spvasm
@@ -3,5 +3,23 @@
 
 [[block]]
 struct SB_RW {
-  arg_0 : 
+  arg_0 : atomic<i32>;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicMin_8e38dc() {
+  var res : i32 = atomicMin(&(sb_rw.arg_0), 1);
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  atomicMin_8e38dc();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_8e38dc();
+}
+
 Failed to generate: unable to convert type: __atomic__i32
diff --git a/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.wgsl b/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.wgsl
index 6088b5a..8630c15 100644
--- a/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.wgsl
+++ b/test/intrinsics/gen/atomicMin/8e38dc.wgsl.expected.wgsl
@@ -1,7 +1,20 @@
-SKIP: FAILED
-
-
 [[block]]
 struct SB_RW {
-  arg_0 : 
-Failed to generate: error: unknown type in EmitType: __atomic__i32
+  arg_0 : atomic<i32>;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicMin_8e38dc() {
+  var res : i32 = atomicMin(&(sb_rw.arg_0), 1);
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  atomicMin_8e38dc();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_8e38dc();
+}
diff --git a/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.msl b/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.msl
index 28d463e..1b28fe8 100644
--- a/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.msl
+++ b/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.msl
@@ -3,5 +3,23 @@
 
 [[block]]
 struct SB_RW {
-  arg_0 : 
+  arg_0 : atomic<u32>;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicMin_c67a74() {
+  var res : u32 = atomicMin(&(sb_rw.arg_0), 1u);
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  atomicMin_c67a74();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_c67a74();
+}
+
 Failed to generate: error: unknown type in EmitType: __atomic__u32
diff --git a/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.spvasm b/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.spvasm
index 1013691..cafcb6e 100644
--- a/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.spvasm
+++ b/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.spvasm
@@ -3,5 +3,23 @@
 
 [[block]]
 struct SB_RW {
-  arg_0 : 
+  arg_0 : atomic<u32>;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicMin_c67a74() {
+  var res : u32 = atomicMin(&(sb_rw.arg_0), 1u);
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  atomicMin_c67a74();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_c67a74();
+}
+
 Failed to generate: unable to convert type: __atomic__u32
diff --git a/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.wgsl b/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.wgsl
index 28d463e..d2b5c50 100644
--- a/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.wgsl
+++ b/test/intrinsics/gen/atomicMin/c67a74.wgsl.expected.wgsl
@@ -1,7 +1,20 @@
-SKIP: FAILED
-
-
 [[block]]
 struct SB_RW {
-  arg_0 : 
-Failed to generate: error: unknown type in EmitType: __atomic__u32
+  arg_0 : atomic<u32>;
+};
+
+[[group(0), binding(0)]] var<storage, read_write> sb_rw : SB_RW;
+
+fn atomicMin_c67a74() {
+  var res : u32 = atomicMin(&(sb_rw.arg_0), 1u);
+}
+
+[[stage(fragment)]]
+fn fragment_main() {
+  atomicMin_c67a74();
+}
+
+[[stage(compute)]]
+fn compute_main() {
+  atomicMin_c67a74();
+}