tint: Add tests showing tint:1332 is fixed
The abstract-numeric work has fixed this, by removing the error for
small floating point numbers.
Fixed: tint:1332
Change-Id: Ibf7382795210220d343d62fe22d201cf67db1ccc
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/92244
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
diff --git a/test/tint/bug/tint/1332.wgsl b/test/tint/bug/tint/1332.wgsl
new file mode 100644
index 0000000..985fccb
--- /dev/null
+++ b/test/tint/bug/tint/1332.wgsl
@@ -0,0 +1,5 @@
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ let a = 1.23;
+ var b = max(a, 1.17549435e-38);
+}
diff --git a/test/tint/bug/tint/1332.wgsl.expected.glsl b/test/tint/bug/tint/1332.wgsl.expected.glsl
new file mode 100644
index 0000000..ce7977b
--- /dev/null
+++ b/test/tint/bug/tint/1332.wgsl.expected.glsl
@@ -0,0 +1,11 @@
+#version 310 es
+
+void compute_main() {
+ float b = max(1.230000019f, 1.17549435e-38f);
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/bug/tint/1332.wgsl.expected.hlsl b/test/tint/bug/tint/1332.wgsl.expected.hlsl
new file mode 100644
index 0000000..6a9a78b
--- /dev/null
+++ b/test/tint/bug/tint/1332.wgsl.expected.hlsl
@@ -0,0 +1,5 @@
+[numthreads(1, 1, 1)]
+void compute_main() {
+ float b = max(1.230000019f, 1.17549435e-38f);
+ return;
+}
diff --git a/test/tint/bug/tint/1332.wgsl.expected.msl b/test/tint/bug/tint/1332.wgsl.expected.msl
new file mode 100644
index 0000000..57b645d
--- /dev/null
+++ b/test/tint/bug/tint/1332.wgsl.expected.msl
@@ -0,0 +1,9 @@
+#include <metal_stdlib>
+
+using namespace metal;
+kernel void compute_main() {
+ float const a = 1.230000019f;
+ float b = fmax(1.230000019f, 1.17549435e-38f);
+ return;
+}
+
diff --git a/test/tint/bug/tint/1332.wgsl.expected.spvasm b/test/tint/bug/tint/1332.wgsl.expected.spvasm
new file mode 100644
index 0000000..005dab5
--- /dev/null
+++ b/test/tint/bug/tint/1332.wgsl.expected.spvasm
@@ -0,0 +1,26 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 13
+; Schema: 0
+ OpCapability Shader
+ %8 = OpExtInstImport "GLSL.std.450"
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %compute_main "compute_main"
+ OpName %b "b"
+ %void = OpTypeVoid
+ %1 = OpTypeFunction %void
+ %float = OpTypeFloat 32
+%float_1_23000002 = OpConstant %float 1.23000002
+%float_1_17549435en38 = OpConstant %float 1.17549435e-38
+%_ptr_Function_float = OpTypePointer Function %float
+ %12 = OpConstantNull %float
+%compute_main = OpFunction %void None %1
+ %4 = OpLabel
+ %b = OpVariable %_ptr_Function_float Function %12
+ %7 = OpExtInst %float %8 NMax %float_1_23000002 %float_1_17549435en38
+ OpStore %b %7
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/bug/tint/1332.wgsl.expected.wgsl b/test/tint/bug/tint/1332.wgsl.expected.wgsl
new file mode 100644
index 0000000..c0ccd8d
--- /dev/null
+++ b/test/tint/bug/tint/1332.wgsl.expected.wgsl
@@ -0,0 +1,5 @@
+@stage(compute) @workgroup_size(1)
+fn compute_main() {
+ let a = 1.230000019;
+ var b = max(a, 1.17549435e-38);
+}