Fix generation of f16 values.
The generator script was not using the test values for `f16`, they
always got a zero initialization. This CL fixes the script to generate
`f16` values.
Change-Id: I95e8f2c7007251a646de05b4f7fe0aad14e740f8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109342
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl b/test/tint/builtins/gen/var/max/111ac0.wgsl
index 95fe46e..58ecced 100644
--- a/test/tint/builtins/gen/var/max/111ac0.wgsl
+++ b/test/tint/builtins/gen/var/max/111ac0.wgsl
@@ -25,8 +25,8 @@
// fn max(f16, f16) -> f16
fn max_111ac0() {
- var arg_0 = f16();
- var arg_1 = f16();
+ var arg_0 = 1.h;
+ var arg_1 = 1.h;
var res: f16 = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.dxc.hlsl
index 96099f3..9307bc9 100644
--- a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.dxc.hlsl
@@ -1,6 +1,6 @@
void max_111ac0() {
- float16_t arg_0 = float16_t(0.0h);
- float16_t arg_1 = float16_t(0.0h);
+ float16_t arg_0 = float16_t(1.0h);
+ float16_t arg_1 = float16_t(1.0h);
float16_t res = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.glsl
index e765053..826f121 100644
--- a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.glsl
@@ -2,8 +2,8 @@
#extension GL_AMD_gpu_shader_half_float : require
void max_111ac0() {
- float16_t arg_0 = 0.0hf;
- float16_t arg_1 = 0.0hf;
+ float16_t arg_0 = 1.0hf;
+ float16_t arg_1 = 1.0hf;
float16_t res = max(arg_0, arg_1);
}
@@ -25,8 +25,8 @@
precision mediump float;
void max_111ac0() {
- float16_t arg_0 = 0.0hf;
- float16_t arg_1 = 0.0hf;
+ float16_t arg_0 = 1.0hf;
+ float16_t arg_1 = 1.0hf;
float16_t res = max(arg_0, arg_1);
}
@@ -42,8 +42,8 @@
#extension GL_AMD_gpu_shader_half_float : require
void max_111ac0() {
- float16_t arg_0 = 0.0hf;
- float16_t arg_1 = 0.0hf;
+ float16_t arg_0 = 1.0hf;
+ float16_t arg_1 = 1.0hf;
float16_t res = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.msl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.msl
index 429db67..8e3b8c3 100644
--- a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.msl
@@ -2,8 +2,8 @@
using namespace metal;
void max_111ac0() {
- half arg_0 = 0.0h;
- half arg_1 = 0.0h;
+ half arg_0 = 1.0h;
+ half arg_1 = 1.0h;
half res = fmax(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.spvasm
index 379f8c7..234a5e0 100644
--- a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.spvasm
@@ -1,14 +1,14 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 37
+; Bound: 38
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %19 = OpExtInstImport "GLSL.std.450"
+ %20 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -38,42 +38,43 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
- %14 = OpConstantNull %half
+%half_0x1p_0 = OpConstant %half 0x1p+0
%_ptr_Function_half = OpTypePointer Function %half
- %23 = OpTypeFunction %v4float
+ %17 = OpConstantNull %half
+ %24 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%max_111ac0 = OpFunction %void None %9
%12 = OpLabel
- %arg_0 = OpVariable %_ptr_Function_half Function %14
- %arg_1 = OpVariable %_ptr_Function_half Function %14
- %res = OpVariable %_ptr_Function_half Function %14
- OpStore %arg_0 %14
- OpStore %arg_1 %14
- %20 = OpLoad %half %arg_0
- %21 = OpLoad %half %arg_1
- %18 = OpExtInst %half %19 NMax %20 %21
- OpStore %res %18
+ %arg_0 = OpVariable %_ptr_Function_half Function %17
+ %arg_1 = OpVariable %_ptr_Function_half Function %17
+ %res = OpVariable %_ptr_Function_half Function %17
+ OpStore %arg_0 %half_0x1p_0
+ OpStore %arg_1 %half_0x1p_0
+ %21 = OpLoad %half %arg_0
+ %22 = OpLoad %half %arg_1
+ %19 = OpExtInst %half %20 NMax %21 %22
+ OpStore %res %19
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %23
- %25 = OpLabel
- %26 = OpFunctionCall %void %max_111ac0
+%vertex_main_inner = OpFunction %v4float None %24
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %max_111ac0
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %28 = OpLabel
- %29 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %29
+ %29 = OpLabel
+ %30 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %30
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %max_111ac0
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %max_111ac0
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %35 = OpLabel
- %36 = OpFunctionCall %void %max_111ac0
+ %36 = OpLabel
+ %37 = OpFunctionCall %void %max_111ac0
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.wgsl
index b91b325..db1a126 100644
--- a/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/max/111ac0.wgsl.expected.wgsl
@@ -1,8 +1,8 @@
enable f16;
fn max_111ac0() {
- var arg_0 = f16();
- var arg_1 = f16();
+ var arg_0 = 1.0h;
+ var arg_1 = 1.0h;
var res : f16 = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl b/test/tint/builtins/gen/var/max/34956e.wgsl
index 600a3eb..ce58c35 100644
--- a/test/tint/builtins/gen/var/max/34956e.wgsl
+++ b/test/tint/builtins/gen/var/max/34956e.wgsl
@@ -25,8 +25,8 @@
// fn max(vec<2, f16>, vec<2, f16>) -> vec<2, f16>
fn max_34956e() {
- var arg_0 = vec2<f16>(f16());
- var arg_1 = vec2<f16>(f16());
+ var arg_0 = vec2<f16>(1.h);
+ var arg_1 = vec2<f16>(1.h);
var res: vec2<f16> = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.dxc.hlsl
index 60c2e2f..b634c66 100644
--- a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.dxc.hlsl
@@ -1,6 +1,6 @@
void max_34956e() {
- vector<float16_t, 2> arg_0 = (float16_t(0.0h)).xx;
- vector<float16_t, 2> arg_1 = (float16_t(0.0h)).xx;
+ vector<float16_t, 2> arg_0 = (float16_t(1.0h)).xx;
+ vector<float16_t, 2> arg_1 = (float16_t(1.0h)).xx;
vector<float16_t, 2> res = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.glsl
index 93be2e6..dfad11c 100644
--- a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.glsl
@@ -2,8 +2,8 @@
#extension GL_AMD_gpu_shader_half_float : require
void max_34956e() {
- f16vec2 arg_0 = f16vec2(0.0hf);
- f16vec2 arg_1 = f16vec2(0.0hf);
+ f16vec2 arg_0 = f16vec2(1.0hf);
+ f16vec2 arg_1 = f16vec2(1.0hf);
f16vec2 res = max(arg_0, arg_1);
}
@@ -25,8 +25,8 @@
precision mediump float;
void max_34956e() {
- f16vec2 arg_0 = f16vec2(0.0hf);
- f16vec2 arg_1 = f16vec2(0.0hf);
+ f16vec2 arg_0 = f16vec2(1.0hf);
+ f16vec2 arg_1 = f16vec2(1.0hf);
f16vec2 res = max(arg_0, arg_1);
}
@@ -42,8 +42,8 @@
#extension GL_AMD_gpu_shader_half_float : require
void max_34956e() {
- f16vec2 arg_0 = f16vec2(0.0hf);
- f16vec2 arg_1 = f16vec2(0.0hf);
+ f16vec2 arg_0 = f16vec2(1.0hf);
+ f16vec2 arg_1 = f16vec2(1.0hf);
f16vec2 res = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.msl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.msl
index c90bfeb..506f094 100644
--- a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.msl
@@ -2,8 +2,8 @@
using namespace metal;
void max_34956e() {
- half2 arg_0 = half2(0.0h);
- half2 arg_1 = half2(0.0h);
+ half2 arg_0 = half2(1.0h);
+ half2 arg_1 = half2(1.0h);
half2 res = fmax(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.spvasm
index f63b8cd..3702f75 100644
--- a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.spvasm
@@ -1,14 +1,14 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 38
+; Bound: 40
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %20 = OpExtInstImport "GLSL.std.450"
+ %22 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -39,42 +39,44 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
- %15 = OpConstantNull %v2half
+%half_0x1p_0 = OpConstant %half 0x1p+0
+ %16 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v2half = OpTypePointer Function %v2half
- %24 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v2half
+ %26 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%max_34956e = OpFunction %void None %9
%12 = OpLabel
- %arg_0 = OpVariable %_ptr_Function_v2half Function %15
- %arg_1 = OpVariable %_ptr_Function_v2half Function %15
- %res = OpVariable %_ptr_Function_v2half Function %15
- OpStore %arg_0 %15
- OpStore %arg_1 %15
- %21 = OpLoad %v2half %arg_0
- %22 = OpLoad %v2half %arg_1
- %19 = OpExtInst %v2half %20 NMax %21 %22
- OpStore %res %19
+ %arg_0 = OpVariable %_ptr_Function_v2half Function %19
+ %arg_1 = OpVariable %_ptr_Function_v2half Function %19
+ %res = OpVariable %_ptr_Function_v2half Function %19
+ OpStore %arg_0 %16
+ OpStore %arg_1 %16
+ %23 = OpLoad %v2half %arg_0
+ %24 = OpLoad %v2half %arg_1
+ %21 = OpExtInst %v2half %22 NMax %23 %24
+ OpStore %res %21
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %24
- %26 = OpLabel
- %27 = OpFunctionCall %void %max_34956e
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %max_34956e
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %30
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %33 = OpLabel
- %34 = OpFunctionCall %void %max_34956e
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %max_34956e
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %36 = OpLabel
- %37 = OpFunctionCall %void %max_34956e
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %max_34956e
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.wgsl
index 69327a8..3499673 100644
--- a/test/tint/builtins/gen/var/max/34956e.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/max/34956e.wgsl.expected.wgsl
@@ -1,8 +1,8 @@
enable f16;
fn max_34956e() {
- var arg_0 = vec2<f16>(f16());
- var arg_1 = vec2<f16>(f16());
+ var arg_0 = vec2<f16>(1.0h);
+ var arg_1 = vec2<f16>(1.0h);
var res : vec2<f16> = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/445169.wgsl b/test/tint/builtins/gen/var/max/445169.wgsl
index 24aad61..34b6472 100644
--- a/test/tint/builtins/gen/var/max/445169.wgsl
+++ b/test/tint/builtins/gen/var/max/445169.wgsl
@@ -25,8 +25,8 @@
// fn max(vec<3, f16>, vec<3, f16>) -> vec<3, f16>
fn max_445169() {
- var arg_0 = vec3<f16>(f16());
- var arg_1 = vec3<f16>(f16());
+ var arg_0 = vec3<f16>(1.h);
+ var arg_1 = vec3<f16>(1.h);
var res: vec3<f16> = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.dxc.hlsl
index 4b65af3..ca512f4 100644
--- a/test/tint/builtins/gen/var/max/445169.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.dxc.hlsl
@@ -1,6 +1,6 @@
void max_445169() {
- vector<float16_t, 3> arg_0 = (float16_t(0.0h)).xxx;
- vector<float16_t, 3> arg_1 = (float16_t(0.0h)).xxx;
+ vector<float16_t, 3> arg_0 = (float16_t(1.0h)).xxx;
+ vector<float16_t, 3> arg_1 = (float16_t(1.0h)).xxx;
vector<float16_t, 3> res = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.glsl
index a524e0f..58502c4 100644
--- a/test/tint/builtins/gen/var/max/445169.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.glsl
@@ -2,8 +2,8 @@
#extension GL_AMD_gpu_shader_half_float : require
void max_445169() {
- f16vec3 arg_0 = f16vec3(0.0hf);
- f16vec3 arg_1 = f16vec3(0.0hf);
+ f16vec3 arg_0 = f16vec3(1.0hf);
+ f16vec3 arg_1 = f16vec3(1.0hf);
f16vec3 res = max(arg_0, arg_1);
}
@@ -25,8 +25,8 @@
precision mediump float;
void max_445169() {
- f16vec3 arg_0 = f16vec3(0.0hf);
- f16vec3 arg_1 = f16vec3(0.0hf);
+ f16vec3 arg_0 = f16vec3(1.0hf);
+ f16vec3 arg_1 = f16vec3(1.0hf);
f16vec3 res = max(arg_0, arg_1);
}
@@ -42,8 +42,8 @@
#extension GL_AMD_gpu_shader_half_float : require
void max_445169() {
- f16vec3 arg_0 = f16vec3(0.0hf);
- f16vec3 arg_1 = f16vec3(0.0hf);
+ f16vec3 arg_0 = f16vec3(1.0hf);
+ f16vec3 arg_1 = f16vec3(1.0hf);
f16vec3 res = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.msl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.msl
index 3f2fe1e..2f8144d 100644
--- a/test/tint/builtins/gen/var/max/445169.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.msl
@@ -2,8 +2,8 @@
using namespace metal;
void max_445169() {
- half3 arg_0 = half3(0.0h);
- half3 arg_1 = half3(0.0h);
+ half3 arg_0 = half3(1.0h);
+ half3 arg_1 = half3(1.0h);
half3 res = fmax(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/445169.wgsl.expected.spvasm
index 5a3366e..6c31171 100644
--- a/test/tint/builtins/gen/var/max/445169.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.spvasm
@@ -1,14 +1,14 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 38
+; Bound: 40
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %20 = OpExtInstImport "GLSL.std.450"
+ %22 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -39,42 +39,44 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
- %15 = OpConstantNull %v3half
+%half_0x1p_0 = OpConstant %half 0x1p+0
+ %16 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v3half = OpTypePointer Function %v3half
- %24 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v3half
+ %26 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%max_445169 = OpFunction %void None %9
%12 = OpLabel
- %arg_0 = OpVariable %_ptr_Function_v3half Function %15
- %arg_1 = OpVariable %_ptr_Function_v3half Function %15
- %res = OpVariable %_ptr_Function_v3half Function %15
- OpStore %arg_0 %15
- OpStore %arg_1 %15
- %21 = OpLoad %v3half %arg_0
- %22 = OpLoad %v3half %arg_1
- %19 = OpExtInst %v3half %20 NMax %21 %22
- OpStore %res %19
+ %arg_0 = OpVariable %_ptr_Function_v3half Function %19
+ %arg_1 = OpVariable %_ptr_Function_v3half Function %19
+ %res = OpVariable %_ptr_Function_v3half Function %19
+ OpStore %arg_0 %16
+ OpStore %arg_1 %16
+ %23 = OpLoad %v3half %arg_0
+ %24 = OpLoad %v3half %arg_1
+ %21 = OpExtInst %v3half %22 NMax %23 %24
+ OpStore %res %21
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %24
- %26 = OpLabel
- %27 = OpFunctionCall %void %max_445169
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %max_445169
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %30
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %33 = OpLabel
- %34 = OpFunctionCall %void %max_445169
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %max_445169
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %36 = OpLabel
- %37 = OpFunctionCall %void %max_445169
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %max_445169
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/445169.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/445169.wgsl.expected.wgsl
index e21636f..56f7d93 100644
--- a/test/tint/builtins/gen/var/max/445169.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/max/445169.wgsl.expected.wgsl
@@ -1,8 +1,8 @@
enable f16;
fn max_445169() {
- var arg_0 = vec3<f16>(f16());
- var arg_1 = vec3<f16>(f16());
+ var arg_0 = vec3<f16>(1.0h);
+ var arg_1 = vec3<f16>(1.0h);
var res : vec3<f16> = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl
index 12fd3d9..c714541 100644
--- a/test/tint/builtins/gen/var/max/e14f2b.wgsl
+++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl
@@ -25,8 +25,8 @@
// fn max(vec<4, f16>, vec<4, f16>) -> vec<4, f16>
fn max_e14f2b() {
- var arg_0 = vec4<f16>(f16());
- var arg_1 = vec4<f16>(f16());
+ var arg_0 = vec4<f16>(1.h);
+ var arg_1 = vec4<f16>(1.h);
var res: vec4<f16> = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.dxc.hlsl
index c0f6659..f2e6da2 100644
--- a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.dxc.hlsl
@@ -1,6 +1,6 @@
void max_e14f2b() {
- vector<float16_t, 4> arg_0 = (float16_t(0.0h)).xxxx;
- vector<float16_t, 4> arg_1 = (float16_t(0.0h)).xxxx;
+ vector<float16_t, 4> arg_0 = (float16_t(1.0h)).xxxx;
+ vector<float16_t, 4> arg_1 = (float16_t(1.0h)).xxxx;
vector<float16_t, 4> res = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.glsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.glsl
index 9c13143..36d4e06 100644
--- a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.glsl
@@ -2,8 +2,8 @@
#extension GL_AMD_gpu_shader_half_float : require
void max_e14f2b() {
- f16vec4 arg_0 = f16vec4(0.0hf);
- f16vec4 arg_1 = f16vec4(0.0hf);
+ f16vec4 arg_0 = f16vec4(1.0hf);
+ f16vec4 arg_1 = f16vec4(1.0hf);
f16vec4 res = max(arg_0, arg_1);
}
@@ -25,8 +25,8 @@
precision mediump float;
void max_e14f2b() {
- f16vec4 arg_0 = f16vec4(0.0hf);
- f16vec4 arg_1 = f16vec4(0.0hf);
+ f16vec4 arg_0 = f16vec4(1.0hf);
+ f16vec4 arg_1 = f16vec4(1.0hf);
f16vec4 res = max(arg_0, arg_1);
}
@@ -42,8 +42,8 @@
#extension GL_AMD_gpu_shader_half_float : require
void max_e14f2b() {
- f16vec4 arg_0 = f16vec4(0.0hf);
- f16vec4 arg_1 = f16vec4(0.0hf);
+ f16vec4 arg_0 = f16vec4(1.0hf);
+ f16vec4 arg_1 = f16vec4(1.0hf);
f16vec4 res = max(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.msl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.msl
index 4410e6f..919b3f9 100644
--- a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.msl
@@ -2,8 +2,8 @@
using namespace metal;
void max_e14f2b() {
- half4 arg_0 = half4(0.0h);
- half4 arg_1 = half4(0.0h);
+ half4 arg_0 = half4(1.0h);
+ half4 arg_1 = half4(1.0h);
half4 res = fmax(arg_0, arg_1);
}
diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.spvasm
index 99fc971..11eb171 100644
--- a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.spvasm
@@ -1,14 +1,14 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 38
+; Bound: 40
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %20 = OpExtInstImport "GLSL.std.450"
+ %22 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -39,42 +39,44 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
- %15 = OpConstantNull %v4half
+%half_0x1p_0 = OpConstant %half 0x1p+0
+ %16 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v4half = OpTypePointer Function %v4half
- %24 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v4half
+ %26 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%max_e14f2b = OpFunction %void None %9
%12 = OpLabel
- %arg_0 = OpVariable %_ptr_Function_v4half Function %15
- %arg_1 = OpVariable %_ptr_Function_v4half Function %15
- %res = OpVariable %_ptr_Function_v4half Function %15
- OpStore %arg_0 %15
- OpStore %arg_1 %15
- %21 = OpLoad %v4half %arg_0
- %22 = OpLoad %v4half %arg_1
- %19 = OpExtInst %v4half %20 NMax %21 %22
- OpStore %res %19
+ %arg_0 = OpVariable %_ptr_Function_v4half Function %19
+ %arg_1 = OpVariable %_ptr_Function_v4half Function %19
+ %res = OpVariable %_ptr_Function_v4half Function %19
+ OpStore %arg_0 %16
+ OpStore %arg_1 %16
+ %23 = OpLoad %v4half %arg_0
+ %24 = OpLoad %v4half %arg_1
+ %21 = OpExtInst %v4half %22 NMax %23 %24
+ OpStore %res %21
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %24
- %26 = OpLabel
- %27 = OpFunctionCall %void %max_e14f2b
+%vertex_main_inner = OpFunction %v4float None %26
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %max_e14f2b
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %30
+ %31 = OpLabel
+ %32 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %32
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %33 = OpLabel
- %34 = OpFunctionCall %void %max_e14f2b
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %max_e14f2b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %36 = OpLabel
- %37 = OpFunctionCall %void %max_e14f2b
+ %38 = OpLabel
+ %39 = OpFunctionCall %void %max_e14f2b
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.wgsl
index 446f509..7473f10 100644
--- a/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/max/e14f2b.wgsl.expected.wgsl
@@ -1,8 +1,8 @@
enable f16;
fn max_e14f2b() {
- var arg_0 = vec4<f16>(f16());
- var arg_1 = vec4<f16>(f16());
+ var arg_0 = vec4<f16>(1.0h);
+ var arg_1 = vec4<f16>(1.0h);
var res : vec4<f16> = max(arg_0, arg_1);
}