Add const-eval for `floor`.
This Cl adds const-eval for the `floor` builtin.
Bug: tint:1581
Change-Id: I992eba3aa6c66707e923907a4bb912c2f6f8d290
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108343
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def
index e0656cb..14b00f8 100644
--- a/src/tint/intrinsics.def
+++ b/src/tint/intrinsics.def
@@ -471,8 +471,8 @@
@const fn firstLeadingBit<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
@const fn firstTrailingBit<T: iu32>(T) -> T
@const fn firstTrailingBit<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
-fn floor<T: f32_f16>(T) -> T
-fn floor<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
+@const fn floor<T: fa_f32_f16>(@test_value(1.5) T) -> T
+@const fn floor<N: num, T: fa_f32_f16>(@test_value(1.5) vec<N, T>) -> vec<N, T>
fn fma<T: f32_f16>(T, T, T) -> T
fn fma<N: num, T: f32_f16>(vec<N, T>, vec<N, T>, vec<N, T>) -> vec<N, T>
fn fract<T: f32_f16>(T) -> T
diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc
index f32d807..b8c4d56 100644
--- a/src/tint/resolver/const_eval.cc
+++ b/src/tint/resolver/const_eval.cc
@@ -1905,6 +1905,18 @@
return TransformElements(builder, ty, transform, args[0]);
}
+ConstEval::Result ConstEval::floor(const sem::Type* ty,
+ utils::VectorRef<const sem::Constant*> args,
+ const Source&) {
+ auto transform = [&](const sem::Constant* c0) {
+ auto create = [&](auto e) {
+ return CreateElement(builder, c0->Type(), decltype(e)(std::floor(e)));
+ };
+ return Dispatch_fa_f32_f16(create, c0);
+ };
+ return TransformElements(builder, ty, transform, args[0]);
+}
+
ConstEval::Result ConstEval::insertBits(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source) {
diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h
index 3f83c71..a2a2dd1 100644
--- a/src/tint/resolver/const_eval.h
+++ b/src/tint/resolver/const_eval.h
@@ -530,6 +530,15 @@
utils::VectorRef<const sem::Constant*> args,
const Source& source);
+ /// floor builtin
+ /// @param ty the expression type
+ /// @param args the input arguments
+ /// @param source the source location of the conversion
+ /// @return the result value, or null if the value cannot be calculated
+ Result floor(const sem::Type* ty,
+ utils::VectorRef<const sem::Constant*> args,
+ const Source& source);
+
/// insertBits builtin
/// @param ty the expression type
/// @param args the input arguments
diff --git a/src/tint/resolver/const_eval_builtin_test.cc b/src/tint/resolver/const_eval_builtin_test.cc
index 4943e3d..be01921 100644
--- a/src/tint/resolver/const_eval_builtin_test.cc
+++ b/src/tint/resolver/const_eval_builtin_test.cc
@@ -884,6 +884,37 @@
testing::ValuesIn(Concat(FirstTrailingBitCases<i32>(), //
FirstTrailingBitCases<u32>()))));
+template <typename T, bool finite_only>
+std::vector<Case> FloorCases() {
+ std::vector<Case> cases = {
+ C({T(0)}, T(0)),
+ C({-T(0)}, -T(0)),
+ C({-T(1.5)}, -T(2.0)),
+ C({T(1.5)}, T(1.0)),
+ C({T::Lowest()}, T::Lowest()),
+ C({T::Highest()}, T::Highest()),
+
+ C({Vec(T(0), T(1.5), -T(1.5))}, Vec(T(0), T(1.0), -T(2.0))),
+ };
+
+ ConcatIntoIf<!finite_only>(
+ cases, std::vector<Case>{
+ C({-T::Inf()}, -T::Inf()),
+ C({T::Inf()}, T::Inf()),
+ C({T::NaN()}, T::NaN()),
+ C({Vec(-T::Inf(), T::Inf(), T::NaN())}, Vec(-T::Inf(), T::Inf(), T::NaN())),
+ });
+
+ return cases;
+}
+INSTANTIATE_TEST_SUITE_P( //
+ Floor,
+ ResolverConstEvalBuiltinTest,
+ testing::Combine(testing::Values(sem::BuiltinType::kFloor),
+ testing::ValuesIn(Concat(FloorCases<AFloat, true>(),
+ FloorCases<f32, false>(),
+ FloorCases<f16, false>()))));
+
template <typename T>
std::vector<Case> InsertBitsCases() {
using UT = Number<std::make_unsigned_t<UnwrapNumber<T>>>;
diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl
index ec6c4bf..307843c 100644
--- a/src/tint/resolver/intrinsic_table.inl
+++ b/src/tint/resolver/intrinsic_table.inl
@@ -12153,24 +12153,24 @@
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 0,
- /* template types */ &kTemplateTypes[22],
+ /* template types */ &kTemplateTypes[23],
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[908],
/* return matcher indices */ &kMatcherIndices[1],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* const eval */ nullptr,
+ /* const eval */ &ConstEval::floor,
},
{
/* [319] */
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 1,
- /* template types */ &kTemplateTypes[22],
+ /* template types */ &kTemplateTypes[23],
/* template numbers */ &kTemplateNumbers[6],
/* parameters */ &kParameters[907],
/* return matcher indices */ &kMatcherIndices[30],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* const eval */ nullptr,
+ /* const eval */ &ConstEval::floor,
},
{
/* [320] */
@@ -14265,8 +14265,8 @@
},
{
/* [37] */
- /* fn floor<T : f32_f16>(T) -> T */
- /* fn floor<N : num, T : f32_f16>(vec<N, T>) -> vec<N, T> */
+ /* fn floor<T : fa_f32_f16>(@test_value(1.5) T) -> T */
+ /* fn floor<N : num, T : fa_f32_f16>(@test_value(1.5) vec<N, T>) -> vec<N, T> */
/* num overloads */ 2,
/* overloads */ &kOverloads[318],
},
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl b/test/tint/builtins/gen/literal/floor/218952.wgsl
new file mode 100644
index 0000000..cc3c8e6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl
@@ -0,0 +1,43 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(vec<4, fa>) -> vec<4, fa>
+fn floor_218952() {
+ var res = floor(vec4(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_218952();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_218952();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_218952();
+}
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e05e05a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void floor_218952() {
+ float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_218952();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_218952();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_218952();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e05e05a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void floor_218952() {
+ float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_218952();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_218952();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_218952();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.glsl
new file mode 100644
index 0000000..63dedc1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void floor_218952() {
+ vec4 res = vec4(1.0f);
+}
+
+vec4 vertex_main() {
+ floor_218952();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void floor_218952() {
+ vec4 res = vec4(1.0f);
+}
+
+void fragment_main() {
+ floor_218952();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_218952() {
+ vec4 res = vec4(1.0f);
+}
+
+void compute_main() {
+ floor_218952();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.msl
new file mode 100644
index 0000000..9c419db
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_218952() {
+ float4 res = float4(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_218952();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_218952();
+ return;
+}
+
+kernel void compute_main() {
+ floor_218952();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.spvasm
new file mode 100644
index 0000000..34d7ace
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.spvasm
@@ -0,0 +1,64 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %floor_218952 "floor_218952"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+%floor_218952 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %17
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %floor_218952
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %22 = OpLabel
+ %23 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %23
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %floor_218952
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %floor_218952
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.wgsl
new file mode 100644
index 0000000..95bbf50
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn floor_218952() {
+ var res = floor(vec4(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_218952();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_218952();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_218952();
+}
diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl
index abaa1f3..9974a5b 100644
--- a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_3802c0() {
- vector<float16_t, 3> res = floor((float16_t(0.0h)).xxx);
+ vector<float16_t, 3> res = (float16_t(0.0h)).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl
index 0ffee0a..1007c7d 100644
--- a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void floor_3802c0() {
- f16vec3 res = floor(f16vec3(0.0hf));
+ f16vec3 res = f16vec3(0.0hf);
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void floor_3802c0() {
- f16vec3 res = floor(f16vec3(0.0hf));
+ f16vec3 res = f16vec3(0.0hf);
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void floor_3802c0() {
- f16vec3 res = floor(f16vec3(0.0hf));
+ f16vec3 res = f16vec3(0.0hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl
index b74bfc8..90432ad 100644
--- a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_3802c0() {
- half3 res = floor(half3(0.0h));
+ half3 res = half3(0.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm
index 840d0b0..51bbbe3 100644
--- a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,36 +36,35 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
- %17 = OpConstantNull %v3half
+ %15 = OpConstantNull %v3half
%_ptr_Function_v3half = OpTypePointer Function %v3half
- %20 = OpTypeFunction %v4float
+ %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%floor_3802c0 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v3half Function %17
- %13 = OpExtInst %v3half %16 Floor %17
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v3half Function %15
+ OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %20
- %22 = OpLabel
- %23 = OpFunctionCall %void %floor_3802c0
+%vertex_main_inner = OpFunction %v4float None %18
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %floor_3802c0
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %25 = OpLabel
- %26 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %26
+ %23 = OpLabel
+ %24 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %floor_3802c0
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_3802c0
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %floor_3802c0
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_3802c0
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl
index 2f2e73c..7a3f3f9 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl
@@ -23,7 +23,7 @@
// fn floor(vec<4, f32>) -> vec<4, f32>
fn floor_3bccc4() {
- var res: vec4<f32> = floor(vec4<f32>(1.f));
+ var res: vec4<f32> = floor(vec4<f32>(1.5f));
}
@vertex
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl
index 4f77c08..b03dea0 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_3bccc4() {
- float4 res = floor((1.0f).xxxx);
+ float4 res = (1.0f).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl
index 4f77c08..b03dea0 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void floor_3bccc4() {
- float4 res = floor((1.0f).xxxx);
+ float4 res = (1.0f).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl
index a37a4dc..fd41de5 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void floor_3bccc4() {
- vec4 res = floor(vec4(1.0f));
+ vec4 res = vec4(1.0f);
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void floor_3bccc4() {
- vec4 res = floor(vec4(1.0f));
+ vec4 res = vec4(1.0f);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void floor_3bccc4() {
- vec4 res = floor(vec4(1.0f));
+ vec4 res = vec4(1.0f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl
index a5d5b84..f9859d0 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_3bccc4() {
- float4 res = floor(float4(1.0f));
+ float4 res = float4(1.0f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm
index d9dd56b..0cb7fdd 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 30
; Schema: 0
OpCapability Shader
- %14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -32,35 +31,34 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
- %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+ %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %19 = OpTypeFunction %v4float
+ %17 = OpTypeFunction %v4float
%floor_3bccc4 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %13 = OpExtInst %v4float %14 Floor %16
- OpStore %res %13
+ OpStore %res %14
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
- %21 = OpLabel
- %22 = OpFunctionCall %void %floor_3bccc4
+%vertex_main_inner = OpFunction %v4float None %17
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %floor_3bccc4
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %24 = OpLabel
- %25 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %25
+ %22 = OpLabel
+ %23 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %27 = OpLabel
- %28 = OpFunctionCall %void %floor_3bccc4
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %floor_3bccc4
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %30 = OpLabel
- %31 = OpFunctionCall %void %floor_3bccc4
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %floor_3bccc4
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl
index 1ad4e28..27a31b1 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
fn floor_3bccc4() {
- var res : vec4<f32> = floor(vec4<f32>(1.0f));
+ var res : vec4<f32> = floor(vec4<f32>(1.5f));
}
@vertex
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl
index 9f138ce..325929f 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl
@@ -23,7 +23,7 @@
// fn floor(vec<2, f32>) -> vec<2, f32>
fn floor_5fc9ac() {
- var res: vec2<f32> = floor(vec2<f32>(1.f));
+ var res: vec2<f32> = floor(vec2<f32>(1.5f));
}
@vertex
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl
index 80235f7..b1a6fb9 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_5fc9ac() {
- float2 res = floor((1.0f).xx);
+ float2 res = (1.0f).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl
index 80235f7..b1a6fb9 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void floor_5fc9ac() {
- float2 res = floor((1.0f).xx);
+ float2 res = (1.0f).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl
index 6148241..fdb4ad0 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void floor_5fc9ac() {
- vec2 res = floor(vec2(1.0f));
+ vec2 res = vec2(1.0f);
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void floor_5fc9ac() {
- vec2 res = floor(vec2(1.0f));
+ vec2 res = vec2(1.0f);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void floor_5fc9ac() {
- vec2 res = floor(vec2(1.0f));
+ vec2 res = vec2(1.0f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl
index ccc2e38..914af9f 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_5fc9ac() {
- float2 res = floor(float2(1.0f));
+ float2 res = float2(1.0f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm
index 6396eb7..5e6c220 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
- %15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -33,36 +32,35 @@
%9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
- %17 = OpConstantComposite %v2float %float_1 %float_1
+ %15 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float
- %20 = OpConstantNull %v2float
- %21 = OpTypeFunction %v4float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
%floor_5fc9ac = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v2float Function %20
- %13 = OpExtInst %v2float %15 Floor %17
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v2float Function %18
+ OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %21
- %23 = OpLabel
- %24 = OpFunctionCall %void %floor_5fc9ac
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %floor_5fc9ac
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %26 = OpLabel
- %27 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %27
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %floor_5fc9ac
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_5fc9ac
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %floor_5fc9ac
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_5fc9ac
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl
index caa7581..f40f05d 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
fn floor_5fc9ac() {
- var res : vec2<f32> = floor(vec2<f32>(1.0f));
+ var res : vec2<f32> = floor(vec2<f32>(1.5f));
}
@vertex
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl
index 764a472..0d4e4d2 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl
@@ -23,7 +23,7 @@
// fn floor(vec<3, f32>) -> vec<3, f32>
fn floor_60d7ea() {
- var res: vec3<f32> = floor(vec3<f32>(1.f));
+ var res: vec3<f32> = floor(vec3<f32>(1.5f));
}
@vertex
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl
index 726fd06..58338f6 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_60d7ea() {
- float3 res = floor((1.0f).xxx);
+ float3 res = (1.0f).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl
index 726fd06..58338f6 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void floor_60d7ea() {
- float3 res = floor((1.0f).xxx);
+ float3 res = (1.0f).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl
index 38ae3c1..95e670d 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void floor_60d7ea() {
- vec3 res = floor(vec3(1.0f));
+ vec3 res = vec3(1.0f);
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void floor_60d7ea() {
- vec3 res = floor(vec3(1.0f));
+ vec3 res = vec3(1.0f);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void floor_60d7ea() {
- vec3 res = floor(vec3(1.0f));
+ vec3 res = vec3(1.0f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl
index cc96d6f..c12a659 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_60d7ea() {
- float3 res = floor(float3(1.0f));
+ float3 res = float3(1.0f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm
index 77f3517..73458d9 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
- %15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -33,36 +32,35 @@
%9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
- %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+ %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v3float = OpTypePointer Function %v3float
- %20 = OpConstantNull %v3float
- %21 = OpTypeFunction %v4float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
%floor_60d7ea = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v3float Function %20
- %13 = OpExtInst %v3float %15 Floor %17
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v3float Function %18
+ OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %21
- %23 = OpLabel
- %24 = OpFunctionCall %void %floor_60d7ea
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %floor_60d7ea
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %26 = OpLabel
- %27 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %27
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %floor_60d7ea
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_60d7ea
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %floor_60d7ea
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_60d7ea
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl
index 1403c17..8fcf9a8 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
fn floor_60d7ea() {
- var res : vec3<f32> = floor(vec3<f32>(1.0f));
+ var res : vec3<f32> = floor(vec3<f32>(1.5f));
}
@vertex
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl
index 520664b..a04339a 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl
@@ -23,7 +23,7 @@
// fn floor(f32) -> f32
fn floor_66f154() {
- var res: f32 = floor(1.f);
+ var res: f32 = floor(1.5f);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl
index 89b5a35..c0791ae 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_66f154() {
- float res = floor(1.0f);
+ float res = 1.0f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl
index 89b5a35..c0791ae 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void floor_66f154() {
- float res = floor(1.0f);
+ float res = 1.0f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl
index 26dcf94..07a4a27 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void floor_66f154() {
- float res = floor(1.0f);
+ float res = 1.0f;
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void floor_66f154() {
- float res = floor(1.0f);
+ float res = 1.0f;
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void floor_66f154() {
- float res = floor(1.0f);
+ float res = 1.0f;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl
index ca6f3e8..9f7a0cd 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_66f154() {
- float res = floor(1.0f);
+ float res = 1.0f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.spvasm
index ca6e9fa..9e74538 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 29
; Schema: 0
OpCapability Shader
- %14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -33,33 +32,32 @@
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
- %18 = OpTypeFunction %v4float
+ %16 = OpTypeFunction %v4float
%floor_66f154 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
- %13 = OpExtInst %float %14 Floor %float_1
- OpStore %res %13
+ OpStore %res %float_1
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %18
- %20 = OpLabel
- %21 = OpFunctionCall %void %floor_66f154
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %floor_66f154
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %23 = OpLabel
- %24 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %24
+ %21 = OpLabel
+ %22 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %22
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %26 = OpLabel
- %27 = OpFunctionCall %void %floor_66f154
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %floor_66f154
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %floor_66f154
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_66f154
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl
index 2451e66..a665083 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
fn floor_66f154() {
- var res : f32 = floor(1.0f);
+ var res : f32 = floor(1.5f);
}
@vertex
diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl
index 9d9b33b..5f5a3b6 100644
--- a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_84658c() {
- vector<float16_t, 2> res = floor((float16_t(0.0h)).xx);
+ vector<float16_t, 2> res = (float16_t(0.0h)).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl
index 5ce59ff..ef5b290 100644
--- a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void floor_84658c() {
- f16vec2 res = floor(f16vec2(0.0hf));
+ f16vec2 res = f16vec2(0.0hf);
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void floor_84658c() {
- f16vec2 res = floor(f16vec2(0.0hf));
+ f16vec2 res = f16vec2(0.0hf);
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void floor_84658c() {
- f16vec2 res = floor(f16vec2(0.0hf));
+ f16vec2 res = f16vec2(0.0hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl
index 8167d86..5ee3802 100644
--- a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_84658c() {
- half2 res = floor(half2(0.0h));
+ half2 res = half2(0.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm
index 2ba5308..72b7f51 100644
--- a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,36 +36,35 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
- %17 = OpConstantNull %v2half
+ %15 = OpConstantNull %v2half
%_ptr_Function_v2half = OpTypePointer Function %v2half
- %20 = OpTypeFunction %v4float
+ %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%floor_84658c = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v2half Function %17
- %13 = OpExtInst %v2half %16 Floor %17
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v2half Function %15
+ OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %20
- %22 = OpLabel
- %23 = OpFunctionCall %void %floor_84658c
+%vertex_main_inner = OpFunction %v4float None %18
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %floor_84658c
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %25 = OpLabel
- %26 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %26
+ %23 = OpLabel
+ %24 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %floor_84658c
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_84658c
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %floor_84658c
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_84658c
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl b/test/tint/builtins/gen/literal/floor/953774.wgsl
new file mode 100644
index 0000000..39a37a0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl
@@ -0,0 +1,43 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(vec<3, fa>) -> vec<3, fa>
+fn floor_953774() {
+ var res = floor(vec3(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_953774();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_953774();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_953774();
+}
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b31726b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void floor_953774() {
+ float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_953774();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_953774();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_953774();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b31726b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void floor_953774() {
+ float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_953774();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_953774();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_953774();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.glsl
new file mode 100644
index 0000000..d5c3a05
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void floor_953774() {
+ vec3 res = vec3(1.0f);
+}
+
+vec4 vertex_main() {
+ floor_953774();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void floor_953774() {
+ vec3 res = vec3(1.0f);
+}
+
+void fragment_main() {
+ floor_953774();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_953774() {
+ vec3 res = vec3(1.0f);
+}
+
+void compute_main() {
+ floor_953774();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.msl
new file mode 100644
index 0000000..f717392
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_953774() {
+ float3 res = float3(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_953774();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_953774();
+ return;
+}
+
+kernel void compute_main() {
+ floor_953774();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.spvasm
new file mode 100644
index 0000000..5349ca5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %floor_953774 "floor_953774"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+%floor_953774 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v3float Function %18
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %floor_953774
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_953774
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_953774
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.wgsl
new file mode 100644
index 0000000..7cb39a8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn floor_953774() {
+ var res = floor(vec3(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_953774();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_953774();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_953774();
+}
diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl
index 8df627e..334112b 100644
--- a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_a2d31b() {
- vector<float16_t, 4> res = floor((float16_t(0.0h)).xxxx);
+ vector<float16_t, 4> res = (float16_t(0.0h)).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl
index fa86b13..4d06c11 100644
--- a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void floor_a2d31b() {
- f16vec4 res = floor(f16vec4(0.0hf));
+ f16vec4 res = f16vec4(0.0hf);
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void floor_a2d31b() {
- f16vec4 res = floor(f16vec4(0.0hf));
+ f16vec4 res = f16vec4(0.0hf);
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void floor_a2d31b() {
- f16vec4 res = floor(f16vec4(0.0hf));
+ f16vec4 res = f16vec4(0.0hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl
index 11dab7e..0e3e4ee 100644
--- a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_a2d31b() {
- half4 res = floor(half4(0.0h));
+ half4 res = half4(0.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm
index f54987e..a877d97 100644
--- a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,36 +36,35 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
- %17 = OpConstantNull %v4half
+ %15 = OpConstantNull %v4half
%_ptr_Function_v4half = OpTypePointer Function %v4half
- %20 = OpTypeFunction %v4float
+ %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%floor_a2d31b = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v4half Function %17
- %13 = OpExtInst %v4half %16 Floor %17
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v4half Function %15
+ OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %20
- %22 = OpLabel
- %23 = OpFunctionCall %void %floor_a2d31b
+%vertex_main_inner = OpFunction %v4float None %18
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %floor_a2d31b
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %25 = OpLabel
- %26 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %26
+ %23 = OpLabel
+ %24 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %floor_a2d31b
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_a2d31b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %floor_a2d31b
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_a2d31b
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl
index 4e9023c..13f7908 100644
--- a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_b6e09c() {
- float16_t res = floor(float16_t(0.0h));
+ float16_t res = float16_t(0.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl
index 9e3b55d..3970d69 100644
--- a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void floor_b6e09c() {
- float16_t res = floor(0.0hf);
+ float16_t res = 0.0hf;
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void floor_b6e09c() {
- float16_t res = floor(0.0hf);
+ float16_t res = 0.0hf;
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void floor_b6e09c() {
- float16_t res = floor(0.0hf);
+ float16_t res = 0.0hf;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl
index 5123ed2..5f14018 100644
--- a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_b6e09c() {
- half res = floor(0.0h);
+ half res = 0.0h;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm
index 4d351dd..8e6ff79 100644
--- a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 33
+; Bound: 31
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -36,36 +35,35 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
- %16 = OpConstantNull %half
+ %14 = OpConstantNull %half
%_ptr_Function_half = OpTypePointer Function %half
- %19 = OpTypeFunction %v4float
+ %17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%floor_b6e09c = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_half Function %16
- %13 = OpExtInst %half %15 Floor %16
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_half Function %14
+ OpStore %res %14
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
- %21 = OpLabel
- %22 = OpFunctionCall %void %floor_b6e09c
+%vertex_main_inner = OpFunction %v4float None %17
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %floor_b6e09c
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %24 = OpLabel
- %25 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %25
+ %22 = OpLabel
+ %23 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %23
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %28 = OpLabel
- %29 = OpFunctionCall %void %floor_b6e09c
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %floor_b6e09c
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %floor_b6e09c
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %floor_b6e09c
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl
new file mode 100644
index 0000000..8e20f51
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl
@@ -0,0 +1,43 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(fa) -> fa
+fn floor_dcd5a2() {
+ var res = floor(1.5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_dcd5a2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_dcd5a2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_dcd5a2();
+}
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e7f8650
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_dcd5a2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_dcd5a2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_dcd5a2();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e7f8650
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_dcd5a2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_dcd5a2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_dcd5a2();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.glsl
new file mode 100644
index 0000000..d2d4681
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+vec4 vertex_main() {
+ floor_dcd5a2();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+void fragment_main() {
+ floor_dcd5a2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+void compute_main() {
+ floor_dcd5a2();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.msl
new file mode 100644
index 0000000..396fa07
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_dcd5a2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_dcd5a2();
+ return;
+}
+
+kernel void compute_main() {
+ floor_dcd5a2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.spvasm
new file mode 100644
index 0000000..ad4f786
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %floor_dcd5a2 "floor_dcd5a2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+%floor_dcd5a2 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_1
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %floor_dcd5a2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %21 = OpLabel
+ %22 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %22
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %floor_dcd5a2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_dcd5a2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.wgsl
new file mode 100644
index 0000000..7befeb5
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn floor_dcd5a2() {
+ var res = floor(1.5);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_dcd5a2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_dcd5a2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_dcd5a2();
+}
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl
new file mode 100644
index 0000000..341157d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl
@@ -0,0 +1,43 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(vec<2, fa>) -> vec<2, fa>
+fn floor_e585ef() {
+ var res = floor(vec2(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_e585ef();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_e585ef();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_e585ef();
+}
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..c988d3c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void floor_e585ef() {
+ float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_e585ef();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_e585ef();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_e585ef();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..c988d3c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void floor_e585ef() {
+ float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_e585ef();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_e585ef();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_e585ef();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.glsl
new file mode 100644
index 0000000..f6dd7ae
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void floor_e585ef() {
+ vec2 res = vec2(1.0f);
+}
+
+vec4 vertex_main() {
+ floor_e585ef();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void floor_e585ef() {
+ vec2 res = vec2(1.0f);
+}
+
+void fragment_main() {
+ floor_e585ef();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_e585ef() {
+ vec2 res = vec2(1.0f);
+}
+
+void compute_main() {
+ floor_e585ef();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.msl
new file mode 100644
index 0000000..862988b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_e585ef() {
+ float2 res = float2(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_e585ef();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_e585ef();
+ return;
+}
+
+kernel void compute_main() {
+ floor_e585ef();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.spvasm
new file mode 100644
index 0000000..3b4d9f3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %floor_e585ef "floor_e585ef"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantComposite %v2float %float_1 %float_1
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+%floor_e585ef = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v2float Function %18
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %floor_e585ef
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_e585ef
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_e585ef
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.wgsl
new file mode 100644
index 0000000..607b8d8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn floor_e585ef() {
+ var res = floor(vec2(1.5));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_e585ef();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_e585ef();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_e585ef();
+}
diff --git a/test/tint/builtins/gen/var/floor/218952.wgsl b/test/tint/builtins/gen/var/floor/218952.wgsl
new file mode 100644
index 0000000..f90b4af
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/218952.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(vec<4, fa>) -> vec<4, fa>
+fn floor_218952() {
+ const arg_0 = vec4(1.5);
+ var res = floor(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_218952();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_218952();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_218952();
+}
diff --git a/test/tint/builtins/gen/var/floor/218952.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e05e05a
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void floor_218952() {
+ float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_218952();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_218952();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_218952();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/218952.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e05e05a
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void floor_218952() {
+ float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_218952();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_218952();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_218952();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/218952.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.glsl
new file mode 100644
index 0000000..63dedc1
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void floor_218952() {
+ vec4 res = vec4(1.0f);
+}
+
+vec4 vertex_main() {
+ floor_218952();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void floor_218952() {
+ vec4 res = vec4(1.0f);
+}
+
+void fragment_main() {
+ floor_218952();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_218952() {
+ vec4 res = vec4(1.0f);
+}
+
+void compute_main() {
+ floor_218952();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/218952.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.msl
new file mode 100644
index 0000000..9c419db
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_218952() {
+ float4 res = float4(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_218952();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_218952();
+ return;
+}
+
+kernel void compute_main() {
+ floor_218952();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/floor/218952.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.spvasm
new file mode 100644
index 0000000..34d7ace
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.spvasm
@@ -0,0 +1,64 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 30
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %floor_218952 "floor_218952"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+%floor_218952 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v4float Function %5
+ OpStore %res %14
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %17
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %floor_218952
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %22 = OpLabel
+ %23 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %23
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %floor_218952
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %floor_218952
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/218952.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.wgsl
new file mode 100644
index 0000000..03525b1
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/218952.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn floor_218952() {
+ const arg_0 = vec4(1.5);
+ var res = floor(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_218952();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_218952();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_218952();
+}
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl
index 6f1745a..c6aaa67 100644
--- a/test/tint/builtins/gen/var/floor/3bccc4.wgsl
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl
@@ -23,7 +23,7 @@
// fn floor(vec<4, f32>) -> vec<4, f32>
fn floor_3bccc4() {
- var arg_0 = vec4<f32>(1.f);
+ var arg_0 = vec4<f32>(1.5f);
var res: vec4<f32> = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.dxc.hlsl
index 550e52d..210bcae 100644
--- a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_3bccc4() {
- float4 arg_0 = (1.0f).xxxx;
+ float4 arg_0 = (1.5f).xxxx;
float4 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.fxc.hlsl
index 550e52d..210bcae 100644
--- a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void floor_3bccc4() {
- float4 arg_0 = (1.0f).xxxx;
+ float4 arg_0 = (1.5f).xxxx;
float4 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl
index 431bdef..736b533 100644
--- a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void floor_3bccc4() {
- vec4 arg_0 = vec4(1.0f);
+ vec4 arg_0 = vec4(1.5f);
vec4 res = floor(arg_0);
}
@@ -22,7 +22,7 @@
precision mediump float;
void floor_3bccc4() {
- vec4 arg_0 = vec4(1.0f);
+ vec4 arg_0 = vec4(1.5f);
vec4 res = floor(arg_0);
}
@@ -37,7 +37,7 @@
#version 310 es
void floor_3bccc4() {
- vec4 arg_0 = vec4(1.0f);
+ vec4 arg_0 = vec4(1.5f);
vec4 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl
index b9607dc..95536b4 100644
--- a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_3bccc4() {
- float4 arg_0 = float4(1.0f);
+ float4 arg_0 = float4(1.5f);
float4 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm
index dadadc8..5d0dc06 100644
--- a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 35
; Schema: 0
OpCapability Shader
%18 = OpExtInstImport "GLSL.std.450"
@@ -32,10 +32,11 @@
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
- %float_1 = OpConstant %float 1
- %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+ %float_1_5 = OpConstant %float 1.5
+ %14 = OpConstantComposite %v4float %float_1_5 %float_1_5 %float_1_5 %float_1_5
%_ptr_Function_v4float = OpTypePointer Function %v4float
%21 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%floor_3bccc4 = OpFunction %void None %9
%12 = OpLabel
%arg_0 = OpVariable %_ptr_Function_v4float Function %5
@@ -59,12 +60,12 @@
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %floor_3bccc4
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_3bccc4
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %floor_3bccc4
+ %33 = OpLabel
+ %34 = OpFunctionCall %void %floor_3bccc4
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl
index 6600c70..eaff135 100644
--- a/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/floor/3bccc4.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
fn floor_3bccc4() {
- var arg_0 = vec4<f32>(1.0f);
+ var arg_0 = vec4<f32>(1.5f);
var res : vec4<f32> = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl
index 8681a51..30aa2d3 100644
--- a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl
@@ -23,7 +23,7 @@
// fn floor(vec<2, f32>) -> vec<2, f32>
fn floor_5fc9ac() {
- var arg_0 = vec2<f32>(1.f);
+ var arg_0 = vec2<f32>(1.5f);
var res: vec2<f32> = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.dxc.hlsl
index dca7290..2a8816e 100644
--- a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_5fc9ac() {
- float2 arg_0 = (1.0f).xx;
+ float2 arg_0 = (1.5f).xx;
float2 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.fxc.hlsl
index dca7290..2a8816e 100644
--- a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void floor_5fc9ac() {
- float2 arg_0 = (1.0f).xx;
+ float2 arg_0 = (1.5f).xx;
float2 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl
index abd2378..5ee5c6f 100644
--- a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void floor_5fc9ac() {
- vec2 arg_0 = vec2(1.0f);
+ vec2 arg_0 = vec2(1.5f);
vec2 res = floor(arg_0);
}
@@ -22,7 +22,7 @@
precision mediump float;
void floor_5fc9ac() {
- vec2 arg_0 = vec2(1.0f);
+ vec2 arg_0 = vec2(1.5f);
vec2 res = floor(arg_0);
}
@@ -37,7 +37,7 @@
#version 310 es
void floor_5fc9ac() {
- vec2 arg_0 = vec2(1.0f);
+ vec2 arg_0 = vec2(1.5f);
vec2 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl
index 5e718db..73e10cc 100644
--- a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_5fc9ac() {
- float2 arg_0 = float2(1.0f);
+ float2 arg_0 = float2(1.5f);
float2 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm
index 045c8c9..1790209 100644
--- a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 37
; Schema: 0
OpCapability Shader
%20 = OpExtInstImport "GLSL.std.450"
@@ -33,11 +33,12 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
- %float_1 = OpConstant %float 1
- %15 = OpConstantComposite %v2float %float_1 %float_1
+ %float_1_5 = OpConstant %float 1.5
+ %15 = OpConstantComposite %v2float %float_1_5 %float_1_5
%_ptr_Function_v2float = OpTypePointer Function %v2float
%18 = OpConstantNull %v2float
%23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%floor_5fc9ac = OpFunction %void None %9
%12 = OpLabel
%arg_0 = OpVariable %_ptr_Function_v2float Function %18
@@ -61,12 +62,12 @@
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %floor_5fc9ac
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %floor_5fc9ac
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %floor_5fc9ac
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %floor_5fc9ac
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl
index a961b8d..4d54928 100644
--- a/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/floor/5fc9ac.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
fn floor_5fc9ac() {
- var arg_0 = vec2<f32>(1.0f);
+ var arg_0 = vec2<f32>(1.5f);
var res : vec2<f32> = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl
index 08b7404..02f51ae 100644
--- a/test/tint/builtins/gen/var/floor/60d7ea.wgsl
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl
@@ -23,7 +23,7 @@
// fn floor(vec<3, f32>) -> vec<3, f32>
fn floor_60d7ea() {
- var arg_0 = vec3<f32>(1.f);
+ var arg_0 = vec3<f32>(1.5f);
var res: vec3<f32> = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.dxc.hlsl
index 2c0000b..b9c579d 100644
--- a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_60d7ea() {
- float3 arg_0 = (1.0f).xxx;
+ float3 arg_0 = (1.5f).xxx;
float3 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.fxc.hlsl
index 2c0000b..b9c579d 100644
--- a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void floor_60d7ea() {
- float3 arg_0 = (1.0f).xxx;
+ float3 arg_0 = (1.5f).xxx;
float3 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl
index 03b1b4a..738c75c 100644
--- a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void floor_60d7ea() {
- vec3 arg_0 = vec3(1.0f);
+ vec3 arg_0 = vec3(1.5f);
vec3 res = floor(arg_0);
}
@@ -22,7 +22,7 @@
precision mediump float;
void floor_60d7ea() {
- vec3 arg_0 = vec3(1.0f);
+ vec3 arg_0 = vec3(1.5f);
vec3 res = floor(arg_0);
}
@@ -37,7 +37,7 @@
#version 310 es
void floor_60d7ea() {
- vec3 arg_0 = vec3(1.0f);
+ vec3 arg_0 = vec3(1.5f);
vec3 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl
index 74b2f97..fe334d7 100644
--- a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_60d7ea() {
- float3 arg_0 = float3(1.0f);
+ float3 arg_0 = float3(1.5f);
float3 res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm
index 94973ec..a4445c3 100644
--- a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 37
; Schema: 0
OpCapability Shader
%20 = OpExtInstImport "GLSL.std.450"
@@ -33,11 +33,12 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
- %float_1 = OpConstant %float 1
- %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+ %float_1_5 = OpConstant %float 1.5
+ %15 = OpConstantComposite %v3float %float_1_5 %float_1_5 %float_1_5
%_ptr_Function_v3float = OpTypePointer Function %v3float
%18 = OpConstantNull %v3float
%23 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%floor_60d7ea = OpFunction %void None %9
%12 = OpLabel
%arg_0 = OpVariable %_ptr_Function_v3float Function %18
@@ -61,12 +62,12 @@
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %floor_60d7ea
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %floor_60d7ea
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %floor_60d7ea
+ %35 = OpLabel
+ %36 = OpFunctionCall %void %floor_60d7ea
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl
index d1427d9..a1337c9 100644
--- a/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/floor/60d7ea.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
fn floor_60d7ea() {
- var arg_0 = vec3<f32>(1.0f);
+ var arg_0 = vec3<f32>(1.5f);
var res : vec3<f32> = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl b/test/tint/builtins/gen/var/floor/66f154.wgsl
index e035b37..e3d068a 100644
--- a/test/tint/builtins/gen/var/floor/66f154.wgsl
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl
@@ -23,7 +23,7 @@
// fn floor(f32) -> f32
fn floor_66f154() {
- var arg_0 = 1.f;
+ var arg_0 = 1.5f;
var res: f32 = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.dxc.hlsl
index 43aecf8..75ca7db 100644
--- a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void floor_66f154() {
- float arg_0 = 1.0f;
+ float arg_0 = 1.5f;
float res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.fxc.hlsl
index 43aecf8..75ca7db 100644
--- a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void floor_66f154() {
- float arg_0 = 1.0f;
+ float arg_0 = 1.5f;
float res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl
index 4de296c..890782c 100644
--- a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void floor_66f154() {
- float arg_0 = 1.0f;
+ float arg_0 = 1.5f;
float res = floor(arg_0);
}
@@ -22,7 +22,7 @@
precision mediump float;
void floor_66f154() {
- float arg_0 = 1.0f;
+ float arg_0 = 1.5f;
float res = floor(arg_0);
}
@@ -37,7 +37,7 @@
#version 310 es
void floor_66f154() {
- float arg_0 = 1.0f;
+ float arg_0 = 1.5f;
float res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl
index 577960f..26d2cac 100644
--- a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void floor_66f154() {
- float arg_0 = 1.0f;
+ float arg_0 = 1.5f;
float res = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm
index dc88494..9d9ea6a 100644
--- a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.spvasm
@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 33
+; Bound: 34
; Schema: 0
OpCapability Shader
%17 = OpExtInstImport "GLSL.std.450"
@@ -32,14 +32,15 @@
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
- %float_1 = OpConstant %float 1
+ %float_1_5 = OpConstant %float 1.5
%_ptr_Function_float = OpTypePointer Function %float
%20 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%floor_66f154 = OpFunction %void None %9
%12 = OpLabel
%arg_0 = OpVariable %_ptr_Function_float Function %8
%res = OpVariable %_ptr_Function_float Function %8
- OpStore %arg_0 %float_1
+ OpStore %arg_0 %float_1_5
%18 = OpLoad %float %arg_0
%16 = OpExtInst %float %17 Floor %18
OpStore %res %16
@@ -58,12 +59,12 @@
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %28 = OpLabel
- %29 = OpFunctionCall %void %floor_66f154
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %floor_66f154
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %floor_66f154
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %floor_66f154
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl
index 72c1376..c2a4db4 100644
--- a/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/var/floor/66f154.wgsl.expected.wgsl
@@ -1,5 +1,5 @@
fn floor_66f154() {
- var arg_0 = 1.0f;
+ var arg_0 = 1.5f;
var res : f32 = floor(arg_0);
}
diff --git a/test/tint/builtins/gen/var/floor/953774.wgsl b/test/tint/builtins/gen/var/floor/953774.wgsl
new file mode 100644
index 0000000..f5fa915
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/953774.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(vec<3, fa>) -> vec<3, fa>
+fn floor_953774() {
+ const arg_0 = vec3(1.5);
+ var res = floor(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_953774();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_953774();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_953774();
+}
diff --git a/test/tint/builtins/gen/var/floor/953774.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b31726b
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void floor_953774() {
+ float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_953774();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_953774();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_953774();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/953774.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b31726b
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void floor_953774() {
+ float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_953774();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_953774();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_953774();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/953774.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.glsl
new file mode 100644
index 0000000..d5c3a05
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void floor_953774() {
+ vec3 res = vec3(1.0f);
+}
+
+vec4 vertex_main() {
+ floor_953774();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void floor_953774() {
+ vec3 res = vec3(1.0f);
+}
+
+void fragment_main() {
+ floor_953774();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_953774() {
+ vec3 res = vec3(1.0f);
+}
+
+void compute_main() {
+ floor_953774();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/953774.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.msl
new file mode 100644
index 0000000..f717392
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_953774() {
+ float3 res = float3(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_953774();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_953774();
+ return;
+}
+
+kernel void compute_main() {
+ floor_953774();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/floor/953774.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.spvasm
new file mode 100644
index 0000000..5349ca5
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %floor_953774 "floor_953774"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+%floor_953774 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v3float Function %18
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %floor_953774
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_953774
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_953774
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/953774.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.wgsl
new file mode 100644
index 0000000..7660ff8
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/953774.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn floor_953774() {
+ const arg_0 = vec3(1.5);
+ var res = floor(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_953774();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_953774();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_953774();
+}
diff --git a/test/tint/builtins/gen/var/floor/dcd5a2.wgsl b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl
new file mode 100644
index 0000000..51ae5bc
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(fa) -> fa
+fn floor_dcd5a2() {
+ const arg_0 = 1.5;
+ var res = floor(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_dcd5a2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_dcd5a2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_dcd5a2();
+}
diff --git a/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..e7f8650
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_dcd5a2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_dcd5a2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_dcd5a2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..e7f8650
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_dcd5a2();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_dcd5a2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_dcd5a2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.glsl
new file mode 100644
index 0000000..d2d4681
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+vec4 vertex_main() {
+ floor_dcd5a2();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+void fragment_main() {
+ floor_dcd5a2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+void compute_main() {
+ floor_dcd5a2();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.msl
new file mode 100644
index 0000000..396fa07
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_dcd5a2();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_dcd5a2();
+ return;
+}
+
+kernel void compute_main() {
+ floor_dcd5a2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.spvasm
new file mode 100644
index 0000000..ad4f786
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %floor_dcd5a2 "floor_dcd5a2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+%floor_dcd5a2 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_1
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %floor_dcd5a2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %21 = OpLabel
+ %22 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %22
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %floor_dcd5a2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_dcd5a2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.wgsl
new file mode 100644
index 0000000..c0177b2
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/dcd5a2.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn floor_dcd5a2() {
+ const arg_0 = 1.5;
+ var res = floor(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_dcd5a2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_dcd5a2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_dcd5a2();
+}
diff --git a/test/tint/builtins/gen/var/floor/e585ef.wgsl b/test/tint/builtins/gen/var/floor/e585ef.wgsl
new file mode 100644
index 0000000..80b301e
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/e585ef.wgsl
@@ -0,0 +1,44 @@
+// Copyright 2022 The Tint Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+////////////////////////////////////////////////////////////////////////////////
+// File generated by tools/src/cmd/gen
+// using the template:
+// test/tint/builtins/gen/gen.wgsl.tmpl
+//
+// Do not modify this file directly
+////////////////////////////////////////////////////////////////////////////////
+
+
+// fn floor(vec<2, fa>) -> vec<2, fa>
+fn floor_e585ef() {
+ const arg_0 = vec2(1.5);
+ var res = floor(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_e585ef();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_e585ef();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_e585ef();
+}
diff --git a/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..c988d3c
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void floor_e585ef() {
+ float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_e585ef();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_e585ef();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_e585ef();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..c988d3c
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void floor_e585ef() {
+ float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ floor_e585ef();
+ return (0.0f).xxxx;
+}
+
+tint_symbol vertex_main() {
+ const float4 inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = (tint_symbol)0;
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+void fragment_main() {
+ floor_e585ef();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ floor_e585ef();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.glsl b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.glsl
new file mode 100644
index 0000000..f6dd7ae
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void floor_e585ef() {
+ vec2 res = vec2(1.0f);
+}
+
+vec4 vertex_main() {
+ floor_e585ef();
+ return vec4(0.0f);
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ vec4 inner_result = vertex_main();
+ gl_Position = inner_result;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
+#version 310 es
+precision mediump float;
+
+void floor_e585ef() {
+ vec2 res = vec2(1.0f);
+}
+
+void fragment_main() {
+ floor_e585ef();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void floor_e585ef() {
+ vec2 res = vec2(1.0f);
+}
+
+void compute_main() {
+ floor_e585ef();
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ compute_main();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.msl b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.msl
new file mode 100644
index 0000000..862988b
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void floor_e585ef() {
+ float2 res = float2(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ floor_e585ef();
+ return float4(0.0f);
+}
+
+vertex tint_symbol vertex_main() {
+ float4 const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.value = inner_result;
+ return wrapper_result;
+}
+
+fragment void fragment_main() {
+ floor_e585ef();
+ return;
+}
+
+kernel void compute_main() {
+ floor_e585ef();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.spvasm b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.spvasm
new file mode 100644
index 0000000..3b4d9f3
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %floor_e585ef "floor_e585ef"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantComposite %v2float %float_1 %float_1
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+%floor_e585ef = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_v2float Function %18
+ OpStore %res %15
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %floor_e585ef
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %floor_e585ef
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %floor_e585ef
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.wgsl b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.wgsl
new file mode 100644
index 0000000..a3bcbfa
--- /dev/null
+++ b/test/tint/builtins/gen/var/floor/e585ef.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn floor_e585ef() {
+ const arg_0 = vec2(1.5);
+ var res = floor(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ floor_e585ef();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ floor_e585ef();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ floor_e585ef();
+}
diff --git a/webgpu-cts/expectations.txt b/webgpu-cts/expectations.txt
index 527e5df..7ef87ee 100644
--- a/webgpu-cts/expectations.txt
+++ b/webgpu-cts/expectations.txt
@@ -423,10 +423,6 @@
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="const";vectorize=2 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="const";vectorize=3 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,exp:f32:inputSource="const";vectorize=4 [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="const";vectorize="_undef_" [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="const";vectorize=2 [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="const";vectorize=3 [ Failure ]
-crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,floor:f32:inputSource="const";vectorize=4 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="const";vectorize="_undef_" [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="const";vectorize=2 [ Failure ]
crbug.com/tint/1613 webgpu:shader,execution,expression,call,builtin,fract:f32:inputSource="const";vectorize=3 [ Failure ]