Add const-eval for `degrees` and `radians`
This CL adds const-eval for `degrees` and `radians`.
Bug: tint:1581
Change-Id: I7f00e2b1e5ab7c8e895680a6b75b9531dac31f5a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110601
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def
index 7d51d76..7a18e17 100644
--- a/src/tint/intrinsics.def
+++ b/src/tint/intrinsics.def
@@ -440,8 +440,8 @@
@const fn countTrailingZeros<T: iu32>(T) -> T
@const fn countTrailingZeros<N: num, T: iu32>(vec<N, T>) -> vec<N, T>
@const fn cross<T: fa_f32_f16>(vec3<T>, vec3<T>) -> vec3<T>
-fn degrees<T: f32_f16>(T) -> T
-fn degrees<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
+@const fn degrees<T: fa_f32_f16>(T) -> T
+@const fn degrees<N: num, T: fa_f32_f16>(vec<N, T>) -> vec<N, T>
fn determinant<N: num, T: f32_f16>(mat<N, N, T>) -> T
fn distance<T: f32_f16>(T, T) -> T
fn distance<N: num, T: f32_f16>(vec<N, T>, vec<N, T>) -> T
@@ -516,8 +516,8 @@
fn pow<N: num, T: f32_f16>(vec<N, T>, vec<N, T>) -> vec<N, T>
@const fn quantizeToF16(f32) -> f32
@const fn quantizeToF16<N: num>(vec<N, f32>) -> vec<N, f32>
-fn radians<T: f32_f16>(T) -> T
-fn radians<N: num, T: f32_f16>(vec<N, T>) -> vec<N, T>
+@const fn radians<T: fa_f32_f16>(T) -> T
+@const fn radians<N: num, T: fa_f32_f16>(vec<N, T>) -> vec<N, T>
fn reflect<N: num, T: f32_f16>(vec<N, T>, vec<N, T>) -> vec<N, T>
fn refract<N: num, T: f32_f16>(vec<N, T>, vec<N, T>, T) -> vec<N, T>
@const fn reverseBits<T: iu32>(T) -> T
diff --git a/src/tint/number.h b/src/tint/number.h
index 4fa6ed7..dc66689 100644
--- a/src/tint/number.h
+++ b/src/tint/number.h
@@ -274,6 +274,9 @@
/// However since C++ don't have native binary16 type, the value is stored as float.
using f16 = Number<detail::NumberKindF16>;
+template <typename T, traits::EnableIf<IsFloatingPoint<T>>* = nullptr>
+inline const auto kPi = T(UnwrapNumber<T>(3.14159265358979323846));
+
/// True iff T is an abstract number type
template <typename T>
constexpr bool IsAbstract = std::is_same_v<T, AInt> || std::is_same_v<T, AFloat>;
diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc
index 13ca038..f75481c 100644
--- a/src/tint/resolver/const_eval.cc
+++ b/src/tint/resolver/const_eval.cc
@@ -1954,6 +1954,32 @@
utils::Vector<const sem::Constant*, 3>{x.Get(), y.Get(), z.Get()});
}
+ConstEval::Result ConstEval::degrees(const sem::Type* ty,
+ utils::VectorRef<const sem::Constant*> args,
+ const Source& source) {
+ auto transform = [&](const sem::Constant* c0) {
+ auto create = [&](auto e) -> ImplResult {
+ using NumberT = decltype(e);
+ using T = UnwrapNumber<NumberT>;
+
+ auto pi = kPi<T>;
+ auto scale = Div(source, NumberT(180), NumberT(pi));
+ if (!scale) {
+ AddNote("when calculating degrees", source);
+ return utils::Failure;
+ }
+ auto result = Mul(source, e, scale.Get());
+ if (!result) {
+ AddNote("when calculating degrees", source);
+ return utils::Failure;
+ }
+ return CreateElement(builder, source, c0->Type(), result.Get());
+ };
+ return Dispatch_fa_f32_f16(create, c0);
+ };
+ return TransformElements(builder, ty, transform, args[0]);
+}
+
ConstEval::Result ConstEval::extractBits(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source) {
@@ -2267,6 +2293,32 @@
return CreateElement(builder, source, ty, ret);
}
+ConstEval::Result ConstEval::radians(const sem::Type* ty,
+ utils::VectorRef<const sem::Constant*> args,
+ const Source& source) {
+ auto transform = [&](const sem::Constant* c0) {
+ auto create = [&](auto e) -> ImplResult {
+ using NumberT = decltype(e);
+ using T = UnwrapNumber<NumberT>;
+
+ auto pi = kPi<T>;
+ auto scale = Div(source, NumberT(pi), NumberT(180));
+ if (!scale) {
+ AddNote("when calculating radians", source);
+ return utils::Failure;
+ }
+ auto result = Mul(source, e, scale.Get());
+ if (!result) {
+ AddNote("when calculating radians", source);
+ return utils::Failure;
+ }
+ return CreateElement(builder, source, c0->Type(), result.Get());
+ };
+ return Dispatch_fa_f32_f16(create, c0);
+ };
+ return TransformElements(builder, ty, transform, args[0]);
+}
+
ConstEval::Result ConstEval::reverseBits(const sem::Type* ty,
utils::VectorRef<const sem::Constant*> args,
const Source& source) {
diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h
index 73274a1..5e2a97f 100644
--- a/src/tint/resolver/const_eval.h
+++ b/src/tint/resolver/const_eval.h
@@ -539,6 +539,15 @@
utils::VectorRef<const sem::Constant*> args,
const Source& source);
+ /// degrees 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 degrees(const sem::Type* ty,
+ utils::VectorRef<const sem::Constant*> args,
+ const Source& source);
+
/// extractBits builtin
/// @param ty the expression type
/// @param args the input arguments
@@ -647,6 +656,15 @@
utils::VectorRef<const sem::Constant*> args,
const Source& source);
+ /// radians 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 radians(const sem::Type* ty,
+ utils::VectorRef<const sem::Constant*> args,
+ const Source& source);
+
/// reverseBits 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 4b0ff0b..1bf0bd0 100644
--- a/src/tint/resolver/const_eval_builtin_test.cc
+++ b/src/tint/resolver/const_eval_builtin_test.cc
@@ -994,6 +994,57 @@
InsertBitsCases<u32>()))));
template <typename T>
+std::vector<Case> DegreesAFloatCases() {
+ return std::vector<Case>{
+ C({T(0)}, T(0)), //
+ C({-T(0)}, -T(0)), //
+ C({T(0.698132)}, T(40)).FloatComp(), //
+ C({-T(1.5708)}, -T(90.000214)).FloatComp(), //
+ C({T(1.5708)}, T(90.000214)).FloatComp(), //
+ C({T(6.28319)}, T(360.00027)).FloatComp(),
+ };
+}
+INSTANTIATE_TEST_SUITE_P( //
+ DegreesAFloat,
+ ResolverConstEvalBuiltinTest,
+ testing::Combine(testing::Values(sem::BuiltinType::kDegrees),
+ testing::ValuesIn(DegreesAFloatCases<AFloat>())));
+
+template <typename T>
+std::vector<Case> DegreesF32Cases() {
+ return std::vector<Case>{
+ C({T(0)}, T(0)), //
+ C({-T(0)}, -T(0)), //
+ C({T(0.698132)}, T(40)).FloatComp(), //
+ C({-T(1.5708)}, -T(90.000206)).FloatComp(), //
+ C({T(1.5708)}, T(90.000206)).FloatComp(), //
+ C({T(6.28319)}, T(360.00024)).FloatComp(),
+ };
+}
+INSTANTIATE_TEST_SUITE_P( //
+ DegreesF32,
+ ResolverConstEvalBuiltinTest,
+ testing::Combine(testing::Values(sem::BuiltinType::kDegrees),
+ testing::ValuesIn(DegreesF32Cases<f32>())));
+
+template <typename T>
+std::vector<Case> DegreesF16Cases() {
+ return std::vector<Case>{
+ C({T(0)}, T(0)), //
+ C({-T(0)}, -T(0)), //
+ C({T(0.698132)}, T(39.96875)).FloatComp(), //
+ C({-T(1.5708)}, -T(89.9375)).FloatComp(), //
+ C({T(1.5708)}, T(89.9375)).FloatComp(), //
+ C({T(6.28319)}, T(359.75)).FloatComp(),
+ };
+}
+INSTANTIATE_TEST_SUITE_P( //
+ DegreesF16,
+ ResolverConstEvalBuiltinTest,
+ testing::Combine(testing::Values(sem::BuiltinType::kDegrees),
+ testing::ValuesIn(DegreesF16Cases<f16>())));
+
+template <typename T>
std::vector<Case> ExtractBitsCases() {
using UT = Number<std::make_unsigned_t<UnwrapNumber<T>>>;
@@ -1276,6 +1327,41 @@
ReverseBitsCases<u32>()))));
template <typename T>
+std::vector<Case> RadiansCases() {
+ return std::vector<Case>{
+ C({T(0)}, T(0)), //
+ C({-T(0)}, -T(0)), //
+ C({T(40)}, T(0.69813168)).FloatComp(), //
+ C({-T(90)}, -T(1.5707964)).FloatComp(), //
+ C({T(90)}, T(1.5707964)).FloatComp(), //
+ C({T(360)}, T(6.2831855)).FloatComp(),
+ };
+}
+INSTANTIATE_TEST_SUITE_P( //
+ Radians,
+ ResolverConstEvalBuiltinTest,
+ testing::Combine(testing::Values(sem::BuiltinType::kRadians),
+ testing::ValuesIn(Concat(RadiansCases<AFloat>(), //
+ RadiansCases<f32>()))));
+
+template <typename T>
+std::vector<Case> RadiansF16Cases() {
+ return std::vector<Case>{
+ C({T(0)}, T(0)), //
+ C({-T(0)}, -T(0)), //
+ C({T(40)}, T(0.69726562)).FloatComp(), //
+ C({-T(90)}, -T(1.5693359)).FloatComp(), //
+ C({T(90)}, T(1.5693359)).FloatComp(), //
+ C({T(360)}, T(6.2773438)).FloatComp(),
+ };
+}
+INSTANTIATE_TEST_SUITE_P( //
+ RadiansF16,
+ ResolverConstEvalBuiltinTest,
+ testing::Combine(testing::Values(sem::BuiltinType::kRadians),
+ testing::ValuesIn(RadiansF16Cases<f16>())));
+
+template <typename T>
std::vector<Case> RoundCases() {
std::vector<Case> cases = {
C({T(0.0)}, T(0.0)), //
diff --git a/src/tint/resolver/const_eval_test.h b/src/tint/resolver/const_eval_test.h
index 0cedf25..c2e12bc 100644
--- a/src/tint/resolver/const_eval_test.h
+++ b/src/tint/resolver/const_eval_test.h
@@ -27,9 +27,6 @@
namespace tint::resolver {
template <typename T>
-inline const auto kPi = T(UnwrapNumber<T>(3.14159265358979323846));
-
-template <typename T>
inline const auto kPiOver2 = T(UnwrapNumber<T>(1.57079632679489661923));
template <typename T>
diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl
index 3b0b88d..9e76862 100644
--- a/src/tint/resolver/intrinsic_table.inl
+++ b/src/tint/resolver/intrinsic_table.inl
@@ -12174,24 +12174,24 @@
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 0,
- /* template types */ &kTemplateTypes[26],
+ /* template types */ &kTemplateTypes[23],
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[835],
/* return matcher indices */ &kMatcherIndices[3],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* const eval */ nullptr,
+ /* const eval */ &ConstEval::degrees,
},
{
/* [322] */
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 1,
- /* template types */ &kTemplateTypes[26],
+ /* template types */ &kTemplateTypes[23],
/* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[836],
/* return matcher indices */ &kMatcherIndices[30],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* const eval */ nullptr,
+ /* const eval */ &ConstEval::degrees,
},
{
/* [323] */
@@ -12918,24 +12918,24 @@
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 0,
- /* template types */ &kTemplateTypes[26],
+ /* template types */ &kTemplateTypes[23],
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[888],
/* return matcher indices */ &kMatcherIndices[3],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* const eval */ nullptr,
+ /* const eval */ &ConstEval::radians,
},
{
/* [384] */
/* num parameters */ 1,
/* num template types */ 1,
/* num template numbers */ 1,
- /* template types */ &kTemplateTypes[26],
+ /* template types */ &kTemplateTypes[23],
/* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[889],
/* return matcher indices */ &kMatcherIndices[30],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* const eval */ nullptr,
+ /* const eval */ &ConstEval::radians,
},
{
/* [385] */
@@ -14117,8 +14117,8 @@
},
{
/* [19] */
- /* fn degrees<T : f32_f16>(T) -> T */
- /* fn degrees<N : num, T : f32_f16>(vec<N, T>) -> vec<N, T> */
+ /* fn degrees<T : fa_f32_f16>(T) -> T */
+ /* fn degrees<N : num, T : fa_f32_f16>(vec<N, T>) -> vec<N, T> */
/* num overloads */ 2,
/* overloads */ &kOverloads[321],
},
@@ -14408,8 +14408,8 @@
},
{
/* [62] */
- /* fn radians<T : f32_f16>(T) -> T */
- /* fn radians<N : num, T : f32_f16>(vec<N, T>) -> vec<N, T> */
+ /* fn radians<T : fa_f32_f16>(T) -> T */
+ /* fn radians<N : num, T : fa_f32_f16>(vec<N, T>) -> vec<N, T> */
/* num overloads */ 2,
/* overloads */ &kOverloads[383],
},
diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.dxc.hlsl
index 2cd2296..63b2df2 100644
--- a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-float4 tint_degrees(float4 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_0d170c() {
- float4 res = tint_degrees((1.0f).xxxx);
+ float4 res = (57.295776367f).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.fxc.hlsl
index 2cd2296..63b2df2 100644
--- a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.fxc.hlsl
@@ -1,9 +1,5 @@
-float4 tint_degrees(float4 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_0d170c() {
- float4 res = tint_degrees((1.0f).xxxx);
+ float4 res = (57.295776367f).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.glsl
index 542dec0..4269efe 100644
--- a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-vec4 tint_degrees(vec4 param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_0d170c() {
- vec4 res = tint_degrees(vec4(1.0f));
+ vec4 res = vec4(57.295776367f);
}
vec4 vertex_main() {
@@ -25,13 +20,8 @@
#version 310 es
precision mediump float;
-vec4 tint_degrees(vec4 param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_0d170c() {
- vec4 res = tint_degrees(vec4(1.0f));
+ vec4 res = vec4(57.295776367f);
}
void fragment_main() {
@@ -44,13 +34,8 @@
}
#version 310 es
-vec4 tint_degrees(vec4 param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_0d170c() {
- vec4 res = tint_degrees(vec4(1.0f));
+ vec4 res = vec4(57.295776367f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.msl
index 8dc825c..ef0d58a 100644
--- a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-float4 tint_degrees(float4 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_0d170c() {
- float4 res = tint_degrees(float4(1.0f));
+ float4 res = float4(57.295776367f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.spvasm
index 738ca27..ba056b9 100644
--- a/test/tint/builtins/gen/literal/degrees/0d170c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/degrees/0d170c.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_57_2957764 = OpConstant %float 57.2957764
+ %14 = OpConstantComposite %v4float %float_57_2957764 %float_57_2957764 %float_57_2957764 %float_57_2957764
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %19 = OpTypeFunction %v4float
+ %17 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%degrees_0d170c = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %13 = OpExtInst %v4float %14 Degrees %16
- OpStore %res %13
+ OpStore %res %14
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
- %21 = OpLabel
- %22 = OpFunctionCall %void %degrees_0d170c
+%vertex_main_inner = OpFunction %v4float None %17
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %degrees_0d170c
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 %degrees_0d170c
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %degrees_0d170c
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %30 = OpLabel
- %31 = OpFunctionCall %void %degrees_0d170c
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %degrees_0d170c
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.dxc.hlsl
index f8315be..cbe6583 100644
--- a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-float2 tint_degrees(float2 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_1ad5df() {
- float2 res = tint_degrees((1.0f).xx);
+ float2 res = (57.295776367f).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.fxc.hlsl
index f8315be..cbe6583 100644
--- a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.fxc.hlsl
@@ -1,9 +1,5 @@
-float2 tint_degrees(float2 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_1ad5df() {
- float2 res = tint_degrees((1.0f).xx);
+ float2 res = (57.295776367f).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.glsl
index b3dfe33..8640b14 100644
--- a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-vec2 tint_degrees(vec2 param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_1ad5df() {
- vec2 res = tint_degrees(vec2(1.0f));
+ vec2 res = vec2(57.295776367f);
}
vec4 vertex_main() {
@@ -25,13 +20,8 @@
#version 310 es
precision mediump float;
-vec2 tint_degrees(vec2 param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_1ad5df() {
- vec2 res = tint_degrees(vec2(1.0f));
+ vec2 res = vec2(57.295776367f);
}
void fragment_main() {
@@ -44,13 +34,8 @@
}
#version 310 es
-vec2 tint_degrees(vec2 param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_1ad5df() {
- vec2 res = tint_degrees(vec2(1.0f));
+ vec2 res = vec2(57.295776367f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.msl
index e46d2ff..4af91d1 100644
--- a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-float2 tint_degrees(float2 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_1ad5df() {
- float2 res = tint_degrees(float2(1.0f));
+ float2 res = float2(57.295776367f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.spvasm
index 573f04d..9c5c485 100644
--- a/test/tint/builtins/gen/literal/degrees/1ad5df.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/degrees/1ad5df.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_57_2957764 = OpConstant %float 57.2957764
+ %15 = OpConstantComposite %v2float %float_57_2957764 %float_57_2957764
%_ptr_Function_v2float = OpTypePointer Function %v2float
- %20 = OpConstantNull %v2float
- %21 = OpTypeFunction %v4float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%degrees_1ad5df = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v2float Function %20
- %13 = OpExtInst %v2float %15 Degrees %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 %degrees_1ad5df
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %degrees_1ad5df
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 %degrees_1ad5df
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %degrees_1ad5df
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %degrees_1ad5df
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %degrees_1ad5df
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.dxc.hlsl
index 292fa3a..fa9e278 100644
--- a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-float3 tint_degrees(float3 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_2af623() {
- float3 res = tint_degrees((1.0f).xxx);
+ float3 res = (57.295776367f).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.fxc.hlsl
index 292fa3a..fa9e278 100644
--- a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.fxc.hlsl
@@ -1,9 +1,5 @@
-float3 tint_degrees(float3 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_2af623() {
- float3 res = tint_degrees((1.0f).xxx);
+ float3 res = (57.295776367f).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.glsl
index fa064b9..08b51ee 100644
--- a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-vec3 tint_degrees(vec3 param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_2af623() {
- vec3 res = tint_degrees(vec3(1.0f));
+ vec3 res = vec3(57.295776367f);
}
vec4 vertex_main() {
@@ -25,13 +20,8 @@
#version 310 es
precision mediump float;
-vec3 tint_degrees(vec3 param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_2af623() {
- vec3 res = tint_degrees(vec3(1.0f));
+ vec3 res = vec3(57.295776367f);
}
void fragment_main() {
@@ -44,13 +34,8 @@
}
#version 310 es
-vec3 tint_degrees(vec3 param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_2af623() {
- vec3 res = tint_degrees(vec3(1.0f));
+ vec3 res = vec3(57.295776367f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.msl
index 4874bbb..4da3b35 100644
--- a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-float3 tint_degrees(float3 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_2af623() {
- float3 res = tint_degrees(float3(1.0f));
+ float3 res = float3(57.295776367f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.spvasm
index 160a383..b692ad7 100644
--- a/test/tint/builtins/gen/literal/degrees/2af623.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/degrees/2af623.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_57_2957764 = OpConstant %float 57.2957764
+ %15 = OpConstantComposite %v3float %float_57_2957764 %float_57_2957764 %float_57_2957764
%_ptr_Function_v3float = OpTypePointer Function %v3float
- %20 = OpConstantNull %v3float
- %21 = OpTypeFunction %v4float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%degrees_2af623 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v3float Function %20
- %13 = OpExtInst %v3float %15 Degrees %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 %degrees_2af623
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %degrees_2af623
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 %degrees_2af623
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %degrees_2af623
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %degrees_2af623
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %degrees_2af623
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.dxc.hlsl
index ff572fd..3ec4e92 100644
--- a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-vector<float16_t, 4> tint_degrees(vector<float16_t, 4> param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_3055d3() {
- vector<float16_t, 4> res = tint_degrees((float16_t(1.0h)).xxxx);
+ vector<float16_t, 4> res = (float16_t(57.3125h)).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.glsl
index b9788e1..1820254 100644
--- a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec4 tint_degrees(f16vec4 param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_3055d3() {
- f16vec4 res = tint_degrees(f16vec4(1.0hf));
+ f16vec4 res = f16vec4(57.3125hf);
}
vec4 vertex_main() {
@@ -27,13 +22,8 @@
#extension GL_AMD_gpu_shader_half_float : require
precision mediump float;
-f16vec4 tint_degrees(f16vec4 param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_3055d3() {
- f16vec4 res = tint_degrees(f16vec4(1.0hf));
+ f16vec4 res = f16vec4(57.3125hf);
}
void fragment_main() {
@@ -47,13 +37,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec4 tint_degrees(f16vec4 param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_3055d3() {
- f16vec4 res = tint_degrees(f16vec4(1.0hf));
+ f16vec4 res = f16vec4(57.3125hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.msl
index e9fe3c7..dbbd520 100644
--- a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-half4 tint_degrees(half4 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_3055d3() {
- half4 res = tint_degrees(half4(1.0h));
+ half4 res = half4(57.3125h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.spvasm
index 171e19c..ba293b3 100644
--- a/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/degrees/3055d3.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,38 +36,37 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
-%half_0x1p_0 = OpConstant %half 0x1p+0
- %18 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
+%half_0x1_ca8p_5 = OpConstant %half 0x1.ca8p+5
+ %16 = OpConstantComposite %v4half %half_0x1_ca8p_5 %half_0x1_ca8p_5 %half_0x1_ca8p_5 %half_0x1_ca8p_5
%_ptr_Function_v4half = OpTypePointer Function %v4half
- %21 = OpConstantNull %v4half
- %22 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v4half
+ %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%degrees_3055d3 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v4half Function %21
- %13 = OpExtInst %v4half %16 Degrees %18
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v4half Function %19
+ OpStore %res %16
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %22
- %24 = OpLabel
- %25 = OpFunctionCall %void %degrees_3055d3
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %degrees_3055d3
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %27 = OpLabel
- %28 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %28
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %degrees_3055d3
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %degrees_3055d3
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %degrees_3055d3
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %degrees_3055d3
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.dxc.hlsl
index feab0fb..360efa4 100644
--- a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-float tint_degrees(float param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_51f705() {
- float res = tint_degrees(1.0f);
+ float res = 57.295776367f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.fxc.hlsl
index feab0fb..360efa4 100644
--- a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.fxc.hlsl
@@ -1,9 +1,5 @@
-float tint_degrees(float param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_51f705() {
- float res = tint_degrees(1.0f);
+ float res = 57.295776367f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.glsl
index 3357c9e..a9b22b4 100644
--- a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-float tint_degrees(float param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_51f705() {
- float res = tint_degrees(1.0f);
+ float res = 57.295776367f;
}
vec4 vertex_main() {
@@ -25,13 +20,8 @@
#version 310 es
precision mediump float;
-float tint_degrees(float param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_51f705() {
- float res = tint_degrees(1.0f);
+ float res = 57.295776367f;
}
void fragment_main() {
@@ -44,13 +34,8 @@
}
#version 310 es
-float tint_degrees(float param_0) {
- return param_0 * 57.295779513082322865f;
-}
-
-
void degrees_51f705() {
- float res = tint_degrees(1.0f);
+ float res = 57.295776367f;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.msl
index 6c29fa0..6ff8e85 100644
--- a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-float tint_degrees(float param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_51f705() {
- float res = tint_degrees(1.0f);
+ float res = 57.295776367f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.spvasm
index 84e3e97..9c98fce 100644
--- a/test/tint/builtins/gen/literal/degrees/51f705.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/degrees/51f705.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_57_2957764 = OpConstant %float 57.2957764
%_ptr_Function_float = OpTypePointer Function %float
- %18 = OpTypeFunction %v4float
+ %16 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%degrees_51f705 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
- %13 = OpExtInst %float %14 Degrees %float_1
- OpStore %res %13
+ OpStore %res %float_57_2957764
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %18
- %20 = OpLabel
- %21 = OpFunctionCall %void %degrees_51f705
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %degrees_51f705
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 %degrees_51f705
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %degrees_51f705
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %degrees_51f705
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %degrees_51f705
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.dxc.hlsl
index 930472f..eff605b 100644
--- a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-float16_t tint_degrees(float16_t param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_5e9805() {
- float16_t res = tint_degrees(float16_t(1.0h));
+ float16_t res = float16_t(57.3125h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.glsl
index 3042f4c..1ef9dcf 100644
--- a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-float16_t tint_degrees(float16_t param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_5e9805() {
- float16_t res = tint_degrees(1.0hf);
+ float16_t res = 57.3125hf;
}
vec4 vertex_main() {
@@ -27,13 +22,8 @@
#extension GL_AMD_gpu_shader_half_float : require
precision mediump float;
-float16_t tint_degrees(float16_t param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_5e9805() {
- float16_t res = tint_degrees(1.0hf);
+ float16_t res = 57.3125hf;
}
void fragment_main() {
@@ -47,13 +37,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-float16_t tint_degrees(float16_t param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_5e9805() {
- float16_t res = tint_degrees(1.0hf);
+ float16_t res = 57.3125hf;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.msl
index 280c0bc..8a94020 100644
--- a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-half tint_degrees(half param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_5e9805() {
- half res = tint_degrees(1.0h);
+ half res = 57.3125h;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.spvasm
index 9a33ca6..a942b16 100644
--- a/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/degrees/5e9805.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %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,37 +35,36 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
-%half_0x1p_0 = OpConstant %half 0x1p+0
+%half_0x1_ca8p_5 = OpConstant %half 0x1.ca8p+5
%_ptr_Function_half = OpTypePointer Function %half
- %19 = OpConstantNull %half
- %20 = OpTypeFunction %v4float
+ %17 = OpConstantNull %half
+ %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%degrees_5e9805 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_half Function %19
- %13 = OpExtInst %half %15 Degrees %half_0x1p_0
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_half Function %17
+ OpStore %res %half_0x1_ca8p_5
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %20
- %22 = OpLabel
- %23 = OpFunctionCall %void %degrees_5e9805
+%vertex_main_inner = OpFunction %v4float None %18
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %degrees_5e9805
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %25 = OpLabel
- %26 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %26
+ %23 = OpLabel
+ %24 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %degrees_5e9805
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %degrees_5e9805
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %degrees_5e9805
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %degrees_5e9805
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/810467.wgsl b/test/tint/builtins/gen/literal/degrees/810467.wgsl
new file mode 100644
index 0000000..f3a288e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/810467.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 degrees(vec<2, fa>) -> vec<2, fa>
+fn degrees_810467() {
+ var res = degrees(vec2(1.));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_810467();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_810467();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_810467();
+}
diff --git a/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..eb0415d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_810467() {
+ float2 res = (57.295780182f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_810467();
+ 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() {
+ degrees_810467();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_810467();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..eb0415d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_810467() {
+ float2 res = (57.295780182f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_810467();
+ 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() {
+ degrees_810467();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_810467();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.glsl
new file mode 100644
index 0000000..cee6770
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void degrees_810467() {
+ vec2 res = vec2(57.295780182f);
+}
+
+vec4 vertex_main() {
+ degrees_810467();
+ 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 degrees_810467() {
+ vec2 res = vec2(57.295780182f);
+}
+
+void fragment_main() {
+ degrees_810467();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void degrees_810467() {
+ vec2 res = vec2(57.295780182f);
+}
+
+void compute_main() {
+ degrees_810467();
+}
+
+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/degrees/810467.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.msl
new file mode 100644
index 0000000..26fdf6d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void degrees_810467() {
+ float2 res = float2(57.295780182f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_810467();
+ 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() {
+ degrees_810467();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_810467();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.spvasm
new file mode 100644
index 0000000..2f16f05
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/810467.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 %degrees_810467 "degrees_810467"
+ 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_57_2957802 = OpConstant %float 57.2957802
+ %15 = OpConstantComposite %v2float %float_57_2957802 %float_57_2957802
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_810467 = 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 %degrees_810467
+ 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 %degrees_810467
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %degrees_810467
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.wgsl
new file mode 100644
index 0000000..f485b44
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/810467.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn degrees_810467() {
+ var res = degrees(vec2(1.0));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_810467();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_810467();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_810467();
+}
diff --git a/test/tint/builtins/gen/literal/degrees/c0880c.wgsl b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl
new file mode 100644
index 0000000..168ddab
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/c0880c.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 degrees(vec<3, fa>) -> vec<3, fa>
+fn degrees_c0880c() {
+ var res = degrees(vec3(1.));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_c0880c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_c0880c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_c0880c();
+}
diff --git a/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..78013a9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_c0880c() {
+ float3 res = (57.295780182f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_c0880c();
+ 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() {
+ degrees_c0880c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_c0880c();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..78013a9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_c0880c() {
+ float3 res = (57.295780182f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_c0880c();
+ 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() {
+ degrees_c0880c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_c0880c();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.glsl
new file mode 100644
index 0000000..ad03188
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void degrees_c0880c() {
+ vec3 res = vec3(57.295780182f);
+}
+
+vec4 vertex_main() {
+ degrees_c0880c();
+ 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 degrees_c0880c() {
+ vec3 res = vec3(57.295780182f);
+}
+
+void fragment_main() {
+ degrees_c0880c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void degrees_c0880c() {
+ vec3 res = vec3(57.295780182f);
+}
+
+void compute_main() {
+ degrees_c0880c();
+}
+
+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/degrees/c0880c.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.msl
new file mode 100644
index 0000000..4b019e9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void degrees_c0880c() {
+ float3 res = float3(57.295780182f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_c0880c();
+ 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() {
+ degrees_c0880c();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_c0880c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.spvasm
new file mode 100644
index 0000000..7fe5c73
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/c0880c.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 %degrees_c0880c "degrees_c0880c"
+ 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_57_2957802 = OpConstant %float 57.2957802
+ %15 = OpConstantComposite %v3float %float_57_2957802 %float_57_2957802 %float_57_2957802
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_c0880c = 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 %degrees_c0880c
+ 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 %degrees_c0880c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %degrees_c0880c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.wgsl
new file mode 100644
index 0000000..56b77be
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/c0880c.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn degrees_c0880c() {
+ var res = degrees(vec3(1.0));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_c0880c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_c0880c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_c0880c();
+}
diff --git a/test/tint/builtins/gen/literal/degrees/d43a49.wgsl b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl
new file mode 100644
index 0000000..591aa5e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/d43a49.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 degrees(vec<4, fa>) -> vec<4, fa>
+fn degrees_d43a49() {
+ var res = degrees(vec4(1.));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_d43a49();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_d43a49();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_d43a49();
+}
diff --git a/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0ea5685
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_d43a49() {
+ float4 res = (57.295780182f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_d43a49();
+ 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() {
+ degrees_d43a49();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_d43a49();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0ea5685
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_d43a49() {
+ float4 res = (57.295780182f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_d43a49();
+ 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() {
+ degrees_d43a49();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_d43a49();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.glsl
new file mode 100644
index 0000000..893f790
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void degrees_d43a49() {
+ vec4 res = vec4(57.295780182f);
+}
+
+vec4 vertex_main() {
+ degrees_d43a49();
+ 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 degrees_d43a49() {
+ vec4 res = vec4(57.295780182f);
+}
+
+void fragment_main() {
+ degrees_d43a49();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void degrees_d43a49() {
+ vec4 res = vec4(57.295780182f);
+}
+
+void compute_main() {
+ degrees_d43a49();
+}
+
+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/degrees/d43a49.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.msl
new file mode 100644
index 0000000..adddeb0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void degrees_d43a49() {
+ float4 res = float4(57.295780182f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_d43a49();
+ 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() {
+ degrees_d43a49();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_d43a49();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.spvasm
new file mode 100644
index 0000000..d0ca406
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/d43a49.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 %degrees_d43a49 "degrees_d43a49"
+ 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_57_2957802 = OpConstant %float 57.2957802
+ %14 = OpConstantComposite %v4float %float_57_2957802 %float_57_2957802 %float_57_2957802 %float_57_2957802
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_d43a49 = 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 %degrees_d43a49
+ 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 %degrees_d43a49
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %degrees_d43a49
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.wgsl
new file mode 100644
index 0000000..5d52734
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/d43a49.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn degrees_d43a49() {
+ var res = degrees(vec4(1.0));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_d43a49();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_d43a49();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_d43a49();
+}
diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.dxc.hlsl
index b54ef76..e79a618 100644
--- a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-vector<float16_t, 3> tint_degrees(vector<float16_t, 3> param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_dfe8f4() {
- vector<float16_t, 3> res = tint_degrees((float16_t(1.0h)).xxx);
+ vector<float16_t, 3> res = (float16_t(57.3125h)).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.glsl
index 576497a..44e7b2a 100644
--- a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec3 tint_degrees(f16vec3 param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_dfe8f4() {
- f16vec3 res = tint_degrees(f16vec3(1.0hf));
+ f16vec3 res = f16vec3(57.3125hf);
}
vec4 vertex_main() {
@@ -27,13 +22,8 @@
#extension GL_AMD_gpu_shader_half_float : require
precision mediump float;
-f16vec3 tint_degrees(f16vec3 param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_dfe8f4() {
- f16vec3 res = tint_degrees(f16vec3(1.0hf));
+ f16vec3 res = f16vec3(57.3125hf);
}
void fragment_main() {
@@ -47,13 +37,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec3 tint_degrees(f16vec3 param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_dfe8f4() {
- f16vec3 res = tint_degrees(f16vec3(1.0hf));
+ f16vec3 res = f16vec3(57.3125hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.msl
index 419df21..581a6af 100644
--- a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-half3 tint_degrees(half3 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_dfe8f4() {
- half3 res = tint_degrees(half3(1.0h));
+ half3 res = half3(57.3125h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.spvasm
index ca76456..449a8ea 100644
--- a/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/degrees/dfe8f4.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,38 +36,37 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
-%half_0x1p_0 = OpConstant %half 0x1p+0
- %18 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
+%half_0x1_ca8p_5 = OpConstant %half 0x1.ca8p+5
+ %16 = OpConstantComposite %v3half %half_0x1_ca8p_5 %half_0x1_ca8p_5 %half_0x1_ca8p_5
%_ptr_Function_v3half = OpTypePointer Function %v3half
- %21 = OpConstantNull %v3half
- %22 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v3half
+ %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%degrees_dfe8f4 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v3half Function %21
- %13 = OpExtInst %v3half %16 Degrees %18
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v3half Function %19
+ OpStore %res %16
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %22
- %24 = OpLabel
- %25 = OpFunctionCall %void %degrees_dfe8f4
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %degrees_dfe8f4
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %27 = OpLabel
- %28 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %28
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %degrees_dfe8f4
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %degrees_dfe8f4
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %degrees_dfe8f4
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %degrees_dfe8f4
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.dxc.hlsl
index 68de11a..336be91 100644
--- a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-vector<float16_t, 2> tint_degrees(vector<float16_t, 2> param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_f59715() {
- vector<float16_t, 2> res = tint_degrees((float16_t(1.0h)).xx);
+ vector<float16_t, 2> res = (float16_t(57.3125h)).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.glsl
index 7a7c686..a3e8bf9 100644
--- a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec2 tint_degrees(f16vec2 param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_f59715() {
- f16vec2 res = tint_degrees(f16vec2(1.0hf));
+ f16vec2 res = f16vec2(57.3125hf);
}
vec4 vertex_main() {
@@ -27,13 +22,8 @@
#extension GL_AMD_gpu_shader_half_float : require
precision mediump float;
-f16vec2 tint_degrees(f16vec2 param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_f59715() {
- f16vec2 res = tint_degrees(f16vec2(1.0hf));
+ f16vec2 res = f16vec2(57.3125hf);
}
void fragment_main() {
@@ -47,13 +37,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec2 tint_degrees(f16vec2 param_0) {
- return param_0 * 57.295779513082322865hf;
-}
-
-
void degrees_f59715() {
- f16vec2 res = tint_degrees(f16vec2(1.0hf));
+ f16vec2 res = f16vec2(57.3125hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.msl
index af8aa30..62fd426 100644
--- a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-half2 tint_degrees(half2 param_0) {
- return param_0 * 57.295779513082322865;
-}
-
void degrees_f59715() {
- half2 res = tint_degrees(half2(1.0h));
+ half2 res = half2(57.3125h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.spvasm
index ca83372..ba71ed3 100644
--- a/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/degrees/f59715.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,38 +36,37 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
-%half_0x1p_0 = OpConstant %half 0x1p+0
- %18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
+%half_0x1_ca8p_5 = OpConstant %half 0x1.ca8p+5
+ %16 = OpConstantComposite %v2half %half_0x1_ca8p_5 %half_0x1_ca8p_5
%_ptr_Function_v2half = OpTypePointer Function %v2half
- %21 = OpConstantNull %v2half
- %22 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v2half
+ %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%degrees_f59715 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v2half Function %21
- %13 = OpExtInst %v2half %16 Degrees %18
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v2half Function %19
+ OpStore %res %16
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %22
- %24 = OpLabel
- %25 = OpFunctionCall %void %degrees_f59715
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %degrees_f59715
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %27 = OpLabel
- %28 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %28
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %degrees_f59715
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %degrees_f59715
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %degrees_f59715
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %degrees_f59715
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl
new file mode 100644
index 0000000..f5135de
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/fafa7e.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 degrees(fa) -> fa
+fn degrees_fafa7e() {
+ var res = degrees(1.);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_fafa7e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_fafa7e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_fafa7e();
+}
diff --git a/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a11be10
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_fafa7e();
+ 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() {
+ degrees_fafa7e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_fafa7e();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a11be10
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_fafa7e();
+ 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() {
+ degrees_fafa7e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_fafa7e();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.glsl b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.glsl
new file mode 100644
index 0000000..4572eb3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+vec4 vertex_main() {
+ degrees_fafa7e();
+ 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 degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+void fragment_main() {
+ degrees_fafa7e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+void compute_main() {
+ degrees_fafa7e();
+}
+
+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/degrees/fafa7e.wgsl.expected.msl b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.msl
new file mode 100644
index 0000000..770b0ab
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_fafa7e();
+ 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() {
+ degrees_fafa7e();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_fafa7e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.spvasm
new file mode 100644
index 0000000..e3e9810
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/fafa7e.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 %degrees_fafa7e "degrees_fafa7e"
+ 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_57_2957802 = OpConstant %float 57.2957802
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_fafa7e = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_57_2957802
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %degrees_fafa7e
+ 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 %degrees_fafa7e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %degrees_fafa7e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.wgsl
new file mode 100644
index 0000000..572f1d6
--- /dev/null
+++ b/test/tint/builtins/gen/literal/degrees/fafa7e.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn degrees_fafa7e() {
+ var res = degrees(1.0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_fafa7e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_fafa7e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_fafa7e();
+}
diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.dxc.hlsl
index d1adfed..9fda1fb 100644
--- a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-float4 tint_radians(float4 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_09b7fc() {
- float4 res = tint_radians((1.0f).xxxx);
+ float4 res = (0.017453292f).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.fxc.hlsl
index d1adfed..9fda1fb 100644
--- a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.fxc.hlsl
@@ -1,9 +1,5 @@
-float4 tint_radians(float4 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_09b7fc() {
- float4 res = tint_radians((1.0f).xxxx);
+ float4 res = (0.017453292f).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.glsl
index a0c4475..4a6d169 100644
--- a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-vec4 tint_radians(vec4 param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_09b7fc() {
- vec4 res = tint_radians(vec4(1.0f));
+ vec4 res = vec4(0.017453292f);
}
vec4 vertex_main() {
@@ -25,13 +20,8 @@
#version 310 es
precision mediump float;
-vec4 tint_radians(vec4 param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_09b7fc() {
- vec4 res = tint_radians(vec4(1.0f));
+ vec4 res = vec4(0.017453292f);
}
void fragment_main() {
@@ -44,13 +34,8 @@
}
#version 310 es
-vec4 tint_radians(vec4 param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_09b7fc() {
- vec4 res = tint_radians(vec4(1.0f));
+ vec4 res = vec4(0.017453292f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.msl
index 59ac3a3..5b7469d 100644
--- a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-float4 tint_radians(float4 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_09b7fc() {
- float4 res = tint_radians(float4(1.0f));
+ float4 res = float4(0.017453292f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.spvasm
index ddeea5d..51235ca 100644
--- a/test/tint/builtins/gen/literal/radians/09b7fc.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/radians/09b7fc.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_0174532924 = OpConstant %float 0.0174532924
+ %14 = OpConstantComposite %v4float %float_0_0174532924 %float_0_0174532924 %float_0_0174532924 %float_0_0174532924
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %19 = OpTypeFunction %v4float
+ %17 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%radians_09b7fc = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %13 = OpExtInst %v4float %14 Radians %16
- OpStore %res %13
+ OpStore %res %14
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
- %21 = OpLabel
- %22 = OpFunctionCall %void %radians_09b7fc
+%vertex_main_inner = OpFunction %v4float None %17
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %radians_09b7fc
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 %radians_09b7fc
+ %26 = OpLabel
+ %27 = OpFunctionCall %void %radians_09b7fc
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %30 = OpLabel
- %31 = OpFunctionCall %void %radians_09b7fc
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %radians_09b7fc
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.dxc.hlsl
index fb9a879..0421e6d 100644
--- a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-float16_t tint_radians(float16_t param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_208fd9() {
- float16_t res = tint_radians(float16_t(1.0h));
+ float16_t res = float16_t(0.017440796h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.glsl
index a48668c..efcf7aa 100644
--- a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-float16_t tint_radians(float16_t param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_208fd9() {
- float16_t res = tint_radians(1.0hf);
+ float16_t res = 0.017440796hf;
}
vec4 vertex_main() {
@@ -27,13 +22,8 @@
#extension GL_AMD_gpu_shader_half_float : require
precision mediump float;
-float16_t tint_radians(float16_t param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_208fd9() {
- float16_t res = tint_radians(1.0hf);
+ float16_t res = 0.017440796hf;
}
void fragment_main() {
@@ -47,13 +37,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-float16_t tint_radians(float16_t param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_208fd9() {
- float16_t res = tint_radians(1.0hf);
+ float16_t res = 0.017440796hf;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.msl
index 72d93d6..93c1037 100644
--- a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-half tint_radians(half param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_208fd9() {
- half res = tint_radians(1.0h);
+ half res = 0.017440796h;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.spvasm
index e218859..0081055 100644
--- a/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/radians/208fd9.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %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,37 +35,36 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
-%half_0x1p_0 = OpConstant %half 0x1p+0
+%half_0x1_1dcpn6 = OpConstant %half 0x1.1dcp-6
%_ptr_Function_half = OpTypePointer Function %half
- %19 = OpConstantNull %half
- %20 = OpTypeFunction %v4float
+ %17 = OpConstantNull %half
+ %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%radians_208fd9 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_half Function %19
- %13 = OpExtInst %half %15 Radians %half_0x1p_0
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_half Function %17
+ OpStore %res %half_0x1_1dcpn6
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %20
- %22 = OpLabel
- %23 = OpFunctionCall %void %radians_208fd9
+%vertex_main_inner = OpFunction %v4float None %18
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %radians_208fd9
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %25 = OpLabel
- %26 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %26
+ %23 = OpLabel
+ %24 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %24
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %radians_208fd9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %radians_208fd9
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %radians_208fd9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %radians_208fd9
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/379214.wgsl b/test/tint/builtins/gen/literal/radians/379214.wgsl
new file mode 100644
index 0000000..273ddee
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/379214.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 radians(vec<3, fa>) -> vec<3, fa>
+fn radians_379214() {
+ var res = radians(vec3(1.));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_379214();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_379214();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_379214();
+}
diff --git a/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..247db1d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void radians_379214() {
+ float3 res = (0.017453292f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_379214();
+ 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() {
+ radians_379214();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_379214();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..247db1d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void radians_379214() {
+ float3 res = (0.017453292f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_379214();
+ 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() {
+ radians_379214();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_379214();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.glsl
new file mode 100644
index 0000000..5593c1d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void radians_379214() {
+ vec3 res = vec3(0.017453292f);
+}
+
+vec4 vertex_main() {
+ radians_379214();
+ 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 radians_379214() {
+ vec3 res = vec3(0.017453292f);
+}
+
+void fragment_main() {
+ radians_379214();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void radians_379214() {
+ vec3 res = vec3(0.017453292f);
+}
+
+void compute_main() {
+ radians_379214();
+}
+
+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/radians/379214.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.msl
new file mode 100644
index 0000000..638763a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void radians_379214() {
+ float3 res = float3(0.017453292f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_379214();
+ 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() {
+ radians_379214();
+ return;
+}
+
+kernel void compute_main() {
+ radians_379214();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.spvasm
new file mode 100644
index 0000000..ec9360a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/379214.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 %radians_379214 "radians_379214"
+ 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_0174532924 = OpConstant %float 0.0174532924
+ %15 = OpConstantComposite %v3float %float_0_0174532924 %float_0_0174532924 %float_0_0174532924
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_379214 = 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 %radians_379214
+ 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 %radians_379214
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %radians_379214
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.wgsl
new file mode 100644
index 0000000..f0f98c8
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/379214.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn radians_379214() {
+ var res = radians(vec3(1.0));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_379214();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_379214();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_379214();
+}
diff --git a/test/tint/builtins/gen/literal/radians/44a9f8.wgsl b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl
new file mode 100644
index 0000000..cbb4f6d
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/44a9f8.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 radians(vec<2, fa>) -> vec<2, fa>
+fn radians_44a9f8() {
+ var res = radians(vec2(1.));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_44a9f8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_44a9f8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_44a9f8();
+}
diff --git a/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..cb67c5d9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void radians_44a9f8() {
+ float2 res = (0.017453292f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_44a9f8();
+ 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() {
+ radians_44a9f8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_44a9f8();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..cb67c5d9
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void radians_44a9f8() {
+ float2 res = (0.017453292f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_44a9f8();
+ 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() {
+ radians_44a9f8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_44a9f8();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.glsl
new file mode 100644
index 0000000..6caa601
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void radians_44a9f8() {
+ vec2 res = vec2(0.017453292f);
+}
+
+vec4 vertex_main() {
+ radians_44a9f8();
+ 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 radians_44a9f8() {
+ vec2 res = vec2(0.017453292f);
+}
+
+void fragment_main() {
+ radians_44a9f8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void radians_44a9f8() {
+ vec2 res = vec2(0.017453292f);
+}
+
+void compute_main() {
+ radians_44a9f8();
+}
+
+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/radians/44a9f8.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.msl
new file mode 100644
index 0000000..fea0149
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void radians_44a9f8() {
+ float2 res = float2(0.017453292f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_44a9f8();
+ 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() {
+ radians_44a9f8();
+ return;
+}
+
+kernel void compute_main() {
+ radians_44a9f8();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.spvasm
new file mode 100644
index 0000000..4e135fc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/44a9f8.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 %radians_44a9f8 "radians_44a9f8"
+ 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_0174532924 = OpConstant %float 0.0174532924
+ %15 = OpConstantComposite %v2float %float_0_0174532924 %float_0_0174532924
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_44a9f8 = 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 %radians_44a9f8
+ 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 %radians_44a9f8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %radians_44a9f8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.wgsl
new file mode 100644
index 0000000..4d6455c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/44a9f8.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn radians_44a9f8() {
+ var res = radians(vec2(1.0));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_44a9f8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_44a9f8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_44a9f8();
+}
diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.dxc.hlsl
index 3c88857..f107b59 100644
--- a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-vector<float16_t, 4> tint_radians(vector<float16_t, 4> param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_44f20b() {
- vector<float16_t, 4> res = tint_radians((float16_t(1.0h)).xxxx);
+ vector<float16_t, 4> res = (float16_t(0.017440796h)).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.glsl
index caa4ab8..ed65328 100644
--- a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec4 tint_radians(f16vec4 param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_44f20b() {
- f16vec4 res = tint_radians(f16vec4(1.0hf));
+ f16vec4 res = f16vec4(0.017440796hf);
}
vec4 vertex_main() {
@@ -27,13 +22,8 @@
#extension GL_AMD_gpu_shader_half_float : require
precision mediump float;
-f16vec4 tint_radians(f16vec4 param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_44f20b() {
- f16vec4 res = tint_radians(f16vec4(1.0hf));
+ f16vec4 res = f16vec4(0.017440796hf);
}
void fragment_main() {
@@ -47,13 +37,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec4 tint_radians(f16vec4 param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_44f20b() {
- f16vec4 res = tint_radians(f16vec4(1.0hf));
+ f16vec4 res = f16vec4(0.017440796hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.msl
index 0f7b12f..d279cb3 100644
--- a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-half4 tint_radians(half4 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_44f20b() {
- half4 res = tint_radians(half4(1.0h));
+ half4 res = half4(0.017440796h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.spvasm
index 993e544..7a543a4 100644
--- a/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/radians/44f20b.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,38 +36,37 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
-%half_0x1p_0 = OpConstant %half 0x1p+0
- %18 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
+%half_0x1_1dcpn6 = OpConstant %half 0x1.1dcp-6
+ %16 = OpConstantComposite %v4half %half_0x1_1dcpn6 %half_0x1_1dcpn6 %half_0x1_1dcpn6 %half_0x1_1dcpn6
%_ptr_Function_v4half = OpTypePointer Function %v4half
- %21 = OpConstantNull %v4half
- %22 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v4half
+ %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%radians_44f20b = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v4half Function %21
- %13 = OpExtInst %v4half %16 Radians %18
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v4half Function %19
+ OpStore %res %16
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %22
- %24 = OpLabel
- %25 = OpFunctionCall %void %radians_44f20b
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %radians_44f20b
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %27 = OpLabel
- %28 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %28
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %radians_44f20b
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %radians_44f20b
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %radians_44f20b
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %radians_44f20b
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/524a91.wgsl b/test/tint/builtins/gen/literal/radians/524a91.wgsl
new file mode 100644
index 0000000..42d2fad
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/524a91.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 radians(vec<4, fa>) -> vec<4, fa>
+fn radians_524a91() {
+ var res = radians(vec4(1.));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_524a91();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_524a91();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_524a91();
+}
diff --git a/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b3e2192
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void radians_524a91() {
+ float4 res = (0.017453292f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_524a91();
+ 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() {
+ radians_524a91();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_524a91();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b3e2192
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void radians_524a91() {
+ float4 res = (0.017453292f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_524a91();
+ 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() {
+ radians_524a91();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_524a91();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.glsl
new file mode 100644
index 0000000..fd1508e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void radians_524a91() {
+ vec4 res = vec4(0.017453292f);
+}
+
+vec4 vertex_main() {
+ radians_524a91();
+ 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 radians_524a91() {
+ vec4 res = vec4(0.017453292f);
+}
+
+void fragment_main() {
+ radians_524a91();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void radians_524a91() {
+ vec4 res = vec4(0.017453292f);
+}
+
+void compute_main() {
+ radians_524a91();
+}
+
+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/radians/524a91.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.msl
new file mode 100644
index 0000000..fa539e0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void radians_524a91() {
+ float4 res = float4(0.017453292f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_524a91();
+ 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() {
+ radians_524a91();
+ return;
+}
+
+kernel void compute_main() {
+ radians_524a91();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.spvasm
new file mode 100644
index 0000000..a9c1edf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/524a91.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 %radians_524a91 "radians_524a91"
+ 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_0174532924 = OpConstant %float 0.0174532924
+ %14 = OpConstantComposite %v4float %float_0_0174532924 %float_0_0174532924 %float_0_0174532924 %float_0_0174532924
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_524a91 = 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 %radians_524a91
+ 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 %radians_524a91
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %radians_524a91
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.wgsl
new file mode 100644
index 0000000..7f69a56
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/524a91.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn radians_524a91() {
+ var res = radians(vec4(1.0));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_524a91();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_524a91();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_524a91();
+}
diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.dxc.hlsl
index 66fd0bb..08ec6b4 100644
--- a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-float2 tint_radians(float2 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_61687a() {
- float2 res = tint_radians((1.0f).xx);
+ float2 res = (0.017453292f).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.fxc.hlsl
index 66fd0bb..08ec6b4 100644
--- a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.fxc.hlsl
@@ -1,9 +1,5 @@
-float2 tint_radians(float2 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_61687a() {
- float2 res = tint_radians((1.0f).xx);
+ float2 res = (0.017453292f).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.glsl
index 0810866..3ef50f3 100644
--- a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-vec2 tint_radians(vec2 param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_61687a() {
- vec2 res = tint_radians(vec2(1.0f));
+ vec2 res = vec2(0.017453292f);
}
vec4 vertex_main() {
@@ -25,13 +20,8 @@
#version 310 es
precision mediump float;
-vec2 tint_radians(vec2 param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_61687a() {
- vec2 res = tint_radians(vec2(1.0f));
+ vec2 res = vec2(0.017453292f);
}
void fragment_main() {
@@ -44,13 +34,8 @@
}
#version 310 es
-vec2 tint_radians(vec2 param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_61687a() {
- vec2 res = tint_radians(vec2(1.0f));
+ vec2 res = vec2(0.017453292f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.msl
index 2ce1861..8d8cf5c 100644
--- a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-float2 tint_radians(float2 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_61687a() {
- float2 res = tint_radians(float2(1.0f));
+ float2 res = float2(0.017453292f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.spvasm
index b9e7307..0dc12cf 100644
--- a/test/tint/builtins/gen/literal/radians/61687a.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/radians/61687a.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_0174532924 = OpConstant %float 0.0174532924
+ %15 = OpConstantComposite %v2float %float_0_0174532924 %float_0_0174532924
%_ptr_Function_v2float = OpTypePointer Function %v2float
- %20 = OpConstantNull %v2float
- %21 = OpTypeFunction %v4float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%radians_61687a = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v2float Function %20
- %13 = OpExtInst %v2float %15 Radians %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 %radians_61687a
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %radians_61687a
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 %radians_61687a
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %radians_61687a
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %radians_61687a
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %radians_61687a
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.dxc.hlsl
index 9d7e818..5722b0d 100644
--- a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-float tint_radians(float param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_6b0ff2() {
- float res = tint_radians(1.0f);
+ float res = 0.017453292f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.fxc.hlsl
index 9d7e818..5722b0d 100644
--- a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.fxc.hlsl
@@ -1,9 +1,5 @@
-float tint_radians(float param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_6b0ff2() {
- float res = tint_radians(1.0f);
+ float res = 0.017453292f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.glsl
index b279215..ceb5f05 100644
--- a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-float tint_radians(float param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_6b0ff2() {
- float res = tint_radians(1.0f);
+ float res = 0.017453292f;
}
vec4 vertex_main() {
@@ -25,13 +20,8 @@
#version 310 es
precision mediump float;
-float tint_radians(float param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_6b0ff2() {
- float res = tint_radians(1.0f);
+ float res = 0.017453292f;
}
void fragment_main() {
@@ -44,13 +34,8 @@
}
#version 310 es
-float tint_radians(float param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_6b0ff2() {
- float res = tint_radians(1.0f);
+ float res = 0.017453292f;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.msl
index 074b46d..486252d 100644
--- a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-float tint_radians(float param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_6b0ff2() {
- float res = tint_radians(1.0f);
+ float res = 0.017453292f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.spvasm
index 4f49a3f..f105b00 100644
--- a/test/tint/builtins/gen/literal/radians/6b0ff2.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/radians/6b0ff2.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_0174532924 = OpConstant %float 0.0174532924
%_ptr_Function_float = OpTypePointer Function %float
- %18 = OpTypeFunction %v4float
+ %16 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%radians_6b0ff2 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
- %13 = OpExtInst %float %14 Radians %float_1
- OpStore %res %13
+ OpStore %res %float_0_0174532924
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %18
- %20 = OpLabel
- %21 = OpFunctionCall %void %radians_6b0ff2
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %radians_6b0ff2
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 %radians_6b0ff2
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %radians_6b0ff2
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %radians_6b0ff2
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %radians_6b0ff2
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.dxc.hlsl
index 72427f3..680dffd 100644
--- a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-vector<float16_t, 3> tint_radians(vector<float16_t, 3> param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_7ea4c7() {
- vector<float16_t, 3> res = tint_radians((float16_t(1.0h)).xxx);
+ vector<float16_t, 3> res = (float16_t(0.017440796h)).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.glsl
index 75c124c..44b3775 100644
--- a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec3 tint_radians(f16vec3 param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_7ea4c7() {
- f16vec3 res = tint_radians(f16vec3(1.0hf));
+ f16vec3 res = f16vec3(0.017440796hf);
}
vec4 vertex_main() {
@@ -27,13 +22,8 @@
#extension GL_AMD_gpu_shader_half_float : require
precision mediump float;
-f16vec3 tint_radians(f16vec3 param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_7ea4c7() {
- f16vec3 res = tint_radians(f16vec3(1.0hf));
+ f16vec3 res = f16vec3(0.017440796hf);
}
void fragment_main() {
@@ -47,13 +37,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec3 tint_radians(f16vec3 param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_7ea4c7() {
- f16vec3 res = tint_radians(f16vec3(1.0hf));
+ f16vec3 res = f16vec3(0.017440796hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.msl
index a8f0e1f..59edb2a 100644
--- a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-half3 tint_radians(half3 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_7ea4c7() {
- half3 res = tint_radians(half3(1.0h));
+ half3 res = half3(0.017440796h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.spvasm
index 3253f44..0d5b8b8 100644
--- a/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/radians/7ea4c7.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,38 +36,37 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
-%half_0x1p_0 = OpConstant %half 0x1p+0
- %18 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
+%half_0x1_1dcpn6 = OpConstant %half 0x1.1dcp-6
+ %16 = OpConstantComposite %v3half %half_0x1_1dcpn6 %half_0x1_1dcpn6 %half_0x1_1dcpn6
%_ptr_Function_v3half = OpTypePointer Function %v3half
- %21 = OpConstantNull %v3half
- %22 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v3half
+ %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%radians_7ea4c7 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v3half Function %21
- %13 = OpExtInst %v3half %16 Radians %18
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v3half Function %19
+ OpStore %res %16
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %22
- %24 = OpLabel
- %25 = OpFunctionCall %void %radians_7ea4c7
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %radians_7ea4c7
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %27 = OpLabel
- %28 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %28
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %radians_7ea4c7
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %radians_7ea4c7
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %radians_7ea4c7
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %radians_7ea4c7
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/bff231.wgsl b/test/tint/builtins/gen/literal/radians/bff231.wgsl
new file mode 100644
index 0000000..1b2cd48
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/bff231.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 radians(fa) -> fa
+fn radians_bff231() {
+ var res = radians(1.);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_bff231();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_bff231();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_bff231();
+}
diff --git a/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..cde7b14
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void radians_bff231() {
+ float res = 0.017453292f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_bff231();
+ 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() {
+ radians_bff231();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_bff231();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..cde7b14
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void radians_bff231() {
+ float res = 0.017453292f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_bff231();
+ 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() {
+ radians_bff231();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_bff231();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.glsl
new file mode 100644
index 0000000..a445da1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void radians_bff231() {
+ float res = 0.017453292f;
+}
+
+vec4 vertex_main() {
+ radians_bff231();
+ 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 radians_bff231() {
+ float res = 0.017453292f;
+}
+
+void fragment_main() {
+ radians_bff231();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void radians_bff231() {
+ float res = 0.017453292f;
+}
+
+void compute_main() {
+ radians_bff231();
+}
+
+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/radians/bff231.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.msl
new file mode 100644
index 0000000..ddd3b6e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void radians_bff231() {
+ float res = 0.017453292f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_bff231();
+ 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() {
+ radians_bff231();
+ return;
+}
+
+kernel void compute_main() {
+ radians_bff231();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.spvasm
new file mode 100644
index 0000000..0a3316a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/bff231.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 %radians_bff231 "radians_bff231"
+ 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_0174532924 = OpConstant %float 0.0174532924
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_bff231 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_0_0174532924
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %radians_bff231
+ 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 %radians_bff231
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %radians_bff231
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.wgsl
new file mode 100644
index 0000000..c5e31e7
--- /dev/null
+++ b/test/tint/builtins/gen/literal/radians/bff231.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn radians_bff231() {
+ var res = radians(1.0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_bff231();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_bff231();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_bff231();
+}
diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.dxc.hlsl
index 3ca2a80..92aca96 100644
--- a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-float3 tint_radians(float3 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_f96258() {
- float3 res = tint_radians((1.0f).xxx);
+ float3 res = (0.017453292f).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.fxc.hlsl
index 3ca2a80..92aca96 100644
--- a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.fxc.hlsl
@@ -1,9 +1,5 @@
-float3 tint_radians(float3 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_f96258() {
- float3 res = tint_radians((1.0f).xxx);
+ float3 res = (0.017453292f).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.glsl
index aaab3fe..7f15f68 100644
--- a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.glsl
@@ -1,12 +1,7 @@
#version 310 es
-vec3 tint_radians(vec3 param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_f96258() {
- vec3 res = tint_radians(vec3(1.0f));
+ vec3 res = vec3(0.017453292f);
}
vec4 vertex_main() {
@@ -25,13 +20,8 @@
#version 310 es
precision mediump float;
-vec3 tint_radians(vec3 param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_f96258() {
- vec3 res = tint_radians(vec3(1.0f));
+ vec3 res = vec3(0.017453292f);
}
void fragment_main() {
@@ -44,13 +34,8 @@
}
#version 310 es
-vec3 tint_radians(vec3 param_0) {
- return param_0 * 0.017453292519943295474f;
-}
-
-
void radians_f96258() {
- vec3 res = tint_radians(vec3(1.0f));
+ vec3 res = vec3(0.017453292f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.msl
index cae23f4..3ce84b4 100644
--- a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-float3 tint_radians(float3 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_f96258() {
- float3 res = tint_radians(float3(1.0f));
+ float3 res = float3(0.017453292f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.spvasm
index ef337f4..0178859 100644
--- a/test/tint/builtins/gen/literal/radians/f96258.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/radians/f96258.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_0174532924 = OpConstant %float 0.0174532924
+ %15 = OpConstantComposite %v3float %float_0_0174532924 %float_0_0174532924 %float_0_0174532924
%_ptr_Function_v3float = OpTypePointer Function %v3float
- %20 = OpConstantNull %v3float
- %21 = OpTypeFunction %v4float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
%radians_f96258 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v3float Function %20
- %13 = OpExtInst %v3float %15 Radians %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 %radians_f96258
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %radians_f96258
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 %radians_f96258
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %radians_f96258
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %radians_f96258
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %radians_f96258
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.dxc.hlsl
index 77ad4e4..4ed51a0 100644
--- a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.dxc.hlsl
@@ -1,9 +1,5 @@
-vector<float16_t, 2> tint_radians(vector<float16_t, 2> param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_fbacf0() {
- vector<float16_t, 2> res = tint_radians((float16_t(1.0h)).xx);
+ vector<float16_t, 2> res = (float16_t(0.017440796h)).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.glsl
index 2d748f9..263666e 100644
--- a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.glsl
@@ -1,13 +1,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec2 tint_radians(f16vec2 param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_fbacf0() {
- f16vec2 res = tint_radians(f16vec2(1.0hf));
+ f16vec2 res = f16vec2(0.017440796hf);
}
vec4 vertex_main() {
@@ -27,13 +22,8 @@
#extension GL_AMD_gpu_shader_half_float : require
precision mediump float;
-f16vec2 tint_radians(f16vec2 param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_fbacf0() {
- f16vec2 res = tint_radians(f16vec2(1.0hf));
+ f16vec2 res = f16vec2(0.017440796hf);
}
void fragment_main() {
@@ -47,13 +37,8 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-f16vec2 tint_radians(f16vec2 param_0) {
- return param_0 * 0.017453292519943295474hf;
-}
-
-
void radians_fbacf0() {
- f16vec2 res = tint_radians(f16vec2(1.0hf));
+ f16vec2 res = f16vec2(0.017440796hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.msl b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.msl
index ca066a6..d462d32 100644
--- a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.msl
@@ -1,13 +1,8 @@
#include <metal_stdlib>
using namespace metal;
-
-half2 tint_radians(half2 param_0) {
- return param_0 * 0.017453292519943295474;
-}
-
void radians_fbacf0() {
- half2 res = tint_radians(half2(1.0h));
+ half2 res = half2(0.017440796h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.spvasm
index 3fe420d..be6dede 100644
--- a/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/radians/fbacf0.wgsl.expected.spvasm
@@ -1,14 +1,13 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 36
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
OpCapability StorageInputOutput16
- %16 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -37,38 +36,37 @@
%9 = OpTypeFunction %void
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
-%half_0x1p_0 = OpConstant %half 0x1p+0
- %18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
+%half_0x1_1dcpn6 = OpConstant %half 0x1.1dcp-6
+ %16 = OpConstantComposite %v2half %half_0x1_1dcpn6 %half_0x1_1dcpn6
%_ptr_Function_v2half = OpTypePointer Function %v2half
- %21 = OpConstantNull %v2half
- %22 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v2half
+ %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%radians_fbacf0 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v2half Function %21
- %13 = OpExtInst %v2half %16 Radians %18
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_v2half Function %19
+ OpStore %res %16
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %22
- %24 = OpLabel
- %25 = OpFunctionCall %void %radians_fbacf0
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %radians_fbacf0
OpReturnValue %5
OpFunctionEnd
%vertex_main = OpFunction %void None %9
- %27 = OpLabel
- %28 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %28
+ %25 = OpLabel
+ %26 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %26
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %31 = OpLabel
- %32 = OpFunctionCall %void %radians_fbacf0
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %radians_fbacf0
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %radians_fbacf0
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %radians_fbacf0
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/degrees/810467.wgsl b/test/tint/builtins/gen/var/degrees/810467.wgsl
new file mode 100644
index 0000000..96858d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/810467.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 degrees(vec<2, fa>) -> vec<2, fa>
+fn degrees_810467() {
+ const arg_0 = vec2(1.);
+ var res = degrees(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_810467();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_810467();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_810467();
+}
diff --git a/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..eb0415d
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_810467() {
+ float2 res = (57.295780182f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_810467();
+ 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() {
+ degrees_810467();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_810467();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..eb0415d
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_810467() {
+ float2 res = (57.295780182f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_810467();
+ 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() {
+ degrees_810467();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_810467();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.glsl
new file mode 100644
index 0000000..cee6770
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void degrees_810467() {
+ vec2 res = vec2(57.295780182f);
+}
+
+vec4 vertex_main() {
+ degrees_810467();
+ 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 degrees_810467() {
+ vec2 res = vec2(57.295780182f);
+}
+
+void fragment_main() {
+ degrees_810467();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void degrees_810467() {
+ vec2 res = vec2(57.295780182f);
+}
+
+void compute_main() {
+ degrees_810467();
+}
+
+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/degrees/810467.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.msl
new file mode 100644
index 0000000..26fdf6d
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void degrees_810467() {
+ float2 res = float2(57.295780182f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_810467();
+ 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() {
+ degrees_810467();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_810467();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.spvasm
new file mode 100644
index 0000000..2f16f05
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/810467.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 %degrees_810467 "degrees_810467"
+ 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_57_2957802 = OpConstant %float 57.2957802
+ %15 = OpConstantComposite %v2float %float_57_2957802 %float_57_2957802
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_810467 = 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 %degrees_810467
+ 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 %degrees_810467
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %degrees_810467
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.wgsl
new file mode 100644
index 0000000..a028b3d
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/810467.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn degrees_810467() {
+ const arg_0 = vec2(1.0);
+ var res = degrees(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_810467();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_810467();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_810467();
+}
diff --git a/test/tint/builtins/gen/var/degrees/c0880c.wgsl b/test/tint/builtins/gen/var/degrees/c0880c.wgsl
new file mode 100644
index 0000000..708f776
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/c0880c.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 degrees(vec<3, fa>) -> vec<3, fa>
+fn degrees_c0880c() {
+ const arg_0 = vec3(1.);
+ var res = degrees(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_c0880c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_c0880c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_c0880c();
+}
diff --git a/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..78013a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_c0880c() {
+ float3 res = (57.295780182f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_c0880c();
+ 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() {
+ degrees_c0880c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_c0880c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..78013a9
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_c0880c() {
+ float3 res = (57.295780182f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_c0880c();
+ 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() {
+ degrees_c0880c();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_c0880c();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.glsl
new file mode 100644
index 0000000..ad03188
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void degrees_c0880c() {
+ vec3 res = vec3(57.295780182f);
+}
+
+vec4 vertex_main() {
+ degrees_c0880c();
+ 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 degrees_c0880c() {
+ vec3 res = vec3(57.295780182f);
+}
+
+void fragment_main() {
+ degrees_c0880c();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void degrees_c0880c() {
+ vec3 res = vec3(57.295780182f);
+}
+
+void compute_main() {
+ degrees_c0880c();
+}
+
+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/degrees/c0880c.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.msl
new file mode 100644
index 0000000..4b019e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void degrees_c0880c() {
+ float3 res = float3(57.295780182f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_c0880c();
+ 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() {
+ degrees_c0880c();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_c0880c();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.spvasm
new file mode 100644
index 0000000..7fe5c73
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/c0880c.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 %degrees_c0880c "degrees_c0880c"
+ 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_57_2957802 = OpConstant %float 57.2957802
+ %15 = OpConstantComposite %v3float %float_57_2957802 %float_57_2957802 %float_57_2957802
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_c0880c = 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 %degrees_c0880c
+ 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 %degrees_c0880c
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %degrees_c0880c
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.wgsl
new file mode 100644
index 0000000..0f6b91d
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/c0880c.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn degrees_c0880c() {
+ const arg_0 = vec3(1.0);
+ var res = degrees(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_c0880c();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_c0880c();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_c0880c();
+}
diff --git a/test/tint/builtins/gen/var/degrees/d43a49.wgsl b/test/tint/builtins/gen/var/degrees/d43a49.wgsl
new file mode 100644
index 0000000..3184f24
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/d43a49.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 degrees(vec<4, fa>) -> vec<4, fa>
+fn degrees_d43a49() {
+ const arg_0 = vec4(1.);
+ var res = degrees(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_d43a49();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_d43a49();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_d43a49();
+}
diff --git a/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..0ea5685
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_d43a49() {
+ float4 res = (57.295780182f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_d43a49();
+ 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() {
+ degrees_d43a49();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_d43a49();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..0ea5685
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_d43a49() {
+ float4 res = (57.295780182f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_d43a49();
+ 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() {
+ degrees_d43a49();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_d43a49();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.glsl
new file mode 100644
index 0000000..893f790
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void degrees_d43a49() {
+ vec4 res = vec4(57.295780182f);
+}
+
+vec4 vertex_main() {
+ degrees_d43a49();
+ 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 degrees_d43a49() {
+ vec4 res = vec4(57.295780182f);
+}
+
+void fragment_main() {
+ degrees_d43a49();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void degrees_d43a49() {
+ vec4 res = vec4(57.295780182f);
+}
+
+void compute_main() {
+ degrees_d43a49();
+}
+
+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/degrees/d43a49.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.msl
new file mode 100644
index 0000000..adddeb0
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void degrees_d43a49() {
+ float4 res = float4(57.295780182f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_d43a49();
+ 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() {
+ degrees_d43a49();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_d43a49();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.spvasm
new file mode 100644
index 0000000..d0ca406
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/d43a49.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 %degrees_d43a49 "degrees_d43a49"
+ 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_57_2957802 = OpConstant %float 57.2957802
+ %14 = OpConstantComposite %v4float %float_57_2957802 %float_57_2957802 %float_57_2957802 %float_57_2957802
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_d43a49 = 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 %degrees_d43a49
+ 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 %degrees_d43a49
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %degrees_d43a49
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.wgsl
new file mode 100644
index 0000000..0fdb2e9
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/d43a49.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn degrees_d43a49() {
+ const arg_0 = vec4(1.0);
+ var res = degrees(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_d43a49();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_d43a49();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_d43a49();
+}
diff --git a/test/tint/builtins/gen/var/degrees/fafa7e.wgsl b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl
new file mode 100644
index 0000000..f1adddc
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/fafa7e.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 degrees(fa) -> fa
+fn degrees_fafa7e() {
+ const arg_0 = 1.;
+ var res = degrees(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_fafa7e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_fafa7e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_fafa7e();
+}
diff --git a/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a11be10
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_fafa7e();
+ 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() {
+ degrees_fafa7e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_fafa7e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a11be10
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ degrees_fafa7e();
+ 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() {
+ degrees_fafa7e();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ degrees_fafa7e();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.glsl b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.glsl
new file mode 100644
index 0000000..4572eb3
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+vec4 vertex_main() {
+ degrees_fafa7e();
+ 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 degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+void fragment_main() {
+ degrees_fafa7e();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+void compute_main() {
+ degrees_fafa7e();
+}
+
+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/degrees/fafa7e.wgsl.expected.msl b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.msl
new file mode 100644
index 0000000..770b0ab
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void degrees_fafa7e() {
+ float res = 57.295780182f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ degrees_fafa7e();
+ 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() {
+ degrees_fafa7e();
+ return;
+}
+
+kernel void compute_main() {
+ degrees_fafa7e();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.spvasm
new file mode 100644
index 0000000..e3e9810
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/fafa7e.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 %degrees_fafa7e "degrees_fafa7e"
+ 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_57_2957802 = OpConstant %float 57.2957802
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%degrees_fafa7e = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_57_2957802
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %degrees_fafa7e
+ 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 %degrees_fafa7e
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %degrees_fafa7e
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.wgsl b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.wgsl
new file mode 100644
index 0000000..1651ee1
--- /dev/null
+++ b/test/tint/builtins/gen/var/degrees/fafa7e.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn degrees_fafa7e() {
+ const arg_0 = 1.0;
+ var res = degrees(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ degrees_fafa7e();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ degrees_fafa7e();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ degrees_fafa7e();
+}
diff --git a/test/tint/builtins/gen/var/radians/379214.wgsl b/test/tint/builtins/gen/var/radians/379214.wgsl
new file mode 100644
index 0000000..23569e7
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/379214.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 radians(vec<3, fa>) -> vec<3, fa>
+fn radians_379214() {
+ const arg_0 = vec3(1.);
+ var res = radians(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_379214();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_379214();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_379214();
+}
diff --git a/test/tint/builtins/gen/var/radians/379214.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..247db1d
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void radians_379214() {
+ float3 res = (0.017453292f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_379214();
+ 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() {
+ radians_379214();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_379214();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/379214.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..247db1d
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void radians_379214() {
+ float3 res = (0.017453292f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_379214();
+ 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() {
+ radians_379214();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_379214();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/379214.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.glsl
new file mode 100644
index 0000000..5593c1d
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void radians_379214() {
+ vec3 res = vec3(0.017453292f);
+}
+
+vec4 vertex_main() {
+ radians_379214();
+ 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 radians_379214() {
+ vec3 res = vec3(0.017453292f);
+}
+
+void fragment_main() {
+ radians_379214();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void radians_379214() {
+ vec3 res = vec3(0.017453292f);
+}
+
+void compute_main() {
+ radians_379214();
+}
+
+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/radians/379214.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.msl
new file mode 100644
index 0000000..638763a
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void radians_379214() {
+ float3 res = float3(0.017453292f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_379214();
+ 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() {
+ radians_379214();
+ return;
+}
+
+kernel void compute_main() {
+ radians_379214();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/radians/379214.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.spvasm
new file mode 100644
index 0000000..ec9360a
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/379214.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 %radians_379214 "radians_379214"
+ 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_0174532924 = OpConstant %float 0.0174532924
+ %15 = OpConstantComposite %v3float %float_0_0174532924 %float_0_0174532924 %float_0_0174532924
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_379214 = 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 %radians_379214
+ 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 %radians_379214
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %radians_379214
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/radians/379214.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.wgsl
new file mode 100644
index 0000000..19821f0
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/379214.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn radians_379214() {
+ const arg_0 = vec3(1.0);
+ var res = radians(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_379214();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_379214();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_379214();
+}
diff --git a/test/tint/builtins/gen/var/radians/44a9f8.wgsl b/test/tint/builtins/gen/var/radians/44a9f8.wgsl
new file mode 100644
index 0000000..4f64479
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/44a9f8.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 radians(vec<2, fa>) -> vec<2, fa>
+fn radians_44a9f8() {
+ const arg_0 = vec2(1.);
+ var res = radians(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_44a9f8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_44a9f8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_44a9f8();
+}
diff --git a/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..cb67c5d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void radians_44a9f8() {
+ float2 res = (0.017453292f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_44a9f8();
+ 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() {
+ radians_44a9f8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_44a9f8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..cb67c5d9
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void radians_44a9f8() {
+ float2 res = (0.017453292f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_44a9f8();
+ 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() {
+ radians_44a9f8();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_44a9f8();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.glsl
new file mode 100644
index 0000000..6caa601
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void radians_44a9f8() {
+ vec2 res = vec2(0.017453292f);
+}
+
+vec4 vertex_main() {
+ radians_44a9f8();
+ 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 radians_44a9f8() {
+ vec2 res = vec2(0.017453292f);
+}
+
+void fragment_main() {
+ radians_44a9f8();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void radians_44a9f8() {
+ vec2 res = vec2(0.017453292f);
+}
+
+void compute_main() {
+ radians_44a9f8();
+}
+
+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/radians/44a9f8.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.msl
new file mode 100644
index 0000000..fea0149
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void radians_44a9f8() {
+ float2 res = float2(0.017453292f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_44a9f8();
+ 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() {
+ radians_44a9f8();
+ return;
+}
+
+kernel void compute_main() {
+ radians_44a9f8();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.spvasm
new file mode 100644
index 0000000..4e135fc
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/44a9f8.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 %radians_44a9f8 "radians_44a9f8"
+ 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_0174532924 = OpConstant %float 0.0174532924
+ %15 = OpConstantComposite %v2float %float_0_0174532924 %float_0_0174532924
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_44a9f8 = 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 %radians_44a9f8
+ 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 %radians_44a9f8
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %31 = OpLabel
+ %32 = OpFunctionCall %void %radians_44a9f8
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.wgsl
new file mode 100644
index 0000000..bd1268d
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/44a9f8.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn radians_44a9f8() {
+ const arg_0 = vec2(1.0);
+ var res = radians(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_44a9f8();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_44a9f8();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_44a9f8();
+}
diff --git a/test/tint/builtins/gen/var/radians/524a91.wgsl b/test/tint/builtins/gen/var/radians/524a91.wgsl
new file mode 100644
index 0000000..0b217c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/524a91.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 radians(vec<4, fa>) -> vec<4, fa>
+fn radians_524a91() {
+ const arg_0 = vec4(1.);
+ var res = radians(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_524a91();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_524a91();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_524a91();
+}
diff --git a/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..b3e2192
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void radians_524a91() {
+ float4 res = (0.017453292f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_524a91();
+ 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() {
+ radians_524a91();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_524a91();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..b3e2192
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void radians_524a91() {
+ float4 res = (0.017453292f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_524a91();
+ 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() {
+ radians_524a91();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_524a91();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.glsl
new file mode 100644
index 0000000..fd1508e
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void radians_524a91() {
+ vec4 res = vec4(0.017453292f);
+}
+
+vec4 vertex_main() {
+ radians_524a91();
+ 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 radians_524a91() {
+ vec4 res = vec4(0.017453292f);
+}
+
+void fragment_main() {
+ radians_524a91();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void radians_524a91() {
+ vec4 res = vec4(0.017453292f);
+}
+
+void compute_main() {
+ radians_524a91();
+}
+
+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/radians/524a91.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.msl
new file mode 100644
index 0000000..fa539e0
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void radians_524a91() {
+ float4 res = float4(0.017453292f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_524a91();
+ 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() {
+ radians_524a91();
+ return;
+}
+
+kernel void compute_main() {
+ radians_524a91();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.spvasm
new file mode 100644
index 0000000..a9c1edf
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/524a91.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 %radians_524a91 "radians_524a91"
+ 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_0174532924 = OpConstant %float 0.0174532924
+ %14 = OpConstantComposite %v4float %float_0_0174532924 %float_0_0174532924 %float_0_0174532924 %float_0_0174532924
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_524a91 = 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 %radians_524a91
+ 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 %radians_524a91
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %radians_524a91
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.wgsl
new file mode 100644
index 0000000..ac6ced2
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/524a91.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn radians_524a91() {
+ const arg_0 = vec4(1.0);
+ var res = radians(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_524a91();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_524a91();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_524a91();
+}
diff --git a/test/tint/builtins/gen/var/radians/bff231.wgsl b/test/tint/builtins/gen/var/radians/bff231.wgsl
new file mode 100644
index 0000000..a38f95f
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/bff231.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 radians(fa) -> fa
+fn radians_bff231() {
+ const arg_0 = 1.;
+ var res = radians(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_bff231();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_bff231();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_bff231();
+}
diff --git a/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..cde7b14
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void radians_bff231() {
+ float res = 0.017453292f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_bff231();
+ 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() {
+ radians_bff231();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_bff231();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..cde7b14
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void radians_bff231() {
+ float res = 0.017453292f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ radians_bff231();
+ 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() {
+ radians_bff231();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ radians_bff231();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.glsl b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.glsl
new file mode 100644
index 0000000..a445da1
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void radians_bff231() {
+ float res = 0.017453292f;
+}
+
+vec4 vertex_main() {
+ radians_bff231();
+ 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 radians_bff231() {
+ float res = 0.017453292f;
+}
+
+void fragment_main() {
+ radians_bff231();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void radians_bff231() {
+ float res = 0.017453292f;
+}
+
+void compute_main() {
+ radians_bff231();
+}
+
+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/radians/bff231.wgsl.expected.msl b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.msl
new file mode 100644
index 0000000..ddd3b6e
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void radians_bff231() {
+ float res = 0.017453292f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ radians_bff231();
+ 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() {
+ radians_bff231();
+ return;
+}
+
+kernel void compute_main() {
+ radians_bff231();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.spvasm b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.spvasm
new file mode 100644
index 0000000..0a3316a
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/bff231.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 %radians_bff231 "radians_bff231"
+ 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_0174532924 = OpConstant %float 0.0174532924
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+ %float_1 = OpConstant %float 1
+%radians_bff231 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_0_0174532924
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %radians_bff231
+ 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 %radians_bff231
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %radians_bff231
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.wgsl b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.wgsl
new file mode 100644
index 0000000..127e23d
--- /dev/null
+++ b/test/tint/builtins/gen/var/radians/bff231.wgsl.expected.wgsl
@@ -0,0 +1,20 @@
+fn radians_bff231() {
+ const arg_0 = 1.0;
+ var res = radians(arg_0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ radians_bff231();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ radians_bff231();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ radians_bff231();
+}
diff --git a/test/tint/builtins/repeated_use.wgsl b/test/tint/builtins/repeated_use.wgsl
index f1f1f0f..f6391a3 100644
--- a/test/tint/builtins/repeated_use.wgsl
+++ b/test/tint/builtins/repeated_use.wgsl
@@ -2,19 +2,31 @@
// same builtin overload results in single helper being generated.
@compute @workgroup_size(1)
fn main() {
- let a = degrees(vec4<f32>());
- let b = degrees(vec4<f32>(1.));
- let c = degrees(vec4<f32>(1., 2., 3., 4.));
+ let va = vec4<f32>();
+ let a = degrees(va);
+ let vb = vec4<f32>(1.);
+ let b = degrees(vb);
+ let vc = vec4<f32>(1., 2., 3., 4.);
+ let c = degrees(vc);
- let d = degrees(vec3<f32>());
- let e = degrees(vec3<f32>(1.));
- let f = degrees(vec3<f32>(1., 2., 3.));
+ let vd = vec3<f32>();
+ let d = degrees(vd);
+ let ve = vec3<f32>(1.);
+ let e = degrees(ve);
+ let vf = vec3<f32>(1., 2., 3.);
+ let f = degrees(vf);
- let g = degrees(vec2<f32>());
- let h = degrees(vec2<f32>(1.));
- let i = degrees(vec2<f32>(1., 2.));
+ let vg = vec2<f32>();
+ let g = degrees(vg);
+ let vh = vec2<f32>(1.);
+ let h = degrees(vh);
+ let vi = vec2<f32>(1., 2.);
+ let i = degrees(vi);
- let j = degrees(1.);
- let k = degrees(2.);
- let l = degrees(3.);
+ let vj = 1.;
+ let j = degrees(vj);
+ let vk = 2.;
+ let k = degrees(vk);
+ let vl = 3.;
+ let l = degrees(vl);
}
diff --git a/test/tint/builtins/repeated_use.wgsl.expected.dxc.hlsl b/test/tint/builtins/repeated_use.wgsl.expected.dxc.hlsl
index bbf29d1..5d53231 100644
--- a/test/tint/builtins/repeated_use.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/repeated_use.wgsl.expected.dxc.hlsl
@@ -16,17 +16,29 @@
[numthreads(1, 1, 1)]
void main() {
- const float4 a = tint_degrees((0.0f).xxxx);
- const float4 b = tint_degrees((1.0f).xxxx);
- const float4 c = tint_degrees(float4(1.0f, 2.0f, 3.0f, 4.0f));
- const float3 d = tint_degrees_1((0.0f).xxx);
- const float3 e = tint_degrees_1((1.0f).xxx);
- const float3 f = tint_degrees_1(float3(1.0f, 2.0f, 3.0f));
- const float2 g = tint_degrees_2((0.0f).xx);
- const float2 h = tint_degrees_2((1.0f).xx);
- const float2 i = tint_degrees_2(float2(1.0f, 2.0f));
- const float j = tint_degrees_3(1.0f);
- const float k = tint_degrees_3(2.0f);
- const float l = tint_degrees_3(3.0f);
+ const float4 va = (0.0f).xxxx;
+ const float4 a = tint_degrees(va);
+ const float4 vb = (1.0f).xxxx;
+ const float4 b = tint_degrees(vb);
+ const float4 vc = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 c = tint_degrees(vc);
+ const float3 vd = (0.0f).xxx;
+ const float3 d = tint_degrees_1(vd);
+ const float3 ve = (1.0f).xxx;
+ const float3 e = tint_degrees_1(ve);
+ const float3 vf = float3(1.0f, 2.0f, 3.0f);
+ const float3 f = tint_degrees_1(vf);
+ const float2 vg = (0.0f).xx;
+ const float2 g = tint_degrees_2(vg);
+ const float2 vh = (1.0f).xx;
+ const float2 h = tint_degrees_2(vh);
+ const float2 vi = float2(1.0f, 2.0f);
+ const float2 i = tint_degrees_2(vi);
+ const float vj = 1.0f;
+ const float j = tint_degrees_3(vj);
+ const float vk = 2.0f;
+ const float k = tint_degrees_3(vk);
+ const float vl = 3.0f;
+ const float l = tint_degrees_3(vl);
return;
}
diff --git a/test/tint/builtins/repeated_use.wgsl.expected.fxc.hlsl b/test/tint/builtins/repeated_use.wgsl.expected.fxc.hlsl
index bbf29d1..5d53231 100644
--- a/test/tint/builtins/repeated_use.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/repeated_use.wgsl.expected.fxc.hlsl
@@ -16,17 +16,29 @@
[numthreads(1, 1, 1)]
void main() {
- const float4 a = tint_degrees((0.0f).xxxx);
- const float4 b = tint_degrees((1.0f).xxxx);
- const float4 c = tint_degrees(float4(1.0f, 2.0f, 3.0f, 4.0f));
- const float3 d = tint_degrees_1((0.0f).xxx);
- const float3 e = tint_degrees_1((1.0f).xxx);
- const float3 f = tint_degrees_1(float3(1.0f, 2.0f, 3.0f));
- const float2 g = tint_degrees_2((0.0f).xx);
- const float2 h = tint_degrees_2((1.0f).xx);
- const float2 i = tint_degrees_2(float2(1.0f, 2.0f));
- const float j = tint_degrees_3(1.0f);
- const float k = tint_degrees_3(2.0f);
- const float l = tint_degrees_3(3.0f);
+ const float4 va = (0.0f).xxxx;
+ const float4 a = tint_degrees(va);
+ const float4 vb = (1.0f).xxxx;
+ const float4 b = tint_degrees(vb);
+ const float4 vc = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ const float4 c = tint_degrees(vc);
+ const float3 vd = (0.0f).xxx;
+ const float3 d = tint_degrees_1(vd);
+ const float3 ve = (1.0f).xxx;
+ const float3 e = tint_degrees_1(ve);
+ const float3 vf = float3(1.0f, 2.0f, 3.0f);
+ const float3 f = tint_degrees_1(vf);
+ const float2 vg = (0.0f).xx;
+ const float2 g = tint_degrees_2(vg);
+ const float2 vh = (1.0f).xx;
+ const float2 h = tint_degrees_2(vh);
+ const float2 vi = float2(1.0f, 2.0f);
+ const float2 i = tint_degrees_2(vi);
+ const float vj = 1.0f;
+ const float j = tint_degrees_3(vj);
+ const float vk = 2.0f;
+ const float k = tint_degrees_3(vk);
+ const float vl = 3.0f;
+ const float l = tint_degrees_3(vl);
return;
}
diff --git a/test/tint/builtins/repeated_use.wgsl.expected.glsl b/test/tint/builtins/repeated_use.wgsl.expected.glsl
index fdd29e0..c40ba04 100644
--- a/test/tint/builtins/repeated_use.wgsl.expected.glsl
+++ b/test/tint/builtins/repeated_use.wgsl.expected.glsl
@@ -18,18 +18,30 @@
void tint_symbol() {
- vec4 a = tint_degrees(vec4(0.0f));
- vec4 b = tint_degrees(vec4(1.0f));
- vec4 c = tint_degrees(vec4(1.0f, 2.0f, 3.0f, 4.0f));
- vec3 d = tint_degrees_1(vec3(0.0f));
- vec3 e = tint_degrees_1(vec3(1.0f));
- vec3 f = tint_degrees_1(vec3(1.0f, 2.0f, 3.0f));
- vec2 g = tint_degrees_2(vec2(0.0f));
- vec2 h = tint_degrees_2(vec2(1.0f));
- vec2 i = tint_degrees_2(vec2(1.0f, 2.0f));
- float j = tint_degrees_3(1.0f);
- float k = tint_degrees_3(2.0f);
- float l = tint_degrees_3(3.0f);
+ vec4 va = vec4(0.0f);
+ vec4 a = tint_degrees(va);
+ vec4 vb = vec4(1.0f);
+ vec4 b = tint_degrees(vb);
+ vec4 vc = vec4(1.0f, 2.0f, 3.0f, 4.0f);
+ vec4 c = tint_degrees(vc);
+ vec3 vd = vec3(0.0f);
+ vec3 d = tint_degrees_1(vd);
+ vec3 ve = vec3(1.0f);
+ vec3 e = tint_degrees_1(ve);
+ vec3 vf = vec3(1.0f, 2.0f, 3.0f);
+ vec3 f = tint_degrees_1(vf);
+ vec2 vg = vec2(0.0f);
+ vec2 g = tint_degrees_2(vg);
+ vec2 vh = vec2(1.0f);
+ vec2 h = tint_degrees_2(vh);
+ vec2 vi = vec2(1.0f, 2.0f);
+ vec2 i = tint_degrees_2(vi);
+ float vj = 1.0f;
+ float j = tint_degrees_3(vj);
+ float vk = 2.0f;
+ float k = tint_degrees_3(vk);
+ float vl = 3.0f;
+ float l = tint_degrees_3(vl);
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/builtins/repeated_use.wgsl.expected.msl b/test/tint/builtins/repeated_use.wgsl.expected.msl
index c0ea4a3..03ffb6a 100644
--- a/test/tint/builtins/repeated_use.wgsl.expected.msl
+++ b/test/tint/builtins/repeated_use.wgsl.expected.msl
@@ -19,18 +19,30 @@
}
kernel void tint_symbol() {
- float4 const a = tint_degrees(float4(0.0f));
- float4 const b = tint_degrees(float4(1.0f));
- float4 const c = tint_degrees(float4(1.0f, 2.0f, 3.0f, 4.0f));
- float3 const d = tint_degrees_1(float3(0.0f));
- float3 const e = tint_degrees_1(float3(1.0f));
- float3 const f = tint_degrees_1(float3(1.0f, 2.0f, 3.0f));
- float2 const g = tint_degrees_2(float2(0.0f));
- float2 const h = tint_degrees_2(float2(1.0f));
- float2 const i = tint_degrees_2(float2(1.0f, 2.0f));
- float const j = tint_degrees_3(1.0f);
- float const k = tint_degrees_3(2.0f);
- float const l = tint_degrees_3(3.0f);
+ float4 const va = float4(0.0f);
+ float4 const a = tint_degrees(va);
+ float4 const vb = float4(1.0f);
+ float4 const b = tint_degrees(vb);
+ float4 const vc = float4(1.0f, 2.0f, 3.0f, 4.0f);
+ float4 const c = tint_degrees(vc);
+ float3 const vd = float3(0.0f);
+ float3 const d = tint_degrees_1(vd);
+ float3 const ve = float3(1.0f);
+ float3 const e = tint_degrees_1(ve);
+ float3 const vf = float3(1.0f, 2.0f, 3.0f);
+ float3 const f = tint_degrees_1(vf);
+ float2 const vg = float2(0.0f);
+ float2 const g = tint_degrees_2(vg);
+ float2 const vh = float2(1.0f);
+ float2 const h = tint_degrees_2(vh);
+ float2 const vi = float2(1.0f, 2.0f);
+ float2 const i = tint_degrees_2(vi);
+ float const vj = 1.0f;
+ float const j = tint_degrees_3(vj);
+ float const vk = 2.0f;
+ float const k = tint_degrees_3(vk);
+ float const vl = 3.0f;
+ float const l = tint_degrees_3(vl);
return;
}
diff --git a/test/tint/builtins/repeated_use.wgsl.expected.spvasm b/test/tint/builtins/repeated_use.wgsl.expected.spvasm
index 085ef9d..3ef3047 100644
--- a/test/tint/builtins/repeated_use.wgsl.expected.spvasm
+++ b/test/tint/builtins/repeated_use.wgsl.expected.spvasm
@@ -4,7 +4,7 @@
; Bound: 35
; Schema: 0
OpCapability Shader
- %8 = OpExtInstImport "GLSL.std.450"
+ %9 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %main "main"
OpExecutionMode %main LocalSize 1 1 1
@@ -13,34 +13,34 @@
%1 = OpTypeFunction %void
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
- %9 = OpConstantNull %v4float
+ %7 = OpConstantNull %v4float
%float_1 = OpConstant %float 1
- %12 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+ %11 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%float_2 = OpConstant %float 2
%float_3 = OpConstant %float 3
%float_4 = OpConstant %float 4
- %17 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
+ %16 = OpConstantComposite %v4float %float_1 %float_2 %float_3 %float_4
%v3float = OpTypeVector %float 3
- %20 = OpConstantNull %v3float
- %22 = OpConstantComposite %v3float %float_1 %float_1 %float_1
- %24 = OpConstantComposite %v3float %float_1 %float_2 %float_3
+ %19 = OpConstantNull %v3float
+ %21 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+ %23 = OpConstantComposite %v3float %float_1 %float_2 %float_3
%v2float = OpTypeVector %float 2
- %27 = OpConstantNull %v2float
- %29 = OpConstantComposite %v2float %float_1 %float_1
- %31 = OpConstantComposite %v2float %float_1 %float_2
+ %26 = OpConstantNull %v2float
+ %28 = OpConstantComposite %v2float %float_1 %float_1
+ %30 = OpConstantComposite %v2float %float_1 %float_2
%main = OpFunction %void None %1
%4 = OpLabel
- %5 = OpExtInst %v4float %8 Degrees %9
- %10 = OpExtInst %v4float %8 Degrees %12
- %13 = OpExtInst %v4float %8 Degrees %17
- %18 = OpExtInst %v3float %8 Degrees %20
- %21 = OpExtInst %v3float %8 Degrees %22
- %23 = OpExtInst %v3float %8 Degrees %24
- %25 = OpExtInst %v2float %8 Degrees %27
- %28 = OpExtInst %v2float %8 Degrees %29
- %30 = OpExtInst %v2float %8 Degrees %31
- %32 = OpExtInst %float %8 Degrees %float_1
- %33 = OpExtInst %float %8 Degrees %float_2
- %34 = OpExtInst %float %8 Degrees %float_3
+ %8 = OpExtInst %v4float %9 Degrees %7
+ %12 = OpExtInst %v4float %9 Degrees %11
+ %17 = OpExtInst %v4float %9 Degrees %16
+ %20 = OpExtInst %v3float %9 Degrees %19
+ %22 = OpExtInst %v3float %9 Degrees %21
+ %24 = OpExtInst %v3float %9 Degrees %23
+ %27 = OpExtInst %v2float %9 Degrees %26
+ %29 = OpExtInst %v2float %9 Degrees %28
+ %31 = OpExtInst %v2float %9 Degrees %30
+ %32 = OpExtInst %float %9 Degrees %float_1
+ %33 = OpExtInst %float %9 Degrees %float_2
+ %34 = OpExtInst %float %9 Degrees %float_3
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/repeated_use.wgsl.expected.wgsl b/test/tint/builtins/repeated_use.wgsl.expected.wgsl
index 0af3aa2..d857c10 100644
--- a/test/tint/builtins/repeated_use.wgsl.expected.wgsl
+++ b/test/tint/builtins/repeated_use.wgsl.expected.wgsl
@@ -1,15 +1,27 @@
@compute @workgroup_size(1)
fn main() {
- let a = degrees(vec4<f32>());
- let b = degrees(vec4<f32>(1.0));
- let c = degrees(vec4<f32>(1.0, 2.0, 3.0, 4.0));
- let d = degrees(vec3<f32>());
- let e = degrees(vec3<f32>(1.0));
- let f = degrees(vec3<f32>(1.0, 2.0, 3.0));
- let g = degrees(vec2<f32>());
- let h = degrees(vec2<f32>(1.0));
- let i = degrees(vec2<f32>(1.0, 2.0));
- let j = degrees(1.0);
- let k = degrees(2.0);
- let l = degrees(3.0);
+ let va = vec4<f32>();
+ let a = degrees(va);
+ let vb = vec4<f32>(1.0);
+ let b = degrees(vb);
+ let vc = vec4<f32>(1.0, 2.0, 3.0, 4.0);
+ let c = degrees(vc);
+ let vd = vec3<f32>();
+ let d = degrees(vd);
+ let ve = vec3<f32>(1.0);
+ let e = degrees(ve);
+ let vf = vec3<f32>(1.0, 2.0, 3.0);
+ let f = degrees(vf);
+ let vg = vec2<f32>();
+ let g = degrees(vg);
+ let vh = vec2<f32>(1.0);
+ let h = degrees(vh);
+ let vi = vec2<f32>(1.0, 2.0);
+ let i = degrees(vi);
+ let vj = 1.0;
+ let j = degrees(vj);
+ let vk = 2.0;
+ let k = degrees(vk);
+ let vl = 3.0;
+ let l = degrees(vl);
}