Implement const-eval for `acosh`

This CL adds const-eval for the `acosh` test case. The generation of
`f16` values into test files is also fixed because `acosh` requires the
value to be `>= 1.0`

Bug: tint:1581
Change-Id: Iba2ca4d9d114034845475679346f042c8c66e571
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/109341
Reviewed-by: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-11-10 02:39:08 +00:00 committed by Dawn LUCI CQ
parent da92e5cc84
commit e2fd5e09c6
174 changed files with 2721 additions and 777 deletions

View File

@ -408,8 +408,8 @@ match storage
@const fn abs<N: num, T: fia_fiu32_f16>(vec<N, T>) -> vec<N, T> @const fn abs<N: num, T: fia_fiu32_f16>(vec<N, T>) -> vec<N, T>
@const fn acos<T: fa_f32_f16>(@test_value(0.96891242171) T) -> T @const fn acos<T: fa_f32_f16>(@test_value(0.96891242171) T) -> T
@const fn acos<N: num, T: fa_f32_f16>(@test_value(0.96891242171) vec<N, T>) -> vec<N, T> @const fn acos<N: num, T: fa_f32_f16>(@test_value(0.96891242171) vec<N, T>) -> vec<N, T>
fn acosh<T: f32_f16>(T) -> T @const fn acosh<T: fa_f32_f16>(@test_value(2.0) T) -> T
fn acosh<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T> @const fn acosh<N: num, T: fa_f32_f16>(@test_value(2.0) vec<N, T>) -> vec<N, T>
@const fn all(bool) -> bool @const fn all(bool) -> bool
@const fn all<N: num>(vec<N, bool>) -> bool @const fn all<N: num>(vec<N, bool>) -> bool
@const fn any(bool) -> bool @const fn any(bool) -> bool

View File

@ -276,7 +276,12 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, Error_NoParams) {
TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f32) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f32) {
auto param = GetParam(); auto param = GetParam();
auto* call = Call(param.name, 0.5_f); auto val = 0.5_f;
if (param.name == std::string("acosh")) {
val = 1.0_f;
}
auto* call = Call(param.name, val);
WrapInFunction(call); WrapInFunction(call);
if (param.args_number == 1u) { if (param.args_number == 1u) {
@ -297,7 +302,10 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f32) {
TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f32) { TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f32) {
auto param = GetParam(); auto param = GetParam();
auto* call = Call(param.name, vec3<f32>(0.5_f, 0.5_f, 0.8_f)); auto val = param.name == std::string("acosh") ? vec3<f32>(1.0_f, 2.0_f, 3.0_f)
: vec3<f32>(0.5_f, 0.5_f, 0.8_f);
auto* call = Call(param.name, val);
WrapInFunction(call); WrapInFunction(call);
if (param.args_number == 1u) { if (param.args_number == 1u) {
@ -462,7 +470,12 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Scalar_f16) {
Enable(ast::Extension::kF16); Enable(ast::Extension::kF16);
auto* call = Call(param.name, 0.5_h); auto val = 0.5_h;
if (param.name == std::string("acosh")) {
val = 1.0_h;
}
auto* call = Call(param.name, val);
WrapInFunction(call); WrapInFunction(call);
if (param.args_number == 1u) { if (param.args_number == 1u) {
@ -485,7 +498,10 @@ TEST_P(ResolverBuiltinTest_FloatBuiltin_IdenticalType, OneParam_Vector_f16) {
Enable(ast::Extension::kF16); Enable(ast::Extension::kF16);
auto* call = Call(param.name, vec3<f16>(0.5_h, 0.5_h, 0.8_h)); auto val = param.name == std::string("acosh") ? vec3<f16>(1.0_h, 2.0_h, 3.0_h)
: vec3<f16>(0.5_h, 0.5_h, 0.8_h);
auto* call = Call(param.name, val);
WrapInFunction(call); WrapInFunction(call);
if (param.args_number == 1u) { if (param.args_number == 1u) {

View File

@ -1674,6 +1674,24 @@ ConstEval::Result ConstEval::acos(const sem::Type* ty,
return TransformElements(builder, ty, transform, args[0]); return TransformElements(builder, ty, transform, args[0]);
} }
ConstEval::Result ConstEval::acosh(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source) {
auto transform = [&](const sem::Constant* c0) {
auto create = [&](auto i) -> ImplResult {
using NumberT = decltype(i);
if (i < NumberT(1.0)) {
AddError("acosh must be called with a value >= 1.0", source);
return utils::Failure;
}
return CreateElement(builder, c0->Type(), NumberT(std::acosh(i.value)));
};
return Dispatch_fa_f32_f16(create, c0);
};
return TransformElements(builder, ty, transform, args[0]);
}
ConstEval::Result ConstEval::all(const sem::Type* ty, ConstEval::Result ConstEval::all(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args, utils::VectorRef<const sem::Constant*> args,
const Source&) { const Source&) {

View File

@ -386,15 +386,6 @@ class ConstEval {
utils::VectorRef<const sem::Constant*> args, utils::VectorRef<const sem::Constant*> args,
const Source& source); const Source& source);
/// all 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 all(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// acos builtin /// acos builtin
/// @param ty the expression type /// @param ty the expression type
/// @param args the input arguments /// @param args the input arguments
@ -404,6 +395,24 @@ class ConstEval {
utils::VectorRef<const sem::Constant*> args, utils::VectorRef<const sem::Constant*> args,
const Source& source); const Source& source);
/// acosh 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 acosh(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// all 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 all(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source);
/// any builtin /// any builtin
/// @param ty the expression type /// @param ty the expression type
/// @param args the input arguments /// @param args the input arguments

View File

@ -506,6 +506,33 @@ INSTANTIATE_TEST_SUITE_P( //
AcosCases<f32, false>(), AcosCases<f32, false>(),
AcosCases<f16, false>())))); AcosCases<f16, false>()))));
template <typename T, bool finite_only>
std::vector<Case> AcoshCases() {
std::vector<Case> cases = {
C({T(1.0)}, T(0.0)),
C({T(11.5919532755)}, kPi<T>).FloatComp(),
// Vector tests
C({Vec(T(1.0), T(11.5919532755))}, Vec(T(0), kPi<T>)).FloatComp(),
};
ConcatIntoIf<finite_only>( //
cases, std::vector<Case>{
E({T::Smallest()}, "12:34 error: acosh must be called with a value >= 1.0"),
E({-1.1_a}, "12:34 error: acosh must be called with a value >= 1.0"),
E({0_a}, "12:34 error: acosh must be called with a value >= 1.0"),
});
return cases;
}
INSTANTIATE_TEST_SUITE_P( //
Acosh,
ResolverConstEvalBuiltinTest,
testing::Combine(testing::Values(sem::BuiltinType::kAcosh),
testing::ValuesIn(Concat(AcoshCases<AFloat, true>(), //
AcoshCases<f32, false>(),
AcoshCases<f16, false>()))));
template <typename T, bool finite_only> template <typename T, bool finite_only>
std::vector<Case> AsinCases() { std::vector<Case> AsinCases() {
std::vector<Case> cases = { std::vector<Case> cases = {

View File

@ -12153,24 +12153,24 @@ constexpr OverloadInfo kOverloads[] = {
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 0, /* num template numbers */ 0,
/* template types */ &kTemplateTypes[25], /* template types */ &kTemplateTypes[24],
/* template numbers */ &kTemplateNumbers[10], /* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[958], /* parameters */ &kParameters[958],
/* return matcher indices */ &kMatcherIndices[1], /* return matcher indices */ &kMatcherIndices[1],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr, /* const eval */ &ConstEval::acosh,
}, },
{ {
/* [319] */ /* [319] */
/* num parameters */ 1, /* num parameters */ 1,
/* num template types */ 1, /* num template types */ 1,
/* num template numbers */ 1, /* num template numbers */ 1,
/* template types */ &kTemplateTypes[25], /* template types */ &kTemplateTypes[24],
/* template numbers */ &kTemplateNumbers[5], /* template numbers */ &kTemplateNumbers[5],
/* parameters */ &kParameters[996], /* parameters */ &kParameters[996],
/* return matcher indices */ &kMatcherIndices[30], /* return matcher indices */ &kMatcherIndices[30],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
/* const eval */ nullptr, /* const eval */ &ConstEval::acosh,
}, },
{ {
/* [320] */ /* [320] */
@ -14027,8 +14027,8 @@ constexpr IntrinsicInfo kBuiltins[] = {
}, },
{ {
/* [2] */ /* [2] */
/* fn acosh<T : f32_f16>(T) -> T */ /* fn acosh<T : fa_f32_f16>(@test_value(2) T) -> T */
/* fn acosh<N : num, T : f32_f16>(vec<N, T>) -> vec<N, T> */ /* fn acosh<N : num, T : fa_f32_f16>(@test_value(2) vec<N, T>) -> vec<N, T> */
/* num overloads */ 2, /* num overloads */ 2,
/* overloads */ &kOverloads[318], /* overloads */ &kOverloads[318],
}, },

View File

@ -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 acosh(vec<2, fa>) -> vec<2, fa>
fn acosh_17260e() {
var res = acosh(vec2(2.));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_17260e();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_17260e();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_17260e();
}

View File

@ -0,0 +1,30 @@
void acosh_17260e() {
float2 res = (1.316957951f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_17260e();
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() {
acosh_17260e();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_17260e();
return;
}

View File

@ -0,0 +1,30 @@
void acosh_17260e() {
float2 res = (1.316957951f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_17260e();
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() {
acosh_17260e();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_17260e();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void acosh_17260e() {
vec2 res = vec2(1.316957951f);
}
vec4 vertex_main() {
acosh_17260e();
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 acosh_17260e() {
vec2 res = vec2(1.316957951f);
}
void fragment_main() {
acosh_17260e();
}
void main() {
fragment_main();
return;
}
#version 310 es
void acosh_17260e() {
vec2 res = vec2(1.316957951f);
}
void compute_main() {
acosh_17260e();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void acosh_17260e() {
float2 res = float2(1.316957951f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
acosh_17260e();
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() {
acosh_17260e();
return;
}
kernel void compute_main() {
acosh_17260e();
return;
}

View File

@ -0,0 +1,67 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 33
; 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 %acosh_17260e "acosh_17260e"
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_31695795 = OpConstant %float 1.31695795
%15 = OpConstantComposite %v2float %float_1_31695795 %float_1_31695795
%_ptr_Function_v2float = OpTypePointer Function %v2float
%18 = OpConstantNull %v2float
%19 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%acosh_17260e = 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 %acosh_17260e
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
%28 = OpLabel
%29 = OpFunctionCall %void %acosh_17260e
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%31 = OpLabel
%32 = OpFunctionCall %void %acosh_17260e
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn acosh_17260e() {
var res = acosh(vec2(2.0));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_17260e();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_17260e();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_17260e();
}

View File

@ -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 acosh(fa) -> fa
fn acosh_3433e8() {
var res = acosh(2.);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_3433e8();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_3433e8();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_3433e8();
}

View File

@ -0,0 +1,30 @@
void acosh_3433e8() {
float res = 1.316957951f;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_3433e8();
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() {
acosh_3433e8();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_3433e8();
return;
}

View File

@ -0,0 +1,30 @@
void acosh_3433e8() {
float res = 1.316957951f;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_3433e8();
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() {
acosh_3433e8();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_3433e8();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void acosh_3433e8() {
float res = 1.316957951f;
}
vec4 vertex_main() {
acosh_3433e8();
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 acosh_3433e8() {
float res = 1.316957951f;
}
void fragment_main() {
acosh_3433e8();
}
void main() {
fragment_main();
return;
}
#version 310 es
void acosh_3433e8() {
float res = 1.316957951f;
}
void compute_main() {
acosh_3433e8();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void acosh_3433e8() {
float res = 1.316957951f;
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
acosh_3433e8();
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() {
acosh_3433e8();
return;
}
kernel void compute_main() {
acosh_3433e8();
return;
}

View File

@ -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 %acosh_3433e8 "acosh_3433e8"
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_31695795 = OpConstant %float 1.31695795
%_ptr_Function_float = OpTypePointer Function %float
%16 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%acosh_3433e8 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
OpStore %res %float_1_31695795
OpReturn
OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %16
%18 = OpLabel
%19 = OpFunctionCall %void %acosh_3433e8
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
%25 = OpLabel
%26 = OpFunctionCall %void %acosh_3433e8
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%28 = OpLabel
%29 = OpFunctionCall %void %acosh_3433e8
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn acosh_3433e8() {
var res = acosh(2.0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_3433e8();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_3433e8();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_3433e8();
}

View File

@ -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 acosh(vec<4, fa>) -> vec<4, fa>
fn acosh_490aae() {
var res = acosh(vec4(2.));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_490aae();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_490aae();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_490aae();
}

View File

@ -0,0 +1,30 @@
void acosh_490aae() {
float4 res = (1.316957951f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_490aae();
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() {
acosh_490aae();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_490aae();
return;
}

View File

@ -0,0 +1,30 @@
void acosh_490aae() {
float4 res = (1.316957951f).xxxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_490aae();
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() {
acosh_490aae();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_490aae();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void acosh_490aae() {
vec4 res = vec4(1.316957951f);
}
vec4 vertex_main() {
acosh_490aae();
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 acosh_490aae() {
vec4 res = vec4(1.316957951f);
}
void fragment_main() {
acosh_490aae();
}
void main() {
fragment_main();
return;
}
#version 310 es
void acosh_490aae() {
vec4 res = vec4(1.316957951f);
}
void compute_main() {
acosh_490aae();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void acosh_490aae() {
float4 res = float4(1.316957951f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
acosh_490aae();
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() {
acosh_490aae();
return;
}
kernel void compute_main() {
acosh_490aae();
return;
}

View File

@ -0,0 +1,65 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 31
; 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 %acosh_490aae "acosh_490aae"
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_31695795 = OpConstant %float 1.31695795
%14 = OpConstantComposite %v4float %float_1_31695795 %float_1_31695795 %float_1_31695795 %float_1_31695795
%_ptr_Function_v4float = OpTypePointer Function %v4float
%17 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%acosh_490aae = 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 %acosh_490aae
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
%26 = OpLabel
%27 = OpFunctionCall %void %acosh_490aae
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%29 = OpLabel
%30 = OpFunctionCall %void %acosh_490aae
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn acosh_490aae() {
var res = acosh(vec4(2.0));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_490aae();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_490aae();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_490aae();
}

View File

@ -25,7 +25,7 @@ enable f16;
// fn acosh(vec<2, f16>) -> vec<2, f16> // fn acosh(vec<2, f16>) -> vec<2, f16>
fn acosh_5f49d8() { fn acosh_5f49d8() {
var res: vec2<f16> = acosh(vec2<f16>(1.h)); var res: vec2<f16> = acosh(vec2<f16>(2.h));
} }
@vertex @vertex

View File

@ -1,9 +1,5 @@
vector<float16_t, 2> tint_acosh(vector<float16_t, 2> x) {
return log((x + sqrt(((x * x) - float16_t(1.0h)))));
}
void acosh_5f49d8() { void acosh_5f49d8() {
vector<float16_t, 2> res = tint_acosh((float16_t(1.0h)).xx); vector<float16_t, 2> res = (float16_t(1.31640625h)).xx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
SKIP: FAILED SKIP: FAILED
vector<float16_t, 2> tint_acosh(vector<float16_t, 2> x) {
return log((x + sqrt(((x * x) - float16_t(1.0h)))));
}
void acosh_5f49d8() { void acosh_5f49d8() {
vector<float16_t, 2> res = tint_acosh((float16_t(0.0h)).xx); vector<float16_t, 2> res = (float16_t(1.31640625h)).xx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,12 +1,8 @@
#version 310 es #version 310 es
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec2 tint_acosh(f16vec2 x) {
return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf)));
}
void acosh_5f49d8() { void acosh_5f49d8() {
f16vec2 res = tint_acosh(f16vec2(1.0hf)); f16vec2 res = f16vec2(1.31640625hf);
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -26,12 +22,8 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
precision mediump float; precision mediump float;
f16vec2 tint_acosh(f16vec2 x) {
return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf)));
}
void acosh_5f49d8() { void acosh_5f49d8() {
f16vec2 res = tint_acosh(f16vec2(1.0hf)); f16vec2 res = f16vec2(1.31640625hf);
} }
void fragment_main() { void fragment_main() {
@ -45,12 +37,8 @@ void main() {
#version 310 es #version 310 es
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec2 tint_acosh(f16vec2 x) {
return mix(acosh(x), f16vec2(0.0hf), lessThan(x, f16vec2(1.0hf)));
}
void acosh_5f49d8() { void acosh_5f49d8() {
f16vec2 res = tint_acosh(f16vec2(1.0hf)); f16vec2 res = f16vec2(1.31640625hf);
} }
void compute_main() { void compute_main() {

View File

@ -1,12 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
half2 tint_acosh(half2 x) {
return select(acosh(x), half2(0.0h), (x < half2(1.0h)));
}
void acosh_5f49d8() { void acosh_5f49d8() {
half2 res = tint_acosh(half2(1.0h)); half2 res = half2(1.31640625h);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,14 +1,13 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 45 ; Bound: 34
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16 OpCapability StorageInputOutput16
%23 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main" OpEntryPoint Fragment %fragment_main "fragment_main"
@ -17,8 +16,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1 OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value" OpName %value "value"
OpName %vertex_point_size "vertex_point_size" OpName %vertex_point_size "vertex_point_size"
OpName %tint_acosh "tint_acosh"
OpName %x "x"
OpName %acosh_5f49d8 "acosh_5f49d8" OpName %acosh_5f49d8 "acosh_5f49d8"
OpName %res "res" OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner" OpName %vertex_main_inner "vertex_main_inner"
@ -35,53 +32,41 @@
%_ptr_Output_float = OpTypePointer Output %float %_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float %8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v2half = OpTypeVector %half 2 %v2half = OpTypeVector %half 2
%9 = OpTypeFunction %v2half %v2half %half_0x1_51p_0 = OpConstant %half 0x1.51p+0
%half_0x1p_0 = OpConstant %half 0x1p+0 %16 = OpConstantComposite %v2half %half_0x1_51p_0 %half_0x1_51p_0
%17 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
%bool = OpTypeBool
%v2bool = OpTypeVector %bool 2
%21 = OpConstantNull %v2half
%void = OpTypeVoid
%24 = OpTypeFunction %void
%_ptr_Function_v2half = OpTypePointer Function %v2half %_ptr_Function_v2half = OpTypePointer Function %v2half
%31 = OpTypeFunction %v4float %19 = OpConstantNull %v2half
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%tint_acosh = OpFunction %v2half None %9 %acosh_5f49d8 = OpFunction %void None %9
%x = OpFunctionParameter %v2half %12 = OpLabel
%14 = OpLabel %res = OpVariable %_ptr_Function_v2half Function %19
%18 = OpFOrdLessThan %v2bool %x %17 OpStore %res %16
%22 = OpExtInst %v2half %23 Acosh %x
%15 = OpSelect %v2half %18 %21 %22
OpReturnValue %15
OpFunctionEnd
%acosh_5f49d8 = OpFunction %void None %24
%27 = OpLabel
%res = OpVariable %_ptr_Function_v2half Function %21
%28 = OpFunctionCall %v2half %tint_acosh %17
OpStore %res %28
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %31 %vertex_main_inner = OpFunction %v4float None %20
%33 = OpLabel %22 = OpLabel
%34 = OpFunctionCall %void %acosh_5f49d8 %23 = OpFunctionCall %void %acosh_5f49d8
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %24 %vertex_main = OpFunction %void None %9
%36 = OpLabel %25 = OpLabel
%37 = OpFunctionCall %v4float %vertex_main_inner %26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %37 OpStore %value %26
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %24 %fragment_main = OpFunction %void None %9
%40 = OpLabel %29 = OpLabel
%41 = OpFunctionCall %void %acosh_5f49d8 %30 = OpFunctionCall %void %acosh_5f49d8
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %24 %compute_main = OpFunction %void None %9
%43 = OpLabel %32 = OpLabel
%44 = OpFunctionCall %void %acosh_5f49d8 %33 = OpFunctionCall %void %acosh_5f49d8
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,7 +1,7 @@
enable f16; enable f16;
fn acosh_5f49d8() { fn acosh_5f49d8() {
var res : vec2<f16> = acosh(vec2<f16>(1.0h)); var res : vec2<f16> = acosh(vec2<f16>(2.0h));
} }
@vertex @vertex

View File

@ -1,4 +1,4 @@
// Copyright 2021 The Tint Authors. // Copyright 2022 The Tint Authors.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@
// fn acosh(vec<2, f32>) -> vec<2, f32> // fn acosh(vec<2, f32>) -> vec<2, f32>
fn acosh_640883() { fn acosh_640883() {
var res: vec2<f32> = acosh(vec2<f32>(1.f)); var res: vec2<f32> = acosh(vec2<f32>(2.f));
} }
@vertex @vertex

View File

@ -1,9 +1,5 @@
float2 tint_acosh(float2 x) {
return log((x + sqrt(((x * x) - 1.0f))));
}
void acosh_640883() { void acosh_640883() {
float2 res = tint_acosh((1.0f).xx); float2 res = (1.316957951f).xx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,9 +1,5 @@
float2 tint_acosh(float2 x) {
return log((x + sqrt(((x * x) - 1.0f))));
}
void acosh_640883() { void acosh_640883() {
float2 res = tint_acosh((1.0f).xx); float2 res = (1.316957951f).xx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
#version 310 es #version 310 es
vec2 tint_acosh(vec2 x) {
return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f)));
}
void acosh_640883() { void acosh_640883() {
vec2 res = tint_acosh(vec2(1.0f)); vec2 res = vec2(1.316957951f);
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -24,12 +20,8 @@ void main() {
#version 310 es #version 310 es
precision mediump float; precision mediump float;
vec2 tint_acosh(vec2 x) {
return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f)));
}
void acosh_640883() { void acosh_640883() {
vec2 res = tint_acosh(vec2(1.0f)); vec2 res = vec2(1.316957951f);
} }
void fragment_main() { void fragment_main() {
@ -42,12 +34,8 @@ void main() {
} }
#version 310 es #version 310 es
vec2 tint_acosh(vec2 x) {
return mix(acosh(x), vec2(0.0f), lessThan(x, vec2(1.0f)));
}
void acosh_640883() { void acosh_640883() {
vec2 res = tint_acosh(vec2(1.0f)); vec2 res = vec2(1.316957951f);
} }
void compute_main() { void compute_main() {

View File

@ -1,12 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
float2 tint_acosh(float2 x) {
return select(acosh(x), float2(0.0f), (x < float2(1.0f)));
}
void acosh_640883() { void acosh_640883() {
float2 res = tint_acosh(float2(1.0f)); float2 res = float2(1.316957951f);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 43 ; Bound: 33
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%22 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main" OpEntryPoint Fragment %fragment_main "fragment_main"
@ -13,8 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1 OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value" OpName %value "value"
OpName %vertex_point_size "vertex_point_size" OpName %vertex_point_size "vertex_point_size"
OpName %tint_acosh "tint_acosh"
OpName %x "x"
OpName %acosh_640883 "acosh_640883" OpName %acosh_640883 "acosh_640883"
OpName %res "res" OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner" OpName %vertex_main_inner "vertex_main_inner"
@ -31,51 +28,40 @@
%_ptr_Output_float = OpTypePointer Output %float %_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float %8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
%v2float = OpTypeVector %float 2
%9 = OpTypeFunction %v2float %v2float
%float_1 = OpConstant %float 1
%16 = OpConstantComposite %v2float %float_1 %float_1
%bool = OpTypeBool
%v2bool = OpTypeVector %bool 2
%20 = OpConstantNull %v2float
%void = OpTypeVoid %void = OpTypeVoid
%23 = OpTypeFunction %void %9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
%float_1_31695795 = OpConstant %float 1.31695795
%15 = OpConstantComposite %v2float %float_1_31695795 %float_1_31695795
%_ptr_Function_v2float = OpTypePointer Function %v2float %_ptr_Function_v2float = OpTypePointer Function %v2float
%30 = OpTypeFunction %v4float %18 = OpConstantNull %v2float
%tint_acosh = OpFunction %v2float None %9 %19 = OpTypeFunction %v4float
%x = OpFunctionParameter %v2float %float_1 = OpConstant %float 1
%13 = OpLabel %acosh_640883 = OpFunction %void None %9
%17 = OpFOrdLessThan %v2bool %x %16 %12 = OpLabel
%21 = OpExtInst %v2float %22 Acosh %x %res = OpVariable %_ptr_Function_v2float Function %18
%14 = OpSelect %v2float %17 %20 %21 OpStore %res %15
OpReturnValue %14
OpFunctionEnd
%acosh_640883 = OpFunction %void None %23
%26 = OpLabel
%res = OpVariable %_ptr_Function_v2float Function %20
%27 = OpFunctionCall %v2float %tint_acosh %16
OpStore %res %27
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %30 %vertex_main_inner = OpFunction %v4float None %19
%32 = OpLabel %21 = OpLabel
%33 = OpFunctionCall %void %acosh_640883 %22 = OpFunctionCall %void %acosh_640883
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %23 %vertex_main = OpFunction %void None %9
%35 = OpLabel %24 = OpLabel
%36 = OpFunctionCall %v4float %vertex_main_inner %25 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %36 OpStore %value %25
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %23 %fragment_main = OpFunction %void None %9
%38 = OpLabel %28 = OpLabel
%39 = OpFunctionCall %void %acosh_640883 %29 = OpFunctionCall %void %acosh_640883
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %23 %compute_main = OpFunction %void None %9
%41 = OpLabel %31 = OpLabel
%42 = OpFunctionCall %void %acosh_640883 %32 = OpFunctionCall %void %acosh_640883
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn acosh_640883() { fn acosh_640883() {
var res : vec2<f32> = acosh(vec2<f32>(1.0f)); var res : vec2<f32> = acosh(vec2<f32>(2.0f));
} }
@vertex @vertex

View File

@ -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 acosh(vec<3, fa>) -> vec<3, fa>
fn acosh_9f213e() {
var res = acosh(vec3(2.));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_9f213e();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_9f213e();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_9f213e();
}

View File

@ -0,0 +1,30 @@
void acosh_9f213e() {
float3 res = (1.316957951f).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_9f213e();
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() {
acosh_9f213e();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_9f213e();
return;
}

View File

@ -0,0 +1,30 @@
void acosh_9f213e() {
float3 res = (1.316957951f).xxx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_9f213e();
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() {
acosh_9f213e();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_9f213e();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void acosh_9f213e() {
vec3 res = vec3(1.316957951f);
}
vec4 vertex_main() {
acosh_9f213e();
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 acosh_9f213e() {
vec3 res = vec3(1.316957951f);
}
void fragment_main() {
acosh_9f213e();
}
void main() {
fragment_main();
return;
}
#version 310 es
void acosh_9f213e() {
vec3 res = vec3(1.316957951f);
}
void compute_main() {
acosh_9f213e();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void acosh_9f213e() {
float3 res = float3(1.316957951f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
acosh_9f213e();
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() {
acosh_9f213e();
return;
}
kernel void compute_main() {
acosh_9f213e();
return;
}

View File

@ -0,0 +1,67 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 33
; 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 %acosh_9f213e "acosh_9f213e"
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_31695795 = OpConstant %float 1.31695795
%15 = OpConstantComposite %v3float %float_1_31695795 %float_1_31695795 %float_1_31695795
%_ptr_Function_v3float = OpTypePointer Function %v3float
%18 = OpConstantNull %v3float
%19 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%acosh_9f213e = 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 %acosh_9f213e
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
%28 = OpLabel
%29 = OpFunctionCall %void %acosh_9f213e
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%31 = OpLabel
%32 = OpFunctionCall %void %acosh_9f213e
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,19 @@
fn acosh_9f213e() {
var res = acosh(vec3(2.0));
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_9f213e();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_9f213e();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_9f213e();
}

View File

@ -25,7 +25,7 @@ enable f16;
// fn acosh(f16) -> f16 // fn acosh(f16) -> f16
fn acosh_a37dfe() { fn acosh_a37dfe() {
var res: f16 = acosh(1.h); var res: f16 = acosh(2.h);
} }
@vertex @vertex

View File

@ -1,9 +1,5 @@
float16_t tint_acosh(float16_t x) {
return log((x + sqrt(((x * x) - float16_t(1.0h)))));
}
void acosh_a37dfe() { void acosh_a37dfe() {
float16_t res = tint_acosh(float16_t(1.0h)); float16_t res = float16_t(1.31640625h);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
SKIP: FAILED SKIP: FAILED
float16_t tint_acosh(float16_t x) {
return log((x + sqrt(((x * x) - float16_t(1.0h)))));
}
void acosh_a37dfe() { void acosh_a37dfe() {
float16_t res = tint_acosh(float16_t(0.0h)); float16_t res = float16_t(1.31640625h);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,12 +1,8 @@
#version 310 es #version 310 es
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
float16_t tint_acosh(float16_t x) {
return ((x < 1.0hf) ? 0.0hf : acosh(x));
}
void acosh_a37dfe() { void acosh_a37dfe() {
float16_t res = tint_acosh(1.0hf); float16_t res = 1.31640625hf;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -26,12 +22,8 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
precision mediump float; precision mediump float;
float16_t tint_acosh(float16_t x) {
return ((x < 1.0hf) ? 0.0hf : acosh(x));
}
void acosh_a37dfe() { void acosh_a37dfe() {
float16_t res = tint_acosh(1.0hf); float16_t res = 1.31640625hf;
} }
void fragment_main() { void fragment_main() {
@ -45,12 +37,8 @@ void main() {
#version 310 es #version 310 es
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
float16_t tint_acosh(float16_t x) {
return ((x < 1.0hf) ? 0.0hf : acosh(x));
}
void acosh_a37dfe() { void acosh_a37dfe() {
float16_t res = tint_acosh(1.0hf); float16_t res = 1.31640625hf;
} }
void compute_main() { void compute_main() {

View File

@ -1,12 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
half tint_acosh(half x) {
return select(acosh(x), 0.0h, (x < 1.0h));
}
void acosh_a37dfe() { void acosh_a37dfe() {
half res = tint_acosh(1.0h); half res = 1.31640625h;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,14 +1,13 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 42 ; Bound: 32
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16 OpCapability StorageInputOutput16
%20 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main" OpEntryPoint Fragment %fragment_main "fragment_main"
@ -17,8 +16,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1 OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value" OpName %value "value"
OpName %vertex_point_size "vertex_point_size" OpName %vertex_point_size "vertex_point_size"
OpName %tint_acosh "tint_acosh"
OpName %x "x"
OpName %acosh_a37dfe "acosh_a37dfe" OpName %acosh_a37dfe "acosh_a37dfe"
OpName %res "res" OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner" OpName %vertex_main_inner "vertex_main_inner"
@ -35,50 +32,39 @@
%_ptr_Output_float = OpTypePointer Output %float %_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float %8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
%half = OpTypeFloat 16
%9 = OpTypeFunction %half %half
%half_0x1p_0 = OpConstant %half 0x1p+0
%bool = OpTypeBool
%18 = OpConstantNull %half
%void = OpTypeVoid %void = OpTypeVoid
%21 = OpTypeFunction %void %9 = OpTypeFunction %void
%half = OpTypeFloat 16
%half_0x1_51p_0 = OpConstant %half 0x1.51p+0
%_ptr_Function_half = OpTypePointer Function %half %_ptr_Function_half = OpTypePointer Function %half
%28 = OpTypeFunction %v4float %17 = OpConstantNull %half
%18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%tint_acosh = OpFunction %half None %9 %acosh_a37dfe = OpFunction %void None %9
%x = OpFunctionParameter %half %12 = OpLabel
%13 = OpLabel %res = OpVariable %_ptr_Function_half Function %17
%16 = OpFOrdLessThan %bool %x %half_0x1p_0 OpStore %res %half_0x1_51p_0
%19 = OpExtInst %half %20 Acosh %x
%14 = OpSelect %half %16 %18 %19
OpReturnValue %14
OpFunctionEnd
%acosh_a37dfe = OpFunction %void None %21
%24 = OpLabel
%res = OpVariable %_ptr_Function_half Function %18
%25 = OpFunctionCall %half %tint_acosh %half_0x1p_0
OpStore %res %25
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %28 %vertex_main_inner = OpFunction %v4float None %18
%30 = OpLabel %20 = OpLabel
%31 = OpFunctionCall %void %acosh_a37dfe %21 = OpFunctionCall %void %acosh_a37dfe
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %21 %vertex_main = OpFunction %void None %9
%33 = OpLabel %23 = OpLabel
%34 = OpFunctionCall %v4float %vertex_main_inner %24 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %34 OpStore %value %24
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %21 %fragment_main = OpFunction %void None %9
%37 = OpLabel %27 = OpLabel
%38 = OpFunctionCall %void %acosh_a37dfe %28 = OpFunctionCall %void %acosh_a37dfe
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %21 %compute_main = OpFunction %void None %9
%40 = OpLabel %30 = OpLabel
%41 = OpFunctionCall %void %acosh_a37dfe %31 = OpFunctionCall %void %acosh_a37dfe
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,7 +1,7 @@
enable f16; enable f16;
fn acosh_a37dfe() { fn acosh_a37dfe() {
var res : f16 = acosh(1.0h); var res : f16 = acosh(2.0h);
} }
@vertex @vertex

View File

@ -1,4 +1,4 @@
// Copyright 2021 The Tint Authors. // Copyright 2022 The Tint Authors.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@
// fn acosh(vec<4, f32>) -> vec<4, f32> // fn acosh(vec<4, f32>) -> vec<4, f32>
fn acosh_d51ccb() { fn acosh_d51ccb() {
var res: vec4<f32> = acosh(vec4<f32>(1.f)); var res: vec4<f32> = acosh(vec4<f32>(2.f));
} }
@vertex @vertex

View File

@ -1,9 +1,5 @@
float4 tint_acosh(float4 x) {
return log((x + sqrt(((x * x) - 1.0f))));
}
void acosh_d51ccb() { void acosh_d51ccb() {
float4 res = tint_acosh((1.0f).xxxx); float4 res = (1.316957951f).xxxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,9 +1,5 @@
float4 tint_acosh(float4 x) {
return log((x + sqrt(((x * x) - 1.0f))));
}
void acosh_d51ccb() { void acosh_d51ccb() {
float4 res = tint_acosh((1.0f).xxxx); float4 res = (1.316957951f).xxxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
#version 310 es #version 310 es
vec4 tint_acosh(vec4 x) {
return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f)));
}
void acosh_d51ccb() { void acosh_d51ccb() {
vec4 res = tint_acosh(vec4(1.0f)); vec4 res = vec4(1.316957951f);
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -24,12 +20,8 @@ void main() {
#version 310 es #version 310 es
precision mediump float; precision mediump float;
vec4 tint_acosh(vec4 x) {
return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f)));
}
void acosh_d51ccb() { void acosh_d51ccb() {
vec4 res = tint_acosh(vec4(1.0f)); vec4 res = vec4(1.316957951f);
} }
void fragment_main() { void fragment_main() {
@ -42,12 +34,8 @@ void main() {
} }
#version 310 es #version 310 es
vec4 tint_acosh(vec4 x) {
return mix(acosh(x), vec4(0.0f), lessThan(x, vec4(1.0f)));
}
void acosh_d51ccb() { void acosh_d51ccb() {
vec4 res = tint_acosh(vec4(1.0f)); vec4 res = vec4(1.316957951f);
} }
void compute_main() { void compute_main() {

View File

@ -1,12 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
float4 tint_acosh(float4 x) {
return select(acosh(x), float4(0.0f), (x < float4(1.0f)));
}
void acosh_d51ccb() { void acosh_d51ccb() {
float4 res = tint_acosh(float4(1.0f)); float4 res = float4(1.316957951f);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 41 ; Bound: 31
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%20 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main" OpEntryPoint Fragment %fragment_main "fragment_main"
@ -13,8 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1 OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value" OpName %value "value"
OpName %vertex_point_size "vertex_point_size" OpName %vertex_point_size "vertex_point_size"
OpName %tint_acosh "tint_acosh"
OpName %x "x"
OpName %acosh_d51ccb "acosh_d51ccb" OpName %acosh_d51ccb "acosh_d51ccb"
OpName %res "res" OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner" OpName %vertex_main_inner "vertex_main_inner"
@ -31,49 +28,38 @@
%_ptr_Output_float = OpTypePointer Output %float %_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float %8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
%9 = OpTypeFunction %v4float %v4float
%float_1 = OpConstant %float 1
%15 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%bool = OpTypeBool
%v4bool = OpTypeVector %bool 4
%void = OpTypeVoid %void = OpTypeVoid
%21 = OpTypeFunction %void %9 = OpTypeFunction %void
%float_1_31695795 = OpConstant %float 1.31695795
%14 = OpConstantComposite %v4float %float_1_31695795 %float_1_31695795 %float_1_31695795 %float_1_31695795
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%28 = OpTypeFunction %v4float %17 = OpTypeFunction %v4float
%tint_acosh = OpFunction %v4float None %9 %float_1 = OpConstant %float 1
%x = OpFunctionParameter %v4float %acosh_d51ccb = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%16 = OpFOrdLessThan %v4bool %x %15
%19 = OpExtInst %v4float %20 Acosh %x
%13 = OpSelect %v4float %16 %5 %19
OpReturnValue %13
OpFunctionEnd
%acosh_d51ccb = OpFunction %void None %21
%24 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5 %res = OpVariable %_ptr_Function_v4float Function %5
%25 = OpFunctionCall %v4float %tint_acosh %15 OpStore %res %14
OpStore %res %25
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %28 %vertex_main_inner = OpFunction %v4float None %17
%30 = OpLabel %19 = OpLabel
%31 = OpFunctionCall %void %acosh_d51ccb %20 = OpFunctionCall %void %acosh_d51ccb
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %21 %vertex_main = OpFunction %void None %9
%33 = OpLabel %22 = OpLabel
%34 = OpFunctionCall %v4float %vertex_main_inner %23 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %34 OpStore %value %23
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %21 %fragment_main = OpFunction %void None %9
%36 = OpLabel %26 = OpLabel
%37 = OpFunctionCall %void %acosh_d51ccb %27 = OpFunctionCall %void %acosh_d51ccb
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %21 %compute_main = OpFunction %void None %9
%39 = OpLabel %29 = OpLabel
%40 = OpFunctionCall %void %acosh_d51ccb %30 = OpFunctionCall %void %acosh_d51ccb
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn acosh_d51ccb() { fn acosh_d51ccb() {
var res : vec4<f32> = acosh(vec4<f32>(1.0f)); var res : vec4<f32> = acosh(vec4<f32>(2.0f));
} }
@vertex @vertex

View File

@ -25,7 +25,7 @@ enable f16;
// fn acosh(vec<4, f16>) -> vec<4, f16> // fn acosh(vec<4, f16>) -> vec<4, f16>
fn acosh_de60d8() { fn acosh_de60d8() {
var res: vec4<f16> = acosh(vec4<f16>(1.h)); var res: vec4<f16> = acosh(vec4<f16>(2.h));
} }
@vertex @vertex

View File

@ -1,9 +1,5 @@
vector<float16_t, 4> tint_acosh(vector<float16_t, 4> x) {
return log((x + sqrt(((x * x) - float16_t(1.0h)))));
}
void acosh_de60d8() { void acosh_de60d8() {
vector<float16_t, 4> res = tint_acosh((float16_t(1.0h)).xxxx); vector<float16_t, 4> res = (float16_t(1.31640625h)).xxxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
SKIP: FAILED SKIP: FAILED
vector<float16_t, 4> tint_acosh(vector<float16_t, 4> x) {
return log((x + sqrt(((x * x) - float16_t(1.0h)))));
}
void acosh_de60d8() { void acosh_de60d8() {
vector<float16_t, 4> res = tint_acosh((float16_t(0.0h)).xxxx); vector<float16_t, 4> res = (float16_t(1.31640625h)).xxxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,12 +1,8 @@
#version 310 es #version 310 es
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec4 tint_acosh(f16vec4 x) {
return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf)));
}
void acosh_de60d8() { void acosh_de60d8() {
f16vec4 res = tint_acosh(f16vec4(1.0hf)); f16vec4 res = f16vec4(1.31640625hf);
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -26,12 +22,8 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
precision mediump float; precision mediump float;
f16vec4 tint_acosh(f16vec4 x) {
return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf)));
}
void acosh_de60d8() { void acosh_de60d8() {
f16vec4 res = tint_acosh(f16vec4(1.0hf)); f16vec4 res = f16vec4(1.31640625hf);
} }
void fragment_main() { void fragment_main() {
@ -45,12 +37,8 @@ void main() {
#version 310 es #version 310 es
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec4 tint_acosh(f16vec4 x) {
return mix(acosh(x), f16vec4(0.0hf), lessThan(x, f16vec4(1.0hf)));
}
void acosh_de60d8() { void acosh_de60d8() {
f16vec4 res = tint_acosh(f16vec4(1.0hf)); f16vec4 res = f16vec4(1.31640625hf);
} }
void compute_main() { void compute_main() {

View File

@ -1,12 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
half4 tint_acosh(half4 x) {
return select(acosh(x), half4(0.0h), (x < half4(1.0h)));
}
void acosh_de60d8() { void acosh_de60d8() {
half4 res = tint_acosh(half4(1.0h)); half4 res = half4(1.31640625h);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,14 +1,13 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 45 ; Bound: 34
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16 OpCapability StorageInputOutput16
%23 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main" OpEntryPoint Fragment %fragment_main "fragment_main"
@ -17,8 +16,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1 OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value" OpName %value "value"
OpName %vertex_point_size "vertex_point_size" OpName %vertex_point_size "vertex_point_size"
OpName %tint_acosh "tint_acosh"
OpName %x "x"
OpName %acosh_de60d8 "acosh_de60d8" OpName %acosh_de60d8 "acosh_de60d8"
OpName %res "res" OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner" OpName %vertex_main_inner "vertex_main_inner"
@ -35,53 +32,41 @@
%_ptr_Output_float = OpTypePointer Output %float %_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float %8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v4half = OpTypeVector %half 4 %v4half = OpTypeVector %half 4
%9 = OpTypeFunction %v4half %v4half %half_0x1_51p_0 = OpConstant %half 0x1.51p+0
%half_0x1p_0 = OpConstant %half 0x1p+0 %16 = OpConstantComposite %v4half %half_0x1_51p_0 %half_0x1_51p_0 %half_0x1_51p_0 %half_0x1_51p_0
%17 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%bool = OpTypeBool
%v4bool = OpTypeVector %bool 4
%21 = OpConstantNull %v4half
%void = OpTypeVoid
%24 = OpTypeFunction %void
%_ptr_Function_v4half = OpTypePointer Function %v4half %_ptr_Function_v4half = OpTypePointer Function %v4half
%31 = OpTypeFunction %v4float %19 = OpConstantNull %v4half
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%tint_acosh = OpFunction %v4half None %9 %acosh_de60d8 = OpFunction %void None %9
%x = OpFunctionParameter %v4half %12 = OpLabel
%14 = OpLabel %res = OpVariable %_ptr_Function_v4half Function %19
%18 = OpFOrdLessThan %v4bool %x %17 OpStore %res %16
%22 = OpExtInst %v4half %23 Acosh %x
%15 = OpSelect %v4half %18 %21 %22
OpReturnValue %15
OpFunctionEnd
%acosh_de60d8 = OpFunction %void None %24
%27 = OpLabel
%res = OpVariable %_ptr_Function_v4half Function %21
%28 = OpFunctionCall %v4half %tint_acosh %17
OpStore %res %28
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %31 %vertex_main_inner = OpFunction %v4float None %20
%33 = OpLabel %22 = OpLabel
%34 = OpFunctionCall %void %acosh_de60d8 %23 = OpFunctionCall %void %acosh_de60d8
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %24 %vertex_main = OpFunction %void None %9
%36 = OpLabel %25 = OpLabel
%37 = OpFunctionCall %v4float %vertex_main_inner %26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %37 OpStore %value %26
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %24 %fragment_main = OpFunction %void None %9
%40 = OpLabel %29 = OpLabel
%41 = OpFunctionCall %void %acosh_de60d8 %30 = OpFunctionCall %void %acosh_de60d8
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %24 %compute_main = OpFunction %void None %9
%43 = OpLabel %32 = OpLabel
%44 = OpFunctionCall %void %acosh_de60d8 %33 = OpFunctionCall %void %acosh_de60d8
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,7 +1,7 @@
enable f16; enable f16;
fn acosh_de60d8() { fn acosh_de60d8() {
var res : vec4<f16> = acosh(vec4<f16>(1.0h)); var res : vec4<f16> = acosh(vec4<f16>(2.0h));
} }
@vertex @vertex

View File

@ -1,4 +1,4 @@
// Copyright 2021 The Tint Authors. // Copyright 2022 The Tint Authors.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@
// fn acosh(vec<3, f32>) -> vec<3, f32> // fn acosh(vec<3, f32>) -> vec<3, f32>
fn acosh_e38f5c() { fn acosh_e38f5c() {
var res: vec3<f32> = acosh(vec3<f32>(1.f)); var res: vec3<f32> = acosh(vec3<f32>(2.f));
} }
@vertex @vertex

View File

@ -1,9 +1,5 @@
float3 tint_acosh(float3 x) {
return log((x + sqrt(((x * x) - 1.0f))));
}
void acosh_e38f5c() { void acosh_e38f5c() {
float3 res = tint_acosh((1.0f).xxx); float3 res = (1.316957951f).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,9 +1,5 @@
float3 tint_acosh(float3 x) {
return log((x + sqrt(((x * x) - 1.0f))));
}
void acosh_e38f5c() { void acosh_e38f5c() {
float3 res = tint_acosh((1.0f).xxx); float3 res = (1.316957951f).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
#version 310 es #version 310 es
vec3 tint_acosh(vec3 x) {
return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f)));
}
void acosh_e38f5c() { void acosh_e38f5c() {
vec3 res = tint_acosh(vec3(1.0f)); vec3 res = vec3(1.316957951f);
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -24,12 +20,8 @@ void main() {
#version 310 es #version 310 es
precision mediump float; precision mediump float;
vec3 tint_acosh(vec3 x) {
return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f)));
}
void acosh_e38f5c() { void acosh_e38f5c() {
vec3 res = tint_acosh(vec3(1.0f)); vec3 res = vec3(1.316957951f);
} }
void fragment_main() { void fragment_main() {
@ -42,12 +34,8 @@ void main() {
} }
#version 310 es #version 310 es
vec3 tint_acosh(vec3 x) {
return mix(acosh(x), vec3(0.0f), lessThan(x, vec3(1.0f)));
}
void acosh_e38f5c() { void acosh_e38f5c() {
vec3 res = tint_acosh(vec3(1.0f)); vec3 res = vec3(1.316957951f);
} }
void compute_main() { void compute_main() {

View File

@ -1,12 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
float3 tint_acosh(float3 x) {
return select(acosh(x), float3(0.0f), (x < float3(1.0f)));
}
void acosh_e38f5c() { void acosh_e38f5c() {
float3 res = tint_acosh(float3(1.0f)); float3 res = float3(1.316957951f);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 43 ; Bound: 33
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%22 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main" OpEntryPoint Fragment %fragment_main "fragment_main"
@ -13,8 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1 OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value" OpName %value "value"
OpName %vertex_point_size "vertex_point_size" OpName %vertex_point_size "vertex_point_size"
OpName %tint_acosh "tint_acosh"
OpName %x "x"
OpName %acosh_e38f5c "acosh_e38f5c" OpName %acosh_e38f5c "acosh_e38f5c"
OpName %res "res" OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner" OpName %vertex_main_inner "vertex_main_inner"
@ -31,51 +28,40 @@
%_ptr_Output_float = OpTypePointer Output %float %_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float %8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
%v3float = OpTypeVector %float 3
%9 = OpTypeFunction %v3float %v3float
%float_1 = OpConstant %float 1
%16 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%bool = OpTypeBool
%v3bool = OpTypeVector %bool 3
%20 = OpConstantNull %v3float
%void = OpTypeVoid %void = OpTypeVoid
%23 = OpTypeFunction %void %9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%float_1_31695795 = OpConstant %float 1.31695795
%15 = OpConstantComposite %v3float %float_1_31695795 %float_1_31695795 %float_1_31695795
%_ptr_Function_v3float = OpTypePointer Function %v3float %_ptr_Function_v3float = OpTypePointer Function %v3float
%30 = OpTypeFunction %v4float %18 = OpConstantNull %v3float
%tint_acosh = OpFunction %v3float None %9 %19 = OpTypeFunction %v4float
%x = OpFunctionParameter %v3float %float_1 = OpConstant %float 1
%13 = OpLabel %acosh_e38f5c = OpFunction %void None %9
%17 = OpFOrdLessThan %v3bool %x %16 %12 = OpLabel
%21 = OpExtInst %v3float %22 Acosh %x %res = OpVariable %_ptr_Function_v3float Function %18
%14 = OpSelect %v3float %17 %20 %21 OpStore %res %15
OpReturnValue %14
OpFunctionEnd
%acosh_e38f5c = OpFunction %void None %23
%26 = OpLabel
%res = OpVariable %_ptr_Function_v3float Function %20
%27 = OpFunctionCall %v3float %tint_acosh %16
OpStore %res %27
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %30 %vertex_main_inner = OpFunction %v4float None %19
%32 = OpLabel %21 = OpLabel
%33 = OpFunctionCall %void %acosh_e38f5c %22 = OpFunctionCall %void %acosh_e38f5c
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %23 %vertex_main = OpFunction %void None %9
%35 = OpLabel %24 = OpLabel
%36 = OpFunctionCall %v4float %vertex_main_inner %25 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %36 OpStore %value %25
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %23 %fragment_main = OpFunction %void None %9
%38 = OpLabel %28 = OpLabel
%39 = OpFunctionCall %void %acosh_e38f5c %29 = OpFunctionCall %void %acosh_e38f5c
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %23 %compute_main = OpFunction %void None %9
%41 = OpLabel %31 = OpLabel
%42 = OpFunctionCall %void %acosh_e38f5c %32 = OpFunctionCall %void %acosh_e38f5c
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn acosh_e38f5c() { fn acosh_e38f5c() {
var res : vec3<f32> = acosh(vec3<f32>(1.0f)); var res : vec3<f32> = acosh(vec3<f32>(2.0f));
} }
@vertex @vertex

View File

@ -1,4 +1,4 @@
// Copyright 2021 The Tint Authors. // Copyright 2022 The Tint Authors.
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. // you may not use this file except in compliance with the License.
@ -23,7 +23,7 @@
// fn acosh(f32) -> f32 // fn acosh(f32) -> f32
fn acosh_ecf2d1() { fn acosh_ecf2d1() {
var res: f32 = acosh(1.f); var res: f32 = acosh(2.f);
} }
@vertex @vertex

View File

@ -1,9 +1,5 @@
float tint_acosh(float x) {
return log((x + sqrt(((x * x) - 1.0f))));
}
void acosh_ecf2d1() { void acosh_ecf2d1() {
float res = tint_acosh(1.0f); float res = 1.316957951f;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,9 +1,5 @@
float tint_acosh(float x) {
return log((x + sqrt(((x * x) - 1.0f))));
}
void acosh_ecf2d1() { void acosh_ecf2d1() {
float res = tint_acosh(1.0f); float res = 1.316957951f;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
#version 310 es #version 310 es
float tint_acosh(float x) {
return ((x < 1.0f) ? 0.0f : acosh(x));
}
void acosh_ecf2d1() { void acosh_ecf2d1() {
float res = tint_acosh(1.0f); float res = 1.316957951f;
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -24,12 +20,8 @@ void main() {
#version 310 es #version 310 es
precision mediump float; precision mediump float;
float tint_acosh(float x) {
return ((x < 1.0f) ? 0.0f : acosh(x));
}
void acosh_ecf2d1() { void acosh_ecf2d1() {
float res = tint_acosh(1.0f); float res = 1.316957951f;
} }
void fragment_main() { void fragment_main() {
@ -42,12 +34,8 @@ void main() {
} }
#version 310 es #version 310 es
float tint_acosh(float x) {
return ((x < 1.0f) ? 0.0f : acosh(x));
}
void acosh_ecf2d1() { void acosh_ecf2d1() {
float res = tint_acosh(1.0f); float res = 1.316957951f;
} }
void compute_main() { void compute_main() {

View File

@ -1,12 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
float tint_acosh(float x) {
return select(acosh(x), 0.0f, (x < 1.0f));
}
void acosh_ecf2d1() { void acosh_ecf2d1() {
float res = tint_acosh(1.0f); float res = 1.316957951f;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,10 +1,9 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 39 ; Bound: 30
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main" OpEntryPoint Fragment %fragment_main "fragment_main"
@ -13,8 +12,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1 OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value" OpName %value "value"
OpName %vertex_point_size "vertex_point_size" OpName %vertex_point_size "vertex_point_size"
OpName %tint_acosh "tint_acosh"
OpName %x "x"
OpName %acosh_ecf2d1 "acosh_ecf2d1" OpName %acosh_ecf2d1 "acosh_ecf2d1"
OpName %res "res" OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner" OpName %vertex_main_inner "vertex_main_inner"
@ -31,47 +28,37 @@
%_ptr_Output_float = OpTypePointer Output %float %_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float %8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
%9 = OpTypeFunction %float %float
%float_1 = OpConstant %float 1
%bool = OpTypeBool
%void = OpTypeVoid %void = OpTypeVoid
%19 = OpTypeFunction %void %9 = OpTypeFunction %void
%float_1_31695795 = OpConstant %float 1.31695795
%_ptr_Function_float = OpTypePointer Function %float %_ptr_Function_float = OpTypePointer Function %float
%26 = OpTypeFunction %v4float %16 = OpTypeFunction %v4float
%tint_acosh = OpFunction %float None %9 %float_1 = OpConstant %float 1
%x = OpFunctionParameter %float %acosh_ecf2d1 = OpFunction %void None %9
%12 = OpLabel %12 = OpLabel
%15 = OpFOrdLessThan %bool %x %float_1
%17 = OpExtInst %float %18 Acosh %x
%13 = OpSelect %float %15 %8 %17
OpReturnValue %13
OpFunctionEnd
%acosh_ecf2d1 = OpFunction %void None %19
%22 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8 %res = OpVariable %_ptr_Function_float Function %8
%23 = OpFunctionCall %float %tint_acosh %float_1 OpStore %res %float_1_31695795
OpStore %res %23
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %26 %vertex_main_inner = OpFunction %v4float None %16
%28 = OpLabel %18 = OpLabel
%29 = OpFunctionCall %void %acosh_ecf2d1 %19 = OpFunctionCall %void %acosh_ecf2d1
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %19 %vertex_main = OpFunction %void None %9
%31 = OpLabel %21 = OpLabel
%32 = OpFunctionCall %v4float %vertex_main_inner %22 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %32 OpStore %value %22
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %19 %fragment_main = OpFunction %void None %9
%34 = OpLabel %25 = OpLabel
%35 = OpFunctionCall %void %acosh_ecf2d1 %26 = OpFunctionCall %void %acosh_ecf2d1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %19 %compute_main = OpFunction %void None %9
%37 = OpLabel %28 = OpLabel
%38 = OpFunctionCall %void %acosh_ecf2d1 %29 = OpFunctionCall %void %acosh_ecf2d1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,5 +1,5 @@
fn acosh_ecf2d1() { fn acosh_ecf2d1() {
var res : f32 = acosh(1.0f); var res : f32 = acosh(2.0f);
} }
@vertex @vertex

View File

@ -25,7 +25,7 @@ enable f16;
// fn acosh(vec<3, f16>) -> vec<3, f16> // fn acosh(vec<3, f16>) -> vec<3, f16>
fn acosh_f56574() { fn acosh_f56574() {
var res: vec3<f16> = acosh(vec3<f16>(1.h)); var res: vec3<f16> = acosh(vec3<f16>(2.h));
} }
@vertex @vertex

View File

@ -1,9 +1,5 @@
vector<float16_t, 3> tint_acosh(vector<float16_t, 3> x) {
return log((x + sqrt(((x * x) - float16_t(1.0h)))));
}
void acosh_f56574() { void acosh_f56574() {
vector<float16_t, 3> res = tint_acosh((float16_t(1.0h)).xxx); vector<float16_t, 3> res = (float16_t(1.31640625h)).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,11 +1,7 @@
SKIP: FAILED SKIP: FAILED
vector<float16_t, 3> tint_acosh(vector<float16_t, 3> x) {
return log((x + sqrt(((x * x) - float16_t(1.0h)))));
}
void acosh_f56574() { void acosh_f56574() {
vector<float16_t, 3> res = tint_acosh((float16_t(0.0h)).xxx); vector<float16_t, 3> res = (float16_t(1.31640625h)).xxx;
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,12 +1,8 @@
#version 310 es #version 310 es
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec3 tint_acosh(f16vec3 x) {
return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf)));
}
void acosh_f56574() { void acosh_f56574() {
f16vec3 res = tint_acosh(f16vec3(1.0hf)); f16vec3 res = f16vec3(1.31640625hf);
} }
vec4 vertex_main() { vec4 vertex_main() {
@ -26,12 +22,8 @@ void main() {
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
precision mediump float; precision mediump float;
f16vec3 tint_acosh(f16vec3 x) {
return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf)));
}
void acosh_f56574() { void acosh_f56574() {
f16vec3 res = tint_acosh(f16vec3(1.0hf)); f16vec3 res = f16vec3(1.31640625hf);
} }
void fragment_main() { void fragment_main() {
@ -45,12 +37,8 @@ void main() {
#version 310 es #version 310 es
#extension GL_AMD_gpu_shader_half_float : require #extension GL_AMD_gpu_shader_half_float : require
f16vec3 tint_acosh(f16vec3 x) {
return mix(acosh(x), f16vec3(0.0hf), lessThan(x, f16vec3(1.0hf)));
}
void acosh_f56574() { void acosh_f56574() {
f16vec3 res = tint_acosh(f16vec3(1.0hf)); f16vec3 res = f16vec3(1.31640625hf);
} }
void compute_main() { void compute_main() {

View File

@ -1,12 +1,8 @@
#include <metal_stdlib> #include <metal_stdlib>
using namespace metal; using namespace metal;
half3 tint_acosh(half3 x) {
return select(acosh(x), half3(0.0h), (x < half3(1.0h)));
}
void acosh_f56574() { void acosh_f56574() {
half3 res = tint_acosh(half3(1.0h)); half3 res = half3(1.31640625h);
} }
struct tint_symbol { struct tint_symbol {

View File

@ -1,14 +1,13 @@
; SPIR-V ; SPIR-V
; Version: 1.3 ; Version: 1.3
; Generator: Google Tint Compiler; 0 ; Generator: Google Tint Compiler; 0
; Bound: 45 ; Bound: 34
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability Float16 OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16 OpCapability StorageInputOutput16
%23 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450 OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main" OpEntryPoint Fragment %fragment_main "fragment_main"
@ -17,8 +16,6 @@
OpExecutionMode %compute_main LocalSize 1 1 1 OpExecutionMode %compute_main LocalSize 1 1 1
OpName %value "value" OpName %value "value"
OpName %vertex_point_size "vertex_point_size" OpName %vertex_point_size "vertex_point_size"
OpName %tint_acosh "tint_acosh"
OpName %x "x"
OpName %acosh_f56574 "acosh_f56574" OpName %acosh_f56574 "acosh_f56574"
OpName %res "res" OpName %res "res"
OpName %vertex_main_inner "vertex_main_inner" OpName %vertex_main_inner "vertex_main_inner"
@ -35,53 +32,41 @@
%_ptr_Output_float = OpTypePointer Output %float %_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float %8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8 %vertex_point_size = OpVariable %_ptr_Output_float Output %8
%void = OpTypeVoid
%9 = OpTypeFunction %void
%half = OpTypeFloat 16 %half = OpTypeFloat 16
%v3half = OpTypeVector %half 3 %v3half = OpTypeVector %half 3
%9 = OpTypeFunction %v3half %v3half %half_0x1_51p_0 = OpConstant %half 0x1.51p+0
%half_0x1p_0 = OpConstant %half 0x1p+0 %16 = OpConstantComposite %v3half %half_0x1_51p_0 %half_0x1_51p_0 %half_0x1_51p_0
%17 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%bool = OpTypeBool
%v3bool = OpTypeVector %bool 3
%21 = OpConstantNull %v3half
%void = OpTypeVoid
%24 = OpTypeFunction %void
%_ptr_Function_v3half = OpTypePointer Function %v3half %_ptr_Function_v3half = OpTypePointer Function %v3half
%31 = OpTypeFunction %v4float %19 = OpConstantNull %v3half
%20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%tint_acosh = OpFunction %v3half None %9 %acosh_f56574 = OpFunction %void None %9
%x = OpFunctionParameter %v3half %12 = OpLabel
%14 = OpLabel %res = OpVariable %_ptr_Function_v3half Function %19
%18 = OpFOrdLessThan %v3bool %x %17 OpStore %res %16
%22 = OpExtInst %v3half %23 Acosh %x
%15 = OpSelect %v3half %18 %21 %22
OpReturnValue %15
OpFunctionEnd
%acosh_f56574 = OpFunction %void None %24
%27 = OpLabel
%res = OpVariable %_ptr_Function_v3half Function %21
%28 = OpFunctionCall %v3half %tint_acosh %17
OpStore %res %28
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %31 %vertex_main_inner = OpFunction %v4float None %20
%33 = OpLabel %22 = OpLabel
%34 = OpFunctionCall %void %acosh_f56574 %23 = OpFunctionCall %void %acosh_f56574
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %24 %vertex_main = OpFunction %void None %9
%36 = OpLabel %25 = OpLabel
%37 = OpFunctionCall %v4float %vertex_main_inner %26 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %37 OpStore %value %26
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %24 %fragment_main = OpFunction %void None %9
%40 = OpLabel %29 = OpLabel
%41 = OpFunctionCall %void %acosh_f56574 %30 = OpFunctionCall %void %acosh_f56574
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %24 %compute_main = OpFunction %void None %9
%43 = OpLabel %32 = OpLabel
%44 = OpFunctionCall %void %acosh_f56574 %33 = OpFunctionCall %void %acosh_f56574
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -1,7 +1,7 @@
enable f16; enable f16;
fn acosh_f56574() { fn acosh_f56574() {
var res : vec3<f16> = acosh(vec3<f16>(1.0h)); var res : vec3<f16> = acosh(vec3<f16>(2.0h));
} }
@vertex @vertex

View File

@ -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 acosh(vec<2, fa>) -> vec<2, fa>
fn acosh_17260e() {
const arg_0 = vec2(2.);
var res = acosh(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_17260e();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_17260e();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_17260e();
}

View File

@ -0,0 +1,30 @@
void acosh_17260e() {
float2 res = (1.316957951f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_17260e();
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() {
acosh_17260e();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_17260e();
return;
}

View File

@ -0,0 +1,30 @@
void acosh_17260e() {
float2 res = (1.316957951f).xx;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_17260e();
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() {
acosh_17260e();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_17260e();
return;
}

View File

@ -0,0 +1,49 @@
#version 310 es
void acosh_17260e() {
vec2 res = vec2(1.316957951f);
}
vec4 vertex_main() {
acosh_17260e();
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 acosh_17260e() {
vec2 res = vec2(1.316957951f);
}
void fragment_main() {
acosh_17260e();
}
void main() {
fragment_main();
return;
}
#version 310 es
void acosh_17260e() {
vec2 res = vec2(1.316957951f);
}
void compute_main() {
acosh_17260e();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
void main() {
compute_main();
return;
}

View File

@ -0,0 +1,33 @@
#include <metal_stdlib>
using namespace metal;
void acosh_17260e() {
float2 res = float2(1.316957951f);
}
struct tint_symbol {
float4 value [[position]];
};
float4 vertex_main_inner() {
acosh_17260e();
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() {
acosh_17260e();
return;
}
kernel void compute_main() {
acosh_17260e();
return;
}

View File

@ -0,0 +1,67 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 33
; 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 %acosh_17260e "acosh_17260e"
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_31695795 = OpConstant %float 1.31695795
%15 = OpConstantComposite %v2float %float_1_31695795 %float_1_31695795
%_ptr_Function_v2float = OpTypePointer Function %v2float
%18 = OpConstantNull %v2float
%19 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%acosh_17260e = 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 %acosh_17260e
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
%28 = OpLabel
%29 = OpFunctionCall %void %acosh_17260e
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
%31 = OpLabel
%32 = OpFunctionCall %void %acosh_17260e
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,20 @@
fn acosh_17260e() {
const arg_0 = vec2(2.0);
var res = acosh(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_17260e();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_17260e();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_17260e();
}

View File

@ -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 acosh(fa) -> fa
fn acosh_3433e8() {
const arg_0 = 2.;
var res = acosh(arg_0);
}
@vertex
fn vertex_main() -> @builtin(position) vec4<f32> {
acosh_3433e8();
return vec4<f32>();
}
@fragment
fn fragment_main() {
acosh_3433e8();
}
@compute @workgroup_size(1)
fn compute_main() {
acosh_3433e8();
}

View File

@ -0,0 +1,30 @@
void acosh_3433e8() {
float res = 1.316957951f;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_3433e8();
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() {
acosh_3433e8();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_3433e8();
return;
}

View File

@ -0,0 +1,30 @@
void acosh_3433e8() {
float res = 1.316957951f;
}
struct tint_symbol {
float4 value : SV_Position;
};
float4 vertex_main_inner() {
acosh_3433e8();
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() {
acosh_3433e8();
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
acosh_3433e8();
return;
}

Some files were not shown because too many files have changed in this diff Show More