From 9cbc7e1e54b5b6385c4529cdc30f9398514aadf1 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 3 Nov 2022 14:49:23 +0000 Subject: [PATCH] Implement const-eval for `acos` This CL adds const-eval for the `acos` builtin. Bug: tint:1581 Change-Id: I01c0f48e73eedf87cf9c912715487f8eea44f64e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108341 Commit-Queue: Dan Sinclair Reviewed-by: Antonio Maiorano Kokoro: Kokoro --- src/tint/intrinsics.def | 4 +- src/tint/resolver/const_eval.cc | 25 +++++-- src/tint/resolver/const_eval.h | 9 +++ src/tint/resolver/const_eval_builtin_test.cc | 64 ++++++++++++++++++ src/tint/resolver/intrinsic_table.inl | 12 ++-- .../acos/004aff.wgsl.expected.dxc.hlsl | 2 +- .../literal/acos/004aff.wgsl.expected.glsl | 6 +- .../gen/literal/acos/004aff.wgsl.expected.msl | 2 +- .../literal/acos/004aff.wgsl.expected.spvasm | 10 +-- .../builtins/gen/literal/acos/069188.wgsl | 43 ++++++++++++ .../acos/069188.wgsl.expected.dxc.hlsl | 30 +++++++++ .../acos/069188.wgsl.expected.fxc.hlsl | 30 +++++++++ .../literal/acos/069188.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/acos/069188.wgsl.expected.msl | 33 +++++++++ .../literal/acos/069188.wgsl.expected.spvasm | 67 +++++++++++++++++++ .../literal/acos/069188.wgsl.expected.wgsl | 19 ++++++ .../builtins/gen/literal/acos/15d35b.wgsl | 43 ++++++++++++ .../acos/15d35b.wgsl.expected.dxc.hlsl | 30 +++++++++ .../acos/15d35b.wgsl.expected.fxc.hlsl | 30 +++++++++ .../literal/acos/15d35b.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/acos/15d35b.wgsl.expected.msl | 33 +++++++++ .../literal/acos/15d35b.wgsl.expected.spvasm | 67 +++++++++++++++++++ .../literal/acos/15d35b.wgsl.expected.wgsl | 19 ++++++ .../acos/203628.wgsl.expected.dxc.hlsl | 2 +- .../literal/acos/203628.wgsl.expected.glsl | 6 +- .../gen/literal/acos/203628.wgsl.expected.msl | 2 +- .../literal/acos/203628.wgsl.expected.spvasm | 10 +-- .../acos/303e3d.wgsl.expected.dxc.hlsl | 2 +- .../literal/acos/303e3d.wgsl.expected.glsl | 6 +- .../gen/literal/acos/303e3d.wgsl.expected.msl | 2 +- .../literal/acos/303e3d.wgsl.expected.spvasm | 33 +++++---- .../builtins/gen/literal/acos/489247.wgsl | 2 +- .../acos/489247.wgsl.expected.dxc.hlsl | 2 +- .../acos/489247.wgsl.expected.fxc.hlsl | 2 +- .../literal/acos/489247.wgsl.expected.glsl | 6 +- .../gen/literal/acos/489247.wgsl.expected.msl | 2 +- .../literal/acos/489247.wgsl.expected.spvasm | 31 +++++---- .../literal/acos/489247.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/acos/4dac75.wgsl | 43 ++++++++++++ .../acos/4dac75.wgsl.expected.dxc.hlsl | 30 +++++++++ .../acos/4dac75.wgsl.expected.fxc.hlsl | 30 +++++++++ .../literal/acos/4dac75.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/acos/4dac75.wgsl.expected.msl | 33 +++++++++ .../literal/acos/4dac75.wgsl.expected.spvasm | 65 ++++++++++++++++++ .../literal/acos/4dac75.wgsl.expected.wgsl | 19 ++++++ .../builtins/gen/literal/acos/5e9ad2.wgsl | 43 ++++++++++++ .../acos/5e9ad2.wgsl.expected.dxc.hlsl | 30 +++++++++ .../acos/5e9ad2.wgsl.expected.fxc.hlsl | 30 +++++++++ .../literal/acos/5e9ad2.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/literal/acos/5e9ad2.wgsl.expected.msl | 33 +++++++++ .../literal/acos/5e9ad2.wgsl.expected.spvasm | 64 ++++++++++++++++++ .../literal/acos/5e9ad2.wgsl.expected.wgsl | 19 ++++++ .../builtins/gen/literal/acos/8e2acf.wgsl | 2 +- .../acos/8e2acf.wgsl.expected.dxc.hlsl | 2 +- .../acos/8e2acf.wgsl.expected.fxc.hlsl | 2 +- .../literal/acos/8e2acf.wgsl.expected.glsl | 6 +- .../gen/literal/acos/8e2acf.wgsl.expected.msl | 2 +- .../literal/acos/8e2acf.wgsl.expected.spvasm | 33 +++++---- .../literal/acos/8e2acf.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/acos/a610c4.wgsl | 2 +- .../acos/a610c4.wgsl.expected.dxc.hlsl | 2 +- .../acos/a610c4.wgsl.expected.fxc.hlsl | 2 +- .../literal/acos/a610c4.wgsl.expected.glsl | 6 +- .../gen/literal/acos/a610c4.wgsl.expected.msl | 2 +- .../literal/acos/a610c4.wgsl.expected.spvasm | 37 +++++----- .../literal/acos/a610c4.wgsl.expected.wgsl | 2 +- .../builtins/gen/literal/acos/dfc915.wgsl | 2 +- .../acos/dfc915.wgsl.expected.dxc.hlsl | 2 +- .../acos/dfc915.wgsl.expected.fxc.hlsl | 2 +- .../literal/acos/dfc915.wgsl.expected.glsl | 6 +- .../gen/literal/acos/dfc915.wgsl.expected.msl | 2 +- .../literal/acos/dfc915.wgsl.expected.spvasm | 37 +++++----- .../literal/acos/dfc915.wgsl.expected.wgsl | 2 +- .../acos/f47057.wgsl.expected.dxc.hlsl | 2 +- .../literal/acos/f47057.wgsl.expected.glsl | 6 +- .../gen/literal/acos/f47057.wgsl.expected.msl | 2 +- .../literal/acos/f47057.wgsl.expected.spvasm | 10 +-- test/tint/builtins/gen/var/acos/069188.wgsl | 44 ++++++++++++ .../var/acos/069188.wgsl.expected.dxc.hlsl | 30 +++++++++ .../var/acos/069188.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/acos/069188.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/acos/069188.wgsl.expected.msl | 33 +++++++++ .../gen/var/acos/069188.wgsl.expected.spvasm | 67 +++++++++++++++++++ .../gen/var/acos/069188.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/acos/15d35b.wgsl | 44 ++++++++++++ .../var/acos/15d35b.wgsl.expected.dxc.hlsl | 30 +++++++++ .../var/acos/15d35b.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/acos/15d35b.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/acos/15d35b.wgsl.expected.msl | 33 +++++++++ .../gen/var/acos/15d35b.wgsl.expected.spvasm | 67 +++++++++++++++++++ .../gen/var/acos/15d35b.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/acos/489247.wgsl | 2 +- .../var/acos/489247.wgsl.expected.dxc.hlsl | 2 +- .../var/acos/489247.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/acos/489247.wgsl.expected.glsl | 6 +- .../gen/var/acos/489247.wgsl.expected.msl | 2 +- .../gen/var/acos/489247.wgsl.expected.spvasm | 15 +++-- .../gen/var/acos/489247.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/acos/4dac75.wgsl | 44 ++++++++++++ .../var/acos/4dac75.wgsl.expected.dxc.hlsl | 30 +++++++++ .../var/acos/4dac75.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/acos/4dac75.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/acos/4dac75.wgsl.expected.msl | 33 +++++++++ .../gen/var/acos/4dac75.wgsl.expected.spvasm | 65 ++++++++++++++++++ .../gen/var/acos/4dac75.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/acos/5e9ad2.wgsl | 44 ++++++++++++ .../var/acos/5e9ad2.wgsl.expected.dxc.hlsl | 30 +++++++++ .../var/acos/5e9ad2.wgsl.expected.fxc.hlsl | 30 +++++++++ .../gen/var/acos/5e9ad2.wgsl.expected.glsl | 49 ++++++++++++++ .../gen/var/acos/5e9ad2.wgsl.expected.msl | 33 +++++++++ .../gen/var/acos/5e9ad2.wgsl.expected.spvasm | 64 ++++++++++++++++++ .../gen/var/acos/5e9ad2.wgsl.expected.wgsl | 20 ++++++ test/tint/builtins/gen/var/acos/8e2acf.wgsl | 2 +- .../var/acos/8e2acf.wgsl.expected.dxc.hlsl | 2 +- .../var/acos/8e2acf.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/acos/8e2acf.wgsl.expected.glsl | 6 +- .../gen/var/acos/8e2acf.wgsl.expected.msl | 2 +- .../gen/var/acos/8e2acf.wgsl.expected.spvasm | 15 +++-- .../gen/var/acos/8e2acf.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/acos/a610c4.wgsl | 2 +- .../var/acos/a610c4.wgsl.expected.dxc.hlsl | 2 +- .../var/acos/a610c4.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/acos/a610c4.wgsl.expected.glsl | 6 +- .../gen/var/acos/a610c4.wgsl.expected.msl | 2 +- .../gen/var/acos/a610c4.wgsl.expected.spvasm | 15 +++-- .../gen/var/acos/a610c4.wgsl.expected.wgsl | 2 +- test/tint/builtins/gen/var/acos/dfc915.wgsl | 2 +- .../var/acos/dfc915.wgsl.expected.dxc.hlsl | 2 +- .../var/acos/dfc915.wgsl.expected.fxc.hlsl | 2 +- .../gen/var/acos/dfc915.wgsl.expected.glsl | 6 +- .../gen/var/acos/dfc915.wgsl.expected.msl | 2 +- .../gen/var/acos/dfc915.wgsl.expected.spvasm | 15 +++-- .../gen/var/acos/dfc915.wgsl.expected.wgsl | 2 +- 133 files changed, 2482 insertions(+), 227 deletions(-) create mode 100644 test/tint/builtins/gen/literal/acos/069188.wgsl create mode 100644 test/tint/builtins/gen/literal/acos/069188.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/acos/069188.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/acos/069188.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/acos/069188.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/acos/069188.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/acos/069188.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/acos/15d35b.wgsl create mode 100644 test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/acos/4dac75.wgsl create mode 100644 test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/literal/acos/5e9ad2.wgsl create mode 100644 test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/acos/069188.wgsl create mode 100644 test/tint/builtins/gen/var/acos/069188.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/acos/069188.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/acos/069188.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/acos/069188.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/acos/069188.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/acos/069188.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/acos/15d35b.wgsl create mode 100644 test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/acos/4dac75.wgsl create mode 100644 test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.wgsl create mode 100644 test/tint/builtins/gen/var/acos/5e9ad2.wgsl create mode 100644 test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.dxc.hlsl create mode 100644 test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.fxc.hlsl create mode 100644 test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.glsl create mode 100644 test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.msl create mode 100644 test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.spvasm create mode 100644 test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.wgsl diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def index 72a537fe2e..8744257192 100644 --- a/src/tint/intrinsics.def +++ b/src/tint/intrinsics.def @@ -406,8 +406,8 @@ match storage // https://gpuweb.github.io/gpuweb/wgsl/#builtin-functions @const fn abs(T) -> T @const fn abs(vec) -> vec -fn acos(T) -> T -fn acos(vec) -> vec +@const fn acos(@test_value(0.87758256189) T) -> T +@const fn acos(@test_value(0.87758256189) vec) -> vec fn acosh(T) -> T fn acosh(vec) -> vec @const fn all(bool) -> bool diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc index 2795517336..9681961434 100644 --- a/src/tint/resolver/const_eval.cc +++ b/src/tint/resolver/const_eval.cc @@ -1595,6 +1595,23 @@ ConstEval::Result ConstEval::abs(const sem::Type* ty, return TransformElements(builder, ty, transform, args[0]); } +ConstEval::Result ConstEval::acos(const sem::Type* ty, + utils::VectorRef args, + const Source& source) { + auto transform = [&](const sem::Constant* c0) { + auto create = [&](auto i) -> ImplResult { + using NumberT = decltype(i); + if (i < NumberT(-1.0) || i > NumberT(1.0)) { + AddError("acos must be called with a value in the range [-1, 1]", source); + return utils::Failure; + } + return CreateElement(builder, c0->Type(), NumberT(std::acos(i.value))); + }; + return Dispatch_fa_f32_f16(create, c0); + }; + return TransformElements(builder, ty, transform, args[0]); +} + ConstEval::Result ConstEval::all(const sem::Type* ty, utils::VectorRef args, const Source&) { @@ -1613,11 +1630,11 @@ ConstEval::Result ConstEval::asin(const sem::Type* ty, auto transform = [&](const sem::Constant* c0) { auto create = [&](auto i) -> ImplResult { using NumberT = decltype(i); - if (i.value < NumberT(-1.0) || i.value > NumberT(1.0)) { + if (i < NumberT(-1.0) || i > NumberT(1.0)) { AddError("asin must be called with a value in the range [-1, 1]", source); return utils::Failure; } - return CreateElement(builder, c0->Type(), decltype(i)(std::asin(i.value))); + return CreateElement(builder, c0->Type(), NumberT(std::asin(i.value))); }; return Dispatch_fa_f32_f16(create, c0); }; @@ -1659,11 +1676,11 @@ ConstEval::Result ConstEval::atanh(const sem::Type* ty, auto transform = [&](const sem::Constant* c0) { auto create = [&](auto i) -> ImplResult { using NumberT = decltype(i); - if (i.value <= NumberT(-1.0) || i.value >= NumberT(1.0)) { + if (i <= NumberT(-1.0) || i >= NumberT(1.0)) { AddError("atanh must be called with a value in the range (-1, 1)", source); return utils::Failure; } - return CreateElement(builder, c0->Type(), decltype(i)(std::atanh(i.value))); + return CreateElement(builder, c0->Type(), NumberT(std::atanh(i.value))); }; return Dispatch_fa_f32_f16(create, c0); }; diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h index 6337988419..943f0ad5f2 100644 --- a/src/tint/resolver/const_eval.h +++ b/src/tint/resolver/const_eval.h @@ -395,6 +395,15 @@ class ConstEval { utils::VectorRef args, const Source& source); + /// acos 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 acos(const sem::Type* ty, + utils::VectorRef args, + const Source& source); + /// any builtin /// @param ty the expression type /// @param args the input arguments diff --git a/src/tint/resolver/const_eval_builtin_test.cc b/src/tint/resolver/const_eval_builtin_test.cc index 26ab4fa1ab..0a8978f5e9 100644 --- a/src/tint/resolver/const_eval_builtin_test.cc +++ b/src/tint/resolver/const_eval_builtin_test.cc @@ -425,6 +425,70 @@ TEST_F(ResolverConstEvalBuiltinTest, Atanh_OutsideRange_Negative_INF) { EXPECT_EQ(r()->error(), "12:24 error: atanh must be called with a value in the range (-1, 1)"); } +template +std::vector AcosCases() { + std::vector cases = { + // If i is +/-0, +/-0 is returned + C({T(0.87758256189)}, T(0.5)).FloatComp(), + + C({T(1.0)}, T(0.0)), + C({-T(1.0)}, kPi).FloatComp(), + + // Vector tests + C({Vec(T(1.0), -T(1.0))}, Vec(T(0), kPi)).FloatComp(), + }; + + ConcatIntoIf( // + cases, std::vector{ + // If i is NaN, NaN is returned + C({T::NaN()}, T::NaN()), + + // Vector tests + C({Vec(T::NaN(), T::NaN())}, Vec(T::NaN(), T::NaN())), + }); + + return cases; +} +INSTANTIATE_TEST_SUITE_P( // + Acos, + ResolverConstEvalBuiltinTest, + testing::Combine(testing::Values(sem::BuiltinType::kAcos), + testing::ValuesIn(Concat(AcosCases(), // + AcosCases(), + AcosCases())))); + +TEST_F(ResolverConstEvalBuiltinTest, Acos_OutsideRange_Positive) { + auto* expr = Call(Source{{12, 24}}, "acos", Expr(1.1_a)); + + GlobalConst("C", expr); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:24 error: acos must be called with a value in the range [-1, 1]"); +} + +TEST_F(ResolverConstEvalBuiltinTest, Acos_OutsideRange_Negative) { + auto* expr = Call(Source{{12, 24}}, "acos", Negation(1.1_a)); + + GlobalConst("C", expr); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:24 error: acos must be called with a value in the range [-1, 1]"); +} + +TEST_F(ResolverConstEvalBuiltinTest, Acos_OutsideRange_Positive_INF) { + auto* expr = Call(Source{{12, 24}}, "acos", Expr(f32::Inf())); + + GlobalConst("C", expr); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:24 error: acos must be called with a value in the range [-1, 1]"); +} + +TEST_F(ResolverConstEvalBuiltinTest, Acos_OutsideRange_Negative_INF) { + auto* expr = Call(Source{{12, 24}}, "acos", Negation(f32::Inf())); + + GlobalConst("C", expr); + EXPECT_FALSE(r()->Resolve()); + EXPECT_EQ(r()->error(), "12:24 error: acos must be called with a value in the range [-1, 1]"); +} + template std::vector AsinCases() { std::vector cases = { diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl index 2109cf44e6..c270b5bffd 100644 --- a/src/tint/resolver/intrinsic_table.inl +++ b/src/tint/resolver/intrinsic_table.inl @@ -13473,24 +13473,24 @@ constexpr OverloadInfo kOverloads[] = { /* num parameters */ 1, /* num template types */ 1, /* num template numbers */ 0, - /* template types */ &kTemplateTypes[22], + /* template types */ &kTemplateTypes[23], /* template numbers */ &kTemplateNumbers[10], /* parameters */ &kParameters[934], /* return matcher indices */ &kMatcherIndices[1], /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), - /* const eval */ nullptr, + /* const eval */ &ConstEval::acos, }, { /* [429] */ /* num parameters */ 1, /* num template types */ 1, /* num template numbers */ 1, - /* template types */ &kTemplateTypes[22], + /* template types */ &kTemplateTypes[23], /* template numbers */ &kTemplateNumbers[6], /* parameters */ &kParameters[946], /* return matcher indices */ &kMatcherIndices[30], /* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline), - /* const eval */ nullptr, + /* const eval */ &ConstEval::acos, }, { /* [430] */ @@ -14020,8 +14020,8 @@ constexpr IntrinsicInfo kBuiltins[] = { }, { /* [1] */ - /* fn acos(T) -> T */ - /* fn acos(vec) -> vec */ + /* fn acos(@test_value(0.87758256189) T) -> T */ + /* fn acos(@test_value(0.87758256189) vec) -> vec */ /* num overloads */ 2, /* overloads */ &kOverloads[428], }, diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.dxc.hlsl index 92b5765986..4b568a1fa6 100644 --- a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_004aff() { - vector res = acos((float16_t(0.0h)).xx); + vector res = (float16_t(1.5703125h)).xx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.glsl index c4dd0577a2..4fc451679d 100644 --- a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void acos_004aff() { - f16vec2 res = acos(f16vec2(0.0hf)); + f16vec2 res = f16vec2(1.5703125hf); } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void acos_004aff() { - f16vec2 res = acos(f16vec2(0.0hf)); + f16vec2 res = f16vec2(1.5703125hf); } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void acos_004aff() { - f16vec2 res = acos(f16vec2(0.0hf)); + f16vec2 res = f16vec2(1.5703125hf); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.msl index 4d9f5a2c58..4f26080b27 100644 --- a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_004aff() { - half2 res = acos(half2(0.0h)); + half2 res = half2(1.5703125h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.spvasm index cbde032bd0..3f2143cd2e 100644 --- a/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/acos/004aff.wgsl.expected.spvasm @@ -8,7 +8,6 @@ OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -37,15 +36,16 @@ %9 = OpTypeFunction %void %half = OpTypeFloat 16 %v2half = OpTypeVector %half 2 - %17 = OpConstantNull %v2half +%half_0x1_92p_0 = OpConstant %half 0x1.92p+0 + %16 = OpConstantComposite %v2half %half_0x1_92p_0 %half_0x1_92p_0 %_ptr_Function_v2half = OpTypePointer Function %v2half + %19 = OpConstantNull %v2half %20 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %acos_004aff = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v2half Function %17 - %13 = OpExtInst %v2half %16 Acos %17 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v2half Function %19 + OpStore %res %16 OpReturn OpFunctionEnd %vertex_main_inner = OpFunction %v4float None %20 diff --git a/test/tint/builtins/gen/literal/acos/069188.wgsl b/test/tint/builtins/gen/literal/acos/069188.wgsl new file mode 100644 index 0000000000..cfb7eb56b6 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/069188.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<3, fa>) -> vec<3, fa> +fn acos_069188() { + var res = acos(vec3(0.87758256189)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_069188(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_069188(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_069188(); +} diff --git a/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6f38850840 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_069188() { + float3 res = (0.5f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_069188(); + 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() { + acos_069188(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_069188(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6f38850840 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_069188() { + float3 res = (0.5f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_069188(); + 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() { + acos_069188(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_069188(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.glsl new file mode 100644 index 0000000000..52b4b92763 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_069188() { + vec3 res = vec3(0.5f); +} + +vec4 vertex_main() { + acos_069188(); + 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 acos_069188() { + vec3 res = vec3(0.5f); +} + +void fragment_main() { + acos_069188(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_069188() { + vec3 res = vec3(0.5f); +} + +void compute_main() { + acos_069188(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.msl new file mode 100644 index 0000000000..89c18559c6 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_069188() { + float3 res = float3(0.5f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_069188(); + 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() { + acos_069188(); + return; +} + +kernel void compute_main() { + acos_069188(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.spvasm new file mode 100644 index 0000000000..276705b520 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.spvasm @@ -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 %acos_069188 "acos_069188" + 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_0_5 = OpConstant %float 0.5 + %15 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_069188 = 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 %acos_069188 + 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 %acos_069188 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_069188 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.wgsl new file mode 100644 index 0000000000..bc2d242690 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/069188.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acos_069188() { + var res = acos(vec3(0.87758256188999995)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_069188(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_069188(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_069188(); +} diff --git a/test/tint/builtins/gen/literal/acos/15d35b.wgsl b/test/tint/builtins/gen/literal/acos/15d35b.wgsl new file mode 100644 index 0000000000..11d754dca1 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/15d35b.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<2, fa>) -> vec<2, fa> +fn acos_15d35b() { + var res = acos(vec2(0.87758256189)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_15d35b(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_15d35b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_15d35b(); +} diff --git a/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..520cea39e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_15d35b() { + float2 res = (0.5f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_15d35b(); + 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() { + acos_15d35b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_15d35b(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..520cea39e4 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_15d35b() { + float2 res = (0.5f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_15d35b(); + 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() { + acos_15d35b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_15d35b(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.glsl new file mode 100644 index 0000000000..62efb04f87 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_15d35b() { + vec2 res = vec2(0.5f); +} + +vec4 vertex_main() { + acos_15d35b(); + 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 acos_15d35b() { + vec2 res = vec2(0.5f); +} + +void fragment_main() { + acos_15d35b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_15d35b() { + vec2 res = vec2(0.5f); +} + +void compute_main() { + acos_15d35b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.msl new file mode 100644 index 0000000000..7d0f60fc42 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_15d35b() { + float2 res = float2(0.5f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_15d35b(); + 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() { + acos_15d35b(); + return; +} + +kernel void compute_main() { + acos_15d35b(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7cb11097c --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.spvasm @@ -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 %acos_15d35b "acos_15d35b" + 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_0_5 = OpConstant %float 0.5 + %15 = OpConstantComposite %v2float %float_0_5 %float_0_5 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_15d35b = 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 %acos_15d35b + 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 %acos_15d35b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_15d35b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.wgsl new file mode 100644 index 0000000000..6c0f2e7f01 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/15d35b.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acos_15d35b() { + var res = acos(vec2(0.87758256188999995)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_15d35b(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_15d35b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_15d35b(); +} diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.dxc.hlsl index 886ea9556e..5e05dc01b3 100644 --- a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_203628() { - vector res = acos((float16_t(0.0h)).xxxx); + vector res = (float16_t(1.5703125h)).xxxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.glsl index 0dbc198f0f..d46fc9bdc3 100644 --- a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void acos_203628() { - f16vec4 res = acos(f16vec4(0.0hf)); + f16vec4 res = f16vec4(1.5703125hf); } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void acos_203628() { - f16vec4 res = acos(f16vec4(0.0hf)); + f16vec4 res = f16vec4(1.5703125hf); } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void acos_203628() { - f16vec4 res = acos(f16vec4(0.0hf)); + f16vec4 res = f16vec4(1.5703125hf); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.msl index 4aeebba90f..b8aaeab349 100644 --- a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_203628() { - half4 res = acos(half4(0.0h)); + half4 res = half4(1.5703125h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.spvasm index 7807c72d21..396ce5a263 100644 --- a/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/acos/203628.wgsl.expected.spvasm @@ -8,7 +8,6 @@ OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -37,15 +36,16 @@ %9 = OpTypeFunction %void %half = OpTypeFloat 16 %v4half = OpTypeVector %half 4 - %17 = OpConstantNull %v4half +%half_0x1_92p_0 = OpConstant %half 0x1.92p+0 + %16 = OpConstantComposite %v4half %half_0x1_92p_0 %half_0x1_92p_0 %half_0x1_92p_0 %half_0x1_92p_0 %_ptr_Function_v4half = OpTypePointer Function %v4half + %19 = OpConstantNull %v4half %20 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %acos_203628 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v4half Function %17 - %13 = OpExtInst %v4half %16 Acos %17 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v4half Function %19 + OpStore %res %16 OpReturn OpFunctionEnd %vertex_main_inner = OpFunction %v4float None %20 diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.dxc.hlsl index 87a3b3ab7f..15b68db506 100644 --- a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_303e3d() { - float16_t res = acos(float16_t(0.0h)); + float16_t res = float16_t(1.5703125h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.glsl index 757f182315..0ff085628d 100644 --- a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void acos_303e3d() { - float16_t res = acos(0.0hf); + float16_t res = 1.5703125hf; } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void acos_303e3d() { - float16_t res = acos(0.0hf); + float16_t res = 1.5703125hf; } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void acos_303e3d() { - float16_t res = acos(0.0hf); + float16_t res = 1.5703125hf; } void compute_main() { diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.msl index 913e3fdaec..d605822853 100644 --- a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_303e3d() { - half res = acos(0.0h); + half res = 1.5703125h; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.spvasm index 9df9a98206..15253c43cc 100644 --- a/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/acos/303e3d.wgsl.expected.spvasm @@ -1,14 +1,13 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 33 +; Bound: 32 ; Schema: 0 OpCapability Shader OpCapability Float16 OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %15 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -36,36 +35,36 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %half = OpTypeFloat 16 - %16 = OpConstantNull %half +%half_0x1_92p_0 = OpConstant %half 0x1.92p+0 %_ptr_Function_half = OpTypePointer Function %half - %19 = OpTypeFunction %v4float + %17 = OpConstantNull %half + %18 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %acos_303e3d = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_half Function %16 - %13 = OpExtInst %half %15 Acos %16 - OpStore %res %13 + %res = OpVariable %_ptr_Function_half Function %17 + OpStore %res %half_0x1_92p_0 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %acos_303e3d +%vertex_main_inner = OpFunction %v4float None %18 + %20 = OpLabel + %21 = OpFunctionCall %void %acos_303e3d OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 + %23 = OpLabel + %24 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %24 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %acos_303e3d + %27 = OpLabel + %28 = OpFunctionCall %void %acos_303e3d OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %acos_303e3d + %30 = OpLabel + %31 = OpFunctionCall %void %acos_303e3d OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl b/test/tint/builtins/gen/literal/acos/489247.wgsl index cc3e74b998..90a3c51289 100644 --- a/test/tint/builtins/gen/literal/acos/489247.wgsl +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl @@ -23,7 +23,7 @@ // fn acos(f32) -> f32 fn acos_489247() { - var res: f32 = acos(1.f); + var res: f32 = acos(0.87758256189f); } @vertex diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.dxc.hlsl index d370fc469a..7106272940 100644 --- a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_489247() { - float res = acos(1.0f); + float res = 0.5f; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.fxc.hlsl index d370fc469a..7106272940 100644 --- a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void acos_489247() { - float res = acos(1.0f); + float res = 0.5f; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.glsl index 92c7481dda..620369c9fe 100644 --- a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void acos_489247() { - float res = acos(1.0f); + float res = 0.5f; } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void acos_489247() { - float res = acos(1.0f); + float res = 0.5f; } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void acos_489247() { - float res = acos(1.0f); + float res = 0.5f; } void compute_main() { diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.msl index a7bb168303..4e862ab7d7 100644 --- a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_489247() { - float res = acos(1.0f); + float res = 0.5f; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.spvasm index 5a49920646..979b1a2a3a 100644 --- a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 31 +; Bound: 30 ; Schema: 0 OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -31,35 +30,35 @@ %vertex_point_size = OpVariable %_ptr_Output_float Output %8 %void = OpTypeVoid %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 + %float_0_5 = OpConstant %float 0.5 %_ptr_Function_float = OpTypePointer Function %float - %18 = OpTypeFunction %v4float + %16 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %acos_489247 = OpFunction %void None %9 %12 = OpLabel %res = OpVariable %_ptr_Function_float Function %8 - %13 = OpExtInst %float %14 Acos %float_1 - OpStore %res %13 + OpStore %res %float_0_5 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %18 - %20 = OpLabel - %21 = OpFunctionCall %void %acos_489247 +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %acos_489247 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %23 = OpLabel - %24 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %24 + %21 = OpLabel + %22 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %22 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %void %acos_489247 + %25 = OpLabel + %26 = OpFunctionCall %void %acos_489247 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %acos_489247 + %28 = OpLabel + %29 = OpFunctionCall %void %acos_489247 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.wgsl index 3a8d40042f..824739cf3a 100644 --- a/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/acos/489247.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn acos_489247() { - var res : f32 = acos(1.0f); + var res : f32 = acos(0.87758255f); } @vertex diff --git a/test/tint/builtins/gen/literal/acos/4dac75.wgsl b/test/tint/builtins/gen/literal/acos/4dac75.wgsl new file mode 100644 index 0000000000..ead2d67361 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/4dac75.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<4, fa>) -> vec<4, fa> +fn acos_4dac75() { + var res = acos(vec4(0.87758256189)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_4dac75(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_4dac75(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_4dac75(); +} diff --git a/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a5795677a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_4dac75() { + float4 res = (0.5f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_4dac75(); + 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() { + acos_4dac75(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_4dac75(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a5795677a1 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_4dac75() { + float4 res = (0.5f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_4dac75(); + 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() { + acos_4dac75(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_4dac75(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.glsl new file mode 100644 index 0000000000..e9cbbf768a --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_4dac75() { + vec4 res = vec4(0.5f); +} + +vec4 vertex_main() { + acos_4dac75(); + 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 acos_4dac75() { + vec4 res = vec4(0.5f); +} + +void fragment_main() { + acos_4dac75(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_4dac75() { + vec4 res = vec4(0.5f); +} + +void compute_main() { + acos_4dac75(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.msl new file mode 100644 index 0000000000..0047a7a06f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_4dac75() { + float4 res = float4(0.5f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_4dac75(); + 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() { + acos_4dac75(); + return; +} + +kernel void compute_main() { + acos_4dac75(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.spvasm new file mode 100644 index 0000000000..c7c08cb92b --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.spvasm @@ -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 %acos_4dac75 "acos_4dac75" + 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_0_5 = OpConstant %float 0.5 + %14 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_4dac75 = 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 %acos_4dac75 + 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 %acos_4dac75 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_4dac75 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.wgsl new file mode 100644 index 0000000000..60ecbc169f --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/4dac75.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acos_4dac75() { + var res = acos(vec4(0.87758256188999995)); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_4dac75(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_4dac75(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_4dac75(); +} diff --git a/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl new file mode 100644 index 0000000000..9a823685e1 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl @@ -0,0 +1,43 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(fa) -> fa +fn acos_5e9ad2() { + var res = acos(0.87758256189); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_5e9ad2(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_5e9ad2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_5e9ad2(); +} diff --git a/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a3b97e5a65 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_5e9ad2() { + float res = 0.5f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_5e9ad2(); + 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() { + acos_5e9ad2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_5e9ad2(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a3b97e5a65 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_5e9ad2() { + float res = 0.5f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_5e9ad2(); + 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() { + acos_5e9ad2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_5e9ad2(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.glsl new file mode 100644 index 0000000000..38a798544b --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_5e9ad2() { + float res = 0.5f; +} + +vec4 vertex_main() { + acos_5e9ad2(); + 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 acos_5e9ad2() { + float res = 0.5f; +} + +void fragment_main() { + acos_5e9ad2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_5e9ad2() { + float res = 0.5f; +} + +void compute_main() { + acos_5e9ad2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.msl new file mode 100644 index 0000000000..4200020e24 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_5e9ad2() { + float res = 0.5f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_5e9ad2(); + 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() { + acos_5e9ad2(); + return; +} + +kernel void compute_main() { + acos_5e9ad2(); + return; +} + diff --git a/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.spvasm new file mode 100644 index 0000000000..18d5166fd6 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_5e9ad2 "acos_5e9ad2" + 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_0_5 = OpConstant %float 0.5 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_5e9ad2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_0_5 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %acos_5e9ad2 + 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 %acos_5e9ad2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %acos_5e9ad2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.wgsl new file mode 100644 index 0000000000..352caf2057 --- /dev/null +++ b/test/tint/builtins/gen/literal/acos/5e9ad2.wgsl.expected.wgsl @@ -0,0 +1,19 @@ +fn acos_5e9ad2() { + var res = acos(0.87758256188999995); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_5e9ad2(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_5e9ad2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_5e9ad2(); +} diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl index b820523df8..2f33780dd0 100644 --- a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl @@ -23,7 +23,7 @@ // fn acos(vec<4, f32>) -> vec<4, f32> fn acos_8e2acf() { - var res: vec4 = acos(vec4(1.f)); + var res: vec4 = acos(vec4(0.87758256189f)); } @vertex diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.dxc.hlsl index 7877019c8c..0bbec64921 100644 --- a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_8e2acf() { - float4 res = acos((1.0f).xxxx); + float4 res = (0.5f).xxxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.fxc.hlsl index 7877019c8c..0bbec64921 100644 --- a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void acos_8e2acf() { - float4 res = acos((1.0f).xxxx); + float4 res = (0.5f).xxxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.glsl index d411a319c0..6ea6e20ac2 100644 --- a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void acos_8e2acf() { - vec4 res = acos(vec4(1.0f)); + vec4 res = vec4(0.5f); } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void acos_8e2acf() { - vec4 res = acos(vec4(1.0f)); + vec4 res = vec4(0.5f); } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void acos_8e2acf() { - vec4 res = acos(vec4(1.0f)); + vec4 res = vec4(0.5f); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.msl index 4dfc1a7b36..2f43d40601 100644 --- a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_8e2acf() { - float4 res = acos(float4(1.0f)); + float4 res = float4(0.5f); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.spvasm index d0c94e013d..7932b7a23a 100644 --- a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 32 +; Bound: 31 ; Schema: 0 OpCapability Shader - %14 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -31,36 +30,36 @@ %vertex_point_size = OpVariable %_ptr_Output_float Output %8 %void = OpTypeVoid %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 - %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 + %float_0_5 = OpConstant %float 0.5 + %14 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 %_ptr_Function_v4float = OpTypePointer Function %v4float - %19 = OpTypeFunction %v4float + %17 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %acos_8e2acf = OpFunction %void None %9 %12 = OpLabel %res = OpVariable %_ptr_Function_v4float Function %5 - %13 = OpExtInst %v4float %14 Acos %16 - OpStore %res %13 + OpStore %res %14 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %19 - %21 = OpLabel - %22 = OpFunctionCall %void %acos_8e2acf +%vertex_main_inner = OpFunction %v4float None %17 + %19 = OpLabel + %20 = OpFunctionCall %void %acos_8e2acf OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %24 = OpLabel - %25 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %25 + %22 = OpLabel + %23 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %23 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %27 = OpLabel - %28 = OpFunctionCall %void %acos_8e2acf + %26 = OpLabel + %27 = OpFunctionCall %void %acos_8e2acf OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %30 = OpLabel - %31 = OpFunctionCall %void %acos_8e2acf + %29 = OpLabel + %30 = OpFunctionCall %void %acos_8e2acf OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.wgsl index 8f38b086d8..ec5ec4f464 100644 --- a/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/acos/8e2acf.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn acos_8e2acf() { - var res : vec4 = acos(vec4(1.0f)); + var res : vec4 = acos(vec4(0.87758255f)); } @vertex diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl index 2d80fb3f0c..ffdc0d5e9e 100644 --- a/test/tint/builtins/gen/literal/acos/a610c4.wgsl +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl @@ -23,7 +23,7 @@ // fn acos(vec<3, f32>) -> vec<3, f32> fn acos_a610c4() { - var res: vec3 = acos(vec3(1.f)); + var res: vec3 = acos(vec3(0.87758256189f)); } @vertex diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.dxc.hlsl index ff28d8324f..839749475a 100644 --- a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_a610c4() { - float3 res = acos((1.0f).xxx); + float3 res = (0.5f).xxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.fxc.hlsl index ff28d8324f..839749475a 100644 --- a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void acos_a610c4() { - float3 res = acos((1.0f).xxx); + float3 res = (0.5f).xxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.glsl index 4b34d3826b..72df7adeae 100644 --- a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void acos_a610c4() { - vec3 res = acos(vec3(1.0f)); + vec3 res = vec3(0.5f); } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void acos_a610c4() { - vec3 res = acos(vec3(1.0f)); + vec3 res = vec3(0.5f); } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void acos_a610c4() { - vec3 res = acos(vec3(1.0f)); + vec3 res = vec3(0.5f); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.msl index 4af410f6ef..01c9eb3e55 100644 --- a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_a610c4() { - float3 res = acos(float3(1.0f)); + float3 res = float3(0.5f); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.spvasm index 6ddef0d0c5..5e8e49c8c9 100644 --- a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 33 ; Schema: 0 OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -32,37 +31,37 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %v3float = OpTypeVector %float 3 - %float_1 = OpConstant %float 1 - %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1 + %float_0_5 = OpConstant %float 0.5 + %15 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 %_ptr_Function_v3float = OpTypePointer Function %v3float - %20 = OpConstantNull %v3float - %21 = OpTypeFunction %v4float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %acos_a610c4 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v3float Function %20 - %13 = OpExtInst %v3float %15 Acos %17 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v3float Function %18 + OpStore %res %15 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %acos_a610c4 +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %acos_a610c4 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %acos_a610c4 + %28 = OpLabel + %29 = OpFunctionCall %void %acos_a610c4 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %acos_a610c4 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_a610c4 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.wgsl index 14105fe989..5a0efefd39 100644 --- a/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/acos/a610c4.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn acos_a610c4() { - var res : vec3 = acos(vec3(1.0f)); + var res : vec3 = acos(vec3(0.87758255f)); } @vertex diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl index 929653a92c..476ee1fd69 100644 --- a/test/tint/builtins/gen/literal/acos/dfc915.wgsl +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl @@ -23,7 +23,7 @@ // fn acos(vec<2, f32>) -> vec<2, f32> fn acos_dfc915() { - var res: vec2 = acos(vec2(1.f)); + var res: vec2 = acos(vec2(0.87758256189f)); } @vertex diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.dxc.hlsl index fe14cb41d9..df45b98b74 100644 --- a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_dfc915() { - float2 res = acos((1.0f).xx); + float2 res = (0.5f).xx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.fxc.hlsl index fe14cb41d9..df45b98b74 100644 --- a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void acos_dfc915() { - float2 res = acos((1.0f).xx); + float2 res = (0.5f).xx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.glsl index a2119fcca3..b90381109e 100644 --- a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void acos_dfc915() { - vec2 res = acos(vec2(1.0f)); + vec2 res = vec2(0.5f); } vec4 vertex_main() { @@ -21,7 +21,7 @@ void main() { precision mediump float; void acos_dfc915() { - vec2 res = acos(vec2(1.0f)); + vec2 res = vec2(0.5f); } void fragment_main() { @@ -35,7 +35,7 @@ void main() { #version 310 es void acos_dfc915() { - vec2 res = acos(vec2(1.0f)); + vec2 res = vec2(0.5f); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.msl index 7673132bc5..39e0c61c5d 100644 --- a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_dfc915() { - float2 res = acos(float2(1.0f)); + float2 res = float2(0.5f); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.spvasm index 983a055d50..cbdba38690 100644 --- a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.spvasm @@ -1,10 +1,9 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 33 ; Schema: 0 OpCapability Shader - %15 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -32,37 +31,37 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %v2float = OpTypeVector %float 2 - %float_1 = OpConstant %float 1 - %17 = OpConstantComposite %v2float %float_1 %float_1 + %float_0_5 = OpConstant %float 0.5 + %15 = OpConstantComposite %v2float %float_0_5 %float_0_5 %_ptr_Function_v2float = OpTypePointer Function %v2float - %20 = OpConstantNull %v2float - %21 = OpTypeFunction %v4float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %acos_dfc915 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v2float Function %20 - %13 = OpExtInst %v2float %15 Acos %17 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v2float Function %18 + OpStore %res %15 OpReturn OpFunctionEnd -%vertex_main_inner = OpFunction %v4float None %21 - %23 = OpLabel - %24 = OpFunctionCall %void %acos_dfc915 +%vertex_main_inner = OpFunction %v4float None %19 + %21 = OpLabel + %22 = OpFunctionCall %void %acos_dfc915 OpReturnValue %5 OpFunctionEnd %vertex_main = OpFunction %void None %9 - %26 = OpLabel - %27 = OpFunctionCall %v4float %vertex_main_inner - OpStore %value %27 + %24 = OpLabel + %25 = OpFunctionCall %v4float %vertex_main_inner + OpStore %value %25 OpStore %vertex_point_size %float_1 OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %acos_dfc915 + %28 = OpLabel + %29 = OpFunctionCall %void %acos_dfc915 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %acos_dfc915 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_dfc915 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.wgsl index fcc29cfcf9..d49c05b683 100644 --- a/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/literal/acos/dfc915.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn acos_dfc915() { - var res : vec2 = acos(vec2(1.0f)); + var res : vec2 = acos(vec2(0.87758255f)); } @vertex diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.dxc.hlsl index 7cf8ba2158..87a5f7d3bc 100644 --- a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_f47057() { - vector res = acos((float16_t(0.0h)).xxx); + vector res = (float16_t(1.5703125h)).xxx; } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.glsl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.glsl index 4e2cbd06e1..60d4629919 100644 --- a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.glsl +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.glsl @@ -2,7 +2,7 @@ #extension GL_AMD_gpu_shader_half_float : require void acos_f47057() { - f16vec3 res = acos(f16vec3(0.0hf)); + f16vec3 res = f16vec3(1.5703125hf); } vec4 vertex_main() { @@ -23,7 +23,7 @@ void main() { precision mediump float; void acos_f47057() { - f16vec3 res = acos(f16vec3(0.0hf)); + f16vec3 res = f16vec3(1.5703125hf); } void fragment_main() { @@ -38,7 +38,7 @@ void main() { #extension GL_AMD_gpu_shader_half_float : require void acos_f47057() { - f16vec3 res = acos(f16vec3(0.0hf)); + f16vec3 res = f16vec3(1.5703125hf); } void compute_main() { diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.msl b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.msl index e74d29b2cb..568f757ba8 100644 --- a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.msl +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_f47057() { - half3 res = acos(half3(0.0h)); + half3 res = half3(1.5703125h); } struct tint_symbol { diff --git a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.spvasm index 00895bf2d3..3d7723bdfc 100644 --- a/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/literal/acos/f47057.wgsl.expected.spvasm @@ -8,7 +8,6 @@ OpCapability UniformAndStorageBuffer16BitAccess OpCapability StorageBuffer16BitAccess OpCapability StorageInputOutput16 - %16 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size OpEntryPoint Fragment %fragment_main "fragment_main" @@ -37,15 +36,16 @@ %9 = OpTypeFunction %void %half = OpTypeFloat 16 %v3half = OpTypeVector %half 3 - %17 = OpConstantNull %v3half +%half_0x1_92p_0 = OpConstant %half 0x1.92p+0 + %16 = OpConstantComposite %v3half %half_0x1_92p_0 %half_0x1_92p_0 %half_0x1_92p_0 %_ptr_Function_v3half = OpTypePointer Function %v3half + %19 = OpConstantNull %v3half %20 = OpTypeFunction %v4float %float_1 = OpConstant %float 1 %acos_f47057 = OpFunction %void None %9 %12 = OpLabel - %res = OpVariable %_ptr_Function_v3half Function %17 - %13 = OpExtInst %v3half %16 Acos %17 - OpStore %res %13 + %res = OpVariable %_ptr_Function_v3half Function %19 + OpStore %res %16 OpReturn OpFunctionEnd %vertex_main_inner = OpFunction %v4float None %20 diff --git a/test/tint/builtins/gen/var/acos/069188.wgsl b/test/tint/builtins/gen/var/acos/069188.wgsl new file mode 100644 index 0000000000..9aeaa3ca7e --- /dev/null +++ b/test/tint/builtins/gen/var/acos/069188.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<3, fa>) -> vec<3, fa> +fn acos_069188() { + const arg_0 = vec3(0.87758256189); + var res = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_069188(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_069188(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_069188(); +} diff --git a/test/tint/builtins/gen/var/acos/069188.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..6f38850840 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_069188() { + float3 res = (0.5f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_069188(); + 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() { + acos_069188(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_069188(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/069188.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..6f38850840 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_069188() { + float3 res = (0.5f).xxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_069188(); + 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() { + acos_069188(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_069188(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/069188.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.glsl new file mode 100644 index 0000000000..52b4b92763 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_069188() { + vec3 res = vec3(0.5f); +} + +vec4 vertex_main() { + acos_069188(); + 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 acos_069188() { + vec3 res = vec3(0.5f); +} + +void fragment_main() { + acos_069188(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_069188() { + vec3 res = vec3(0.5f); +} + +void compute_main() { + acos_069188(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/069188.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.msl new file mode 100644 index 0000000000..89c18559c6 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_069188() { + float3 res = float3(0.5f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_069188(); + 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() { + acos_069188(); + return; +} + +kernel void compute_main() { + acos_069188(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/069188.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.spvasm new file mode 100644 index 0000000000..276705b520 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.spvasm @@ -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 %acos_069188 "acos_069188" + 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_0_5 = OpConstant %float 0.5 + %15 = OpConstantComposite %v3float %float_0_5 %float_0_5 %float_0_5 +%_ptr_Function_v3float = OpTypePointer Function %v3float + %18 = OpConstantNull %v3float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_069188 = 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 %acos_069188 + 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 %acos_069188 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_069188 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/069188.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.wgsl new file mode 100644 index 0000000000..d9a2628fd0 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/069188.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_069188() { + const arg_0 = vec3(0.87758256188999995); + var res = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_069188(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_069188(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_069188(); +} diff --git a/test/tint/builtins/gen/var/acos/15d35b.wgsl b/test/tint/builtins/gen/var/acos/15d35b.wgsl new file mode 100644 index 0000000000..eba7fb2ef1 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/15d35b.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<2, fa>) -> vec<2, fa> +fn acos_15d35b() { + const arg_0 = vec2(0.87758256189); + var res = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_15d35b(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_15d35b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_15d35b(); +} diff --git a/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..520cea39e4 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_15d35b() { + float2 res = (0.5f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_15d35b(); + 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() { + acos_15d35b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_15d35b(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..520cea39e4 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_15d35b() { + float2 res = (0.5f).xx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_15d35b(); + 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() { + acos_15d35b(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_15d35b(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.glsl new file mode 100644 index 0000000000..62efb04f87 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_15d35b() { + vec2 res = vec2(0.5f); +} + +vec4 vertex_main() { + acos_15d35b(); + 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 acos_15d35b() { + vec2 res = vec2(0.5f); +} + +void fragment_main() { + acos_15d35b(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_15d35b() { + vec2 res = vec2(0.5f); +} + +void compute_main() { + acos_15d35b(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.msl new file mode 100644 index 0000000000..7d0f60fc42 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_15d35b() { + float2 res = float2(0.5f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_15d35b(); + 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() { + acos_15d35b(); + return; +} + +kernel void compute_main() { + acos_15d35b(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.spvasm new file mode 100644 index 0000000000..f7cb11097c --- /dev/null +++ b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.spvasm @@ -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 %acos_15d35b "acos_15d35b" + 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_0_5 = OpConstant %float 0.5 + %15 = OpConstantComposite %v2float %float_0_5 %float_0_5 +%_ptr_Function_v2float = OpTypePointer Function %v2float + %18 = OpConstantNull %v2float + %19 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_15d35b = 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 %acos_15d35b + 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 %acos_15d35b + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %31 = OpLabel + %32 = OpFunctionCall %void %acos_15d35b + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.wgsl new file mode 100644 index 0000000000..0f0ef02b45 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/15d35b.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_15d35b() { + const arg_0 = vec2(0.87758256188999995); + var res = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_15d35b(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_15d35b(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_15d35b(); +} diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl b/test/tint/builtins/gen/var/acos/489247.wgsl index 5cfbdc1299..9135e803f6 100644 --- a/test/tint/builtins/gen/var/acos/489247.wgsl +++ b/test/tint/builtins/gen/var/acos/489247.wgsl @@ -23,7 +23,7 @@ // fn acos(f32) -> f32 fn acos_489247() { - var arg_0 = 1.f; + var arg_0 = 0.87758256189f; var res: f32 = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.dxc.hlsl index 9f53955922..ee0727e826 100644 --- a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_489247() { - float arg_0 = 1.0f; + float arg_0 = 0.87758255f; float res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.fxc.hlsl index 9f53955922..ee0727e826 100644 --- a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void acos_489247() { - float arg_0 = 1.0f; + float arg_0 = 0.87758255f; float res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl index bd507c702e..c531807b10 100644 --- a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void acos_489247() { - float arg_0 = 1.0f; + float arg_0 = 0.87758255f; float res = acos(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void acos_489247() { - float arg_0 = 1.0f; + float arg_0 = 0.87758255f; float res = acos(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void acos_489247() { - float arg_0 = 1.0f; + float arg_0 = 0.87758255f; float res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl index 273a93f6b8..6b0025a0e4 100644 --- a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_489247() { - float arg_0 = 1.0f; + float arg_0 = 0.87758255f; float res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm index 854923b83c..24db5a40c0 100644 --- a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 33 +; Bound: 34 ; Schema: 0 OpCapability Shader %17 = OpExtInstImport "GLSL.std.450" @@ -32,14 +32,15 @@ %vertex_point_size = OpVariable %_ptr_Output_float Output %8 %void = OpTypeVoid %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 +%float_0_87758255 = OpConstant %float 0.87758255 %_ptr_Function_float = OpTypePointer Function %float %20 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %acos_489247 = OpFunction %void None %9 %12 = OpLabel %arg_0 = OpVariable %_ptr_Function_float Function %8 %res = OpVariable %_ptr_Function_float Function %8 - OpStore %arg_0 %float_1 + OpStore %arg_0 %float_0_87758255 %18 = OpLoad %float %arg_0 %16 = OpExtInst %float %17 Acos %18 OpStore %res %16 @@ -58,12 +59,12 @@ OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %28 = OpLabel - %29 = OpFunctionCall %void %acos_489247 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_489247 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %acos_489247 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_489247 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl index 9ec8e7a4dd..aecbafad4c 100644 --- a/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/acos/489247.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn acos_489247() { - var arg_0 = 1.0f; + var arg_0 = 0.87758255f; var res : f32 = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/4dac75.wgsl b/test/tint/builtins/gen/var/acos/4dac75.wgsl new file mode 100644 index 0000000000..fd5d68929d --- /dev/null +++ b/test/tint/builtins/gen/var/acos/4dac75.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(vec<4, fa>) -> vec<4, fa> +fn acos_4dac75() { + const arg_0 = vec4(0.87758256189); + var res = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_4dac75(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_4dac75(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_4dac75(); +} diff --git a/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a5795677a1 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_4dac75() { + float4 res = (0.5f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_4dac75(); + 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() { + acos_4dac75(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_4dac75(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a5795677a1 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_4dac75() { + float4 res = (0.5f).xxxx; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_4dac75(); + 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() { + acos_4dac75(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_4dac75(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.glsl new file mode 100644 index 0000000000..e9cbbf768a --- /dev/null +++ b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_4dac75() { + vec4 res = vec4(0.5f); +} + +vec4 vertex_main() { + acos_4dac75(); + 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 acos_4dac75() { + vec4 res = vec4(0.5f); +} + +void fragment_main() { + acos_4dac75(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_4dac75() { + vec4 res = vec4(0.5f); +} + +void compute_main() { + acos_4dac75(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.msl new file mode 100644 index 0000000000..0047a7a06f --- /dev/null +++ b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_4dac75() { + float4 res = float4(0.5f); +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_4dac75(); + 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() { + acos_4dac75(); + return; +} + +kernel void compute_main() { + acos_4dac75(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.spvasm new file mode 100644 index 0000000000..c7c08cb92b --- /dev/null +++ b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.spvasm @@ -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 %acos_4dac75 "acos_4dac75" + 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_0_5 = OpConstant %float 0.5 + %14 = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0_5 %float_0_5 +%_ptr_Function_v4float = OpTypePointer Function %v4float + %17 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_4dac75 = 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 %acos_4dac75 + 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 %acos_4dac75 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %29 = OpLabel + %30 = OpFunctionCall %void %acos_4dac75 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.wgsl new file mode 100644 index 0000000000..2609097070 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/4dac75.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_4dac75() { + const arg_0 = vec4(0.87758256188999995); + var res = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_4dac75(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_4dac75(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_4dac75(); +} diff --git a/test/tint/builtins/gen/var/acos/5e9ad2.wgsl b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl new file mode 100644 index 0000000000..1d6a853cd1 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl @@ -0,0 +1,44 @@ +// Copyright 2022 The Tint Authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//////////////////////////////////////////////////////////////////////////////// +// File generated by tools/src/cmd/gen +// using the template: +// test/tint/builtins/gen/gen.wgsl.tmpl +// +// Do not modify this file directly +//////////////////////////////////////////////////////////////////////////////// + + +// fn acos(fa) -> fa +fn acos_5e9ad2() { + const arg_0 = 0.87758256189; + var res = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_5e9ad2(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_5e9ad2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_5e9ad2(); +} diff --git a/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..a3b97e5a65 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.dxc.hlsl @@ -0,0 +1,30 @@ +void acos_5e9ad2() { + float res = 0.5f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_5e9ad2(); + 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() { + acos_5e9ad2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_5e9ad2(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..a3b97e5a65 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.fxc.hlsl @@ -0,0 +1,30 @@ +void acos_5e9ad2() { + float res = 0.5f; +} + +struct tint_symbol { + float4 value : SV_Position; +}; + +float4 vertex_main_inner() { + acos_5e9ad2(); + 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() { + acos_5e9ad2(); + return; +} + +[numthreads(1, 1, 1)] +void compute_main() { + acos_5e9ad2(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.glsl new file mode 100644 index 0000000000..38a798544b --- /dev/null +++ b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.glsl @@ -0,0 +1,49 @@ +#version 310 es + +void acos_5e9ad2() { + float res = 0.5f; +} + +vec4 vertex_main() { + acos_5e9ad2(); + 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 acos_5e9ad2() { + float res = 0.5f; +} + +void fragment_main() { + acos_5e9ad2(); +} + +void main() { + fragment_main(); + return; +} +#version 310 es + +void acos_5e9ad2() { + float res = 0.5f; +} + +void compute_main() { + acos_5e9ad2(); +} + +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; +void main() { + compute_main(); + return; +} diff --git a/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.msl new file mode 100644 index 0000000000..4200020e24 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.msl @@ -0,0 +1,33 @@ +#include + +using namespace metal; +void acos_5e9ad2() { + float res = 0.5f; +} + +struct tint_symbol { + float4 value [[position]]; +}; + +float4 vertex_main_inner() { + acos_5e9ad2(); + 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() { + acos_5e9ad2(); + return; +} + +kernel void compute_main() { + acos_5e9ad2(); + return; +} + diff --git a/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.spvasm new file mode 100644 index 0000000000..18d5166fd6 --- /dev/null +++ b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.spvasm @@ -0,0 +1,64 @@ +; SPIR-V +; Version: 1.3 +; Generator: Google Tint Compiler; 0 +; Bound: 30 +; Schema: 0 + OpCapability Shader + OpMemoryModel Logical GLSL450 + OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size + OpEntryPoint Fragment %fragment_main "fragment_main" + OpEntryPoint GLCompute %compute_main "compute_main" + OpExecutionMode %fragment_main OriginUpperLeft + OpExecutionMode %compute_main LocalSize 1 1 1 + OpName %value "value" + OpName %vertex_point_size "vertex_point_size" + OpName %acos_5e9ad2 "acos_5e9ad2" + 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_0_5 = OpConstant %float 0.5 +%_ptr_Function_float = OpTypePointer Function %float + %16 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 +%acos_5e9ad2 = OpFunction %void None %9 + %12 = OpLabel + %res = OpVariable %_ptr_Function_float Function %8 + OpStore %res %float_0_5 + OpReturn + OpFunctionEnd +%vertex_main_inner = OpFunction %v4float None %16 + %18 = OpLabel + %19 = OpFunctionCall %void %acos_5e9ad2 + 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 %acos_5e9ad2 + OpReturn + OpFunctionEnd +%compute_main = OpFunction %void None %9 + %28 = OpLabel + %29 = OpFunctionCall %void %acos_5e9ad2 + OpReturn + OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.wgsl new file mode 100644 index 0000000000..1999db3b3b --- /dev/null +++ b/test/tint/builtins/gen/var/acos/5e9ad2.wgsl.expected.wgsl @@ -0,0 +1,20 @@ +fn acos_5e9ad2() { + const arg_0 = 0.87758256188999995; + var res = acos(arg_0); +} + +@vertex +fn vertex_main() -> @builtin(position) vec4 { + acos_5e9ad2(); + return vec4(); +} + +@fragment +fn fragment_main() { + acos_5e9ad2(); +} + +@compute @workgroup_size(1) +fn compute_main() { + acos_5e9ad2(); +} diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl index d5b67ce903..2d351e5273 100644 --- a/test/tint/builtins/gen/var/acos/8e2acf.wgsl +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl @@ -23,7 +23,7 @@ // fn acos(vec<4, f32>) -> vec<4, f32> fn acos_8e2acf() { - var arg_0 = vec4(1.f); + var arg_0 = vec4(0.87758256189f); var res: vec4 = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.dxc.hlsl index 390e655269..faad89b18f 100644 --- a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_8e2acf() { - float4 arg_0 = (1.0f).xxxx; + float4 arg_0 = (0.87758255f).xxxx; float4 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.fxc.hlsl index 390e655269..faad89b18f 100644 --- a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void acos_8e2acf() { - float4 arg_0 = (1.0f).xxxx; + float4 arg_0 = (0.87758255f).xxxx; float4 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl index b8d3472288..8356e90150 100644 --- a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void acos_8e2acf() { - vec4 arg_0 = vec4(1.0f); + vec4 arg_0 = vec4(0.87758255f); vec4 res = acos(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void acos_8e2acf() { - vec4 arg_0 = vec4(1.0f); + vec4 arg_0 = vec4(0.87758255f); vec4 res = acos(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void acos_8e2acf() { - vec4 arg_0 = vec4(1.0f); + vec4 arg_0 = vec4(0.87758255f); vec4 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl index 4014603e42..c5d2091bf6 100644 --- a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_8e2acf() { - float4 arg_0 = float4(1.0f); + float4 arg_0 = float4(0.87758255f); float4 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm index 3e380b619e..7ce49182dc 100644 --- a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 34 +; Bound: 35 ; Schema: 0 OpCapability Shader %18 = OpExtInstImport "GLSL.std.450" @@ -32,10 +32,11 @@ %vertex_point_size = OpVariable %_ptr_Output_float Output %8 %void = OpTypeVoid %9 = OpTypeFunction %void - %float_1 = OpConstant %float 1 - %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1 +%float_0_87758255 = OpConstant %float 0.87758255 + %14 = OpConstantComposite %v4float %float_0_87758255 %float_0_87758255 %float_0_87758255 %float_0_87758255 %_ptr_Function_v4float = OpTypePointer Function %v4float %21 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %acos_8e2acf = OpFunction %void None %9 %12 = OpLabel %arg_0 = OpVariable %_ptr_Function_v4float Function %5 @@ -59,12 +60,12 @@ OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %29 = OpLabel - %30 = OpFunctionCall %void %acos_8e2acf + %30 = OpLabel + %31 = OpFunctionCall %void %acos_8e2acf OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %32 = OpLabel - %33 = OpFunctionCall %void %acos_8e2acf + %33 = OpLabel + %34 = OpFunctionCall %void %acos_8e2acf OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl index 85e5e1205e..987210960e 100644 --- a/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/acos/8e2acf.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn acos_8e2acf() { - var arg_0 = vec4(1.0f); + var arg_0 = vec4(0.87758255f); var res : vec4 = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl index aa5a3ac7ac..ea73283dbc 100644 --- a/test/tint/builtins/gen/var/acos/a610c4.wgsl +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl @@ -23,7 +23,7 @@ // fn acos(vec<3, f32>) -> vec<3, f32> fn acos_a610c4() { - var arg_0 = vec3(1.f); + var arg_0 = vec3(0.87758256189f); var res: vec3 = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.dxc.hlsl index fb6c37b8f1..be1af97971 100644 --- a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_a610c4() { - float3 arg_0 = (1.0f).xxx; + float3 arg_0 = (0.87758255f).xxx; float3 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.fxc.hlsl index fb6c37b8f1..be1af97971 100644 --- a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void acos_a610c4() { - float3 arg_0 = (1.0f).xxx; + float3 arg_0 = (0.87758255f).xxx; float3 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl index 05d24a3f79..bb9ce66fbc 100644 --- a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void acos_a610c4() { - vec3 arg_0 = vec3(1.0f); + vec3 arg_0 = vec3(0.87758255f); vec3 res = acos(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void acos_a610c4() { - vec3 arg_0 = vec3(1.0f); + vec3 arg_0 = vec3(0.87758255f); vec3 res = acos(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void acos_a610c4() { - vec3 arg_0 = vec3(1.0f); + vec3 arg_0 = vec3(0.87758255f); vec3 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl index 1b5fdf10d1..f4fa62cd5b 100644 --- a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_a610c4() { - float3 arg_0 = float3(1.0f); + float3 arg_0 = float3(0.87758255f); float3 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm index 185c9a438a..016523a27f 100644 --- a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 37 ; Schema: 0 OpCapability Shader %20 = OpExtInstImport "GLSL.std.450" @@ -33,11 +33,12 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %v3float = OpTypeVector %float 3 - %float_1 = OpConstant %float 1 - %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1 +%float_0_87758255 = OpConstant %float 0.87758255 + %15 = OpConstantComposite %v3float %float_0_87758255 %float_0_87758255 %float_0_87758255 %_ptr_Function_v3float = OpTypePointer Function %v3float %18 = OpConstantNull %v3float %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %acos_a610c4 = OpFunction %void None %9 %12 = OpLabel %arg_0 = OpVariable %_ptr_Function_v3float Function %18 @@ -61,12 +62,12 @@ OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %acos_a610c4 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_a610c4 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %acos_a610c4 + %35 = OpLabel + %36 = OpFunctionCall %void %acos_a610c4 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl index 1d5d1f947c..fd615c87bb 100644 --- a/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/acos/a610c4.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn acos_a610c4() { - var arg_0 = vec3(1.0f); + var arg_0 = vec3(0.87758255f); var res : vec3 = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl index ca261a09c4..ff333a1a58 100644 --- a/test/tint/builtins/gen/var/acos/dfc915.wgsl +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl @@ -23,7 +23,7 @@ // fn acos(vec<2, f32>) -> vec<2, f32> fn acos_dfc915() { - var arg_0 = vec2(1.f); + var arg_0 = vec2(0.87758256189f); var res: vec2 = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.dxc.hlsl index 872e9e2228..3a5457495b 100644 --- a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.dxc.hlsl +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.dxc.hlsl @@ -1,5 +1,5 @@ void acos_dfc915() { - float2 arg_0 = (1.0f).xx; + float2 arg_0 = (0.87758255f).xx; float2 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.fxc.hlsl index 872e9e2228..3a5457495b 100644 --- a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.fxc.hlsl +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.fxc.hlsl @@ -1,5 +1,5 @@ void acos_dfc915() { - float2 arg_0 = (1.0f).xx; + float2 arg_0 = (0.87758255f).xx; float2 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl index af4464ed75..f86c6b4b63 100644 --- a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.glsl @@ -1,7 +1,7 @@ #version 310 es void acos_dfc915() { - vec2 arg_0 = vec2(1.0f); + vec2 arg_0 = vec2(0.87758255f); vec2 res = acos(arg_0); } @@ -22,7 +22,7 @@ void main() { precision mediump float; void acos_dfc915() { - vec2 arg_0 = vec2(1.0f); + vec2 arg_0 = vec2(0.87758255f); vec2 res = acos(arg_0); } @@ -37,7 +37,7 @@ void main() { #version 310 es void acos_dfc915() { - vec2 arg_0 = vec2(1.0f); + vec2 arg_0 = vec2(0.87758255f); vec2 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl index ffc436fee1..9eb3e34e28 100644 --- a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.msl @@ -2,7 +2,7 @@ using namespace metal; void acos_dfc915() { - float2 arg_0 = float2(1.0f); + float2 arg_0 = float2(0.87758255f); float2 res = acos(arg_0); } diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm index 2165f6ee90..ce995ace5b 100644 --- a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.3 ; Generator: Google Tint Compiler; 0 -; Bound: 36 +; Bound: 37 ; Schema: 0 OpCapability Shader %20 = OpExtInstImport "GLSL.std.450" @@ -33,11 +33,12 @@ %void = OpTypeVoid %9 = OpTypeFunction %void %v2float = OpTypeVector %float 2 - %float_1 = OpConstant %float 1 - %15 = OpConstantComposite %v2float %float_1 %float_1 +%float_0_87758255 = OpConstant %float 0.87758255 + %15 = OpConstantComposite %v2float %float_0_87758255 %float_0_87758255 %_ptr_Function_v2float = OpTypePointer Function %v2float %18 = OpConstantNull %v2float %23 = OpTypeFunction %v4float + %float_1 = OpConstant %float 1 %acos_dfc915 = OpFunction %void None %9 %12 = OpLabel %arg_0 = OpVariable %_ptr_Function_v2float Function %18 @@ -61,12 +62,12 @@ OpReturn OpFunctionEnd %fragment_main = OpFunction %void None %9 - %31 = OpLabel - %32 = OpFunctionCall %void %acos_dfc915 + %32 = OpLabel + %33 = OpFunctionCall %void %acos_dfc915 OpReturn OpFunctionEnd %compute_main = OpFunction %void None %9 - %34 = OpLabel - %35 = OpFunctionCall %void %acos_dfc915 + %35 = OpLabel + %36 = OpFunctionCall %void %acos_dfc915 OpReturn OpFunctionEnd diff --git a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl index 1d627ff1fb..5c9ac9f176 100644 --- a/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl +++ b/test/tint/builtins/gen/var/acos/dfc915.wgsl.expected.wgsl @@ -1,5 +1,5 @@ fn acos_dfc915() { - var arg_0 = vec2(1.0f); + var arg_0 = vec2(0.87758255f); var res : vec2 = acos(arg_0); }