tint: const eval of pow builtin
Bug: tint:1581
Change-Id: I11999f0adbd4b12d362e8f47772ac0a625b8fa68
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113821
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/intrinsics.def b/src/tint/intrinsics.def
index 7e36750..3a2219a 100644
--- a/src/tint/intrinsics.def
+++ b/src/tint/intrinsics.def
@@ -531,8 +531,8 @@
@const fn pack2x16unorm(vec2<f32>) -> u32
@const fn pack4x8snorm(vec4<f32>) -> u32
@const fn pack4x8unorm(vec4<f32>) -> u32
-fn pow<T: f32_f16>(T, T) -> T
-fn pow<N: num, T: f32_f16>(vec<N, T>, vec<N, T>) -> vec<N, T>
+@const fn pow<T: fa_f32_f16>(T, T) -> T
+@const fn pow<N: num, T: fa_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>
@const fn radians<T: fa_f32_f16>(T) -> T
diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc
index 1587ee1..97f8cc4 100644
--- a/src/tint/resolver/const_eval.cc
+++ b/src/tint/resolver/const_eval.cc
@@ -204,10 +204,10 @@
}
template <typename NumberT>
-std::string OverflowExpErrorMessage(std::string_view base, NumberT value) {
+std::string OverflowExpErrorMessage(std::string_view base, NumberT exp) {
std::stringstream ss;
ss << std::setprecision(20);
- ss << base << "^" << value << " cannot be represented as "
+ ss << base << "^" << exp << " cannot be represented as "
<< "'" << FriendlyName<NumberT>() << "'";
return ss.str();
}
@@ -463,6 +463,7 @@
/// CreateElement constructs and returns an Element<T>.
template <typename T>
ImplResult CreateElement(ProgramBuilder& builder, const Source& source, const type::Type* t, T v) {
+ static_assert(IsNumber<T> || std::is_same_v<T, bool>, "T must be a Number or bool");
TINT_ASSERT(Resolver, t->is_scalar());
if constexpr (IsFloatingPoint<T>) {
@@ -3075,6 +3076,23 @@
return CreateElement(builder, source, ty, ret);
}
+ConstEval::Result ConstEval::pow(const type::Type* ty,
+ utils::VectorRef<const sem::Constant*> args,
+ const Source& source) {
+ auto transform = [&](const sem::Constant* c0, const sem::Constant* c1) {
+ auto create = [&](auto e1, auto e2) -> ImplResult {
+ auto r = CheckedPow(e1, e2);
+ if (!r) {
+ AddError(OverflowErrorMessage(e1, "^", e2), source);
+ return utils::Failure;
+ }
+ return CreateElement(builder, source, c0->Type(), *r);
+ };
+ return Dispatch_fa_f32_f16(create, c0, c1);
+ };
+ return TransformElements(builder, ty, transform, args[0], args[1]);
+}
+
ConstEval::Result ConstEval::radians(const type::Type* ty,
utils::VectorRef<const constant::Constant*> args,
const Source& source) {
diff --git a/src/tint/resolver/const_eval.h b/src/tint/resolver/const_eval.h
index 742089d..4a99bc0 100644
--- a/src/tint/resolver/const_eval.h
+++ b/src/tint/resolver/const_eval.h
@@ -833,6 +833,15 @@
utils::VectorRef<const constant::Constant*> args,
const Source& source);
+ /// pow builtin
+ /// @param ty the expression type
+ /// @param args the input arguments
+ /// @param source the source location
+ /// @return the result value, or null if the value cannot be calculated
+ Result pow(const type::Type* ty,
+ utils::VectorRef<const sem::Constant*> args,
+ const Source& source);
+
/// radians 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 40c6500..82c6d38 100644
--- a/src/tint/resolver/const_eval_builtin_test.cc
+++ b/src/tint/resolver/const_eval_builtin_test.cc
@@ -1972,6 +1972,54 @@
testing::ValuesIn(Pack2x16unormCases())));
template <typename T>
+std::vector<Case> PowCases() {
+ auto error_msg = [](auto base, auto exp) {
+ return "12:34 error: " + OverflowErrorMessage(base, "^", exp);
+ };
+ return {
+ C({T(0), T(1)}, T(0)), //
+ C({T(0), T::Highest()}, T(0)), //
+ C({T(1), T(1)}, T(1)), //
+ C({T(1), T::Lowest()}, T(1)), //
+ C({T(2), T(2)}, T(4)), //
+ C({T(2), T(3)}, T(8)), //
+ // Positive base, negative exponent
+ C({T(1), T::Highest()}, T(1)), //
+ C({T(1), -T(1)}, T(1)), //
+ C({T(2), -T(2)}, T(0.25)), //
+ C({T(2), -T(3)}, T(0.125)), //
+ // Decimal values
+ C({T(2.5), T(3)}, T(15.625)), //
+ C({T(2), T(3.5)}, T(11.313708498)).FloatComp(), //
+ C({T(2.5), T(3.5)}, T(24.705294220)).FloatComp(), //
+ C({T(2), -T(3.5)}, T(0.0883883476)).FloatComp(), //
+
+ // Vector tests
+ C({Vec(T(0), T(1), T(2)), Vec(T(2), T(2), T(2))}, Vec(T(0), T(1), T(4))),
+ C({Vec(T(2), T(2), T(2)), Vec(T(2), T(3), T(4))}, Vec(T(4), T(8), T(16))),
+
+ // Error if base < 0
+ E({-T(1), T(1)}, error_msg(-T(1), T(1))),
+ E({-T(1), T::Highest()}, error_msg(-T(1), T::Highest())),
+ E({T::Lowest(), T(1)}, error_msg(T::Lowest(), T(1))),
+ E({T::Lowest(), T::Highest()}, error_msg(T::Lowest(), T::Highest())),
+ E({T::Lowest(), T::Lowest()}, error_msg(T::Lowest(), T::Lowest())),
+
+ // Error if base == 0 and exp <= 0
+ E({T(0), T(0)}, error_msg(T(0), T(0))),
+ E({T(0), -T(1)}, error_msg(T(0), -T(1))),
+ E({T(0), T::Lowest()}, error_msg(T(0), T::Lowest())),
+ };
+}
+INSTANTIATE_TEST_SUITE_P( //
+ Pow,
+ ResolverConstEvalBuiltinTest,
+ testing::Combine(testing::Values(sem::BuiltinType::kPow),
+ testing::ValuesIn(Concat(PowCases<AFloat>(), //
+ PowCases<f32>(), //
+ PowCases<f16>()))));
+
+template <typename T>
std::vector<Case> ReverseBitsCases() {
using B = BitValues<T>;
return {
diff --git a/src/tint/resolver/const_eval_test.h b/src/tint/resolver/const_eval_test.h
index fd39286..0429e8f 100644
--- a/src/tint/resolver/const_eval_test.h
+++ b/src/tint/resolver/const_eval_test.h
@@ -238,10 +238,10 @@
/// Returns the overflow error message for exponentiation
template <typename NumberT>
-std::string OverflowExpErrorMessage(std::string_view base, NumberT value) {
+std::string OverflowExpErrorMessage(std::string_view base, NumberT exp) {
std::stringstream ss;
ss << std::setprecision(20);
- ss << base << "^" << value << " cannot be represented as "
+ ss << base << "^" << exp << " cannot be represented as "
<< "'" << FriendlyName<NumberT>() << "'";
return ss.str();
}
diff --git a/src/tint/resolver/intrinsic_table.inl b/src/tint/resolver/intrinsic_table.inl
index bda6238..fd2822b 100644
--- a/src/tint/resolver/intrinsic_table.inl
+++ b/src/tint/resolver/intrinsic_table.inl
@@ -12797,24 +12797,24 @@
/* num parameters */ 2,
/* num template types */ 1,
/* num template numbers */ 0,
- /* template types */ &kTemplateTypes[26],
+ /* template types */ &kTemplateTypes[23],
/* template numbers */ &kTemplateNumbers[10],
/* parameters */ &kParameters[622],
/* return matcher indices */ &kMatcherIndices[3],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* const eval */ nullptr,
+ /* const eval */ &ConstEval::pow,
},
{
/* [376] */
/* num parameters */ 2,
/* num template types */ 1,
/* num template numbers */ 1,
- /* template types */ &kTemplateTypes[26],
+ /* template types */ &kTemplateTypes[23],
/* template numbers */ &kTemplateNumbers[4],
/* parameters */ &kParameters[624],
/* return matcher indices */ &kMatcherIndices[30],
/* flags */ OverloadFlags(OverloadFlag::kIsBuiltin, OverloadFlag::kSupportsVertexPipeline, OverloadFlag::kSupportsFragmentPipeline, OverloadFlag::kSupportsComputePipeline),
- /* const eval */ nullptr,
+ /* const eval */ &ConstEval::pow,
},
{
/* [377] */
@@ -14345,8 +14345,8 @@
},
{
/* [60] */
- /* fn pow<T : f32_f16>(T, T) -> T */
- /* fn pow<N : num, T : f32_f16>(vec<N, T>, vec<N, T>) -> vec<N, T> */
+ /* fn pow<T : fa_f32_f16>(T, T) -> T */
+ /* fn pow<N : num, T : fa_f32_f16>(vec<N, T>, vec<N, T>) -> vec<N, T> */
/* num overloads */ 2,
/* overloads */ &kOverloads[375],
},
diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.dxc.hlsl
index 7006eef..1ae0105 100644
--- a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void pow_04a908() {
- float4 res = pow((1.0f).xxxx, (1.0f).xxxx);
+ float4 res = (1.0f).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.fxc.hlsl
index 7006eef..1ae0105 100644
--- a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void pow_04a908() {
- float4 res = pow((1.0f).xxxx, (1.0f).xxxx);
+ float4 res = (1.0f).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.glsl
index dc7e2f6..139e5c2 100644
--- a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void pow_04a908() {
- vec4 res = pow(vec4(1.0f), vec4(1.0f));
+ vec4 res = vec4(1.0f);
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void pow_04a908() {
- vec4 res = pow(vec4(1.0f), vec4(1.0f));
+ vec4 res = vec4(1.0f);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void pow_04a908() {
- vec4 res = pow(vec4(1.0f), vec4(1.0f));
+ vec4 res = vec4(1.0f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.msl
index 647e665..47d2531 100644
--- a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void pow_04a908() {
- float4 res = pow(float4(1.0f), float4(1.0f));
+ float4 res = float4(1.0f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.spvasm
index 614ed9b..fdf4f0a 100644
--- a/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/pow/04a908.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 30
; Schema: 0
OpCapability Shader
- %14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -32,35 +31,34 @@
%void = OpTypeVoid
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
- %16 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+ %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %19 = OpTypeFunction %v4float
+ %17 = OpTypeFunction %v4float
%pow_04a908 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
- %13 = OpExtInst %v4float %14 Pow %16 %16
- OpStore %res %13
+ OpStore %res %14
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
- %21 = OpLabel
- %22 = OpFunctionCall %void %pow_04a908
+%vertex_main_inner = OpFunction %v4float None %17
+ %19 = OpLabel
+ %20 = OpFunctionCall %void %pow_04a908
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 %pow_04a908
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %pow_04a908
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %30 = OpLabel
- %31 = OpFunctionCall %void %pow_04a908
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %pow_04a908
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.dxc.hlsl
index e7864f3..5d97ebd 100644
--- a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void pow_46e029() {
- float res = pow(1.0f, 1.0f);
+ float res = 1.0f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.fxc.hlsl
index e7864f3..5d97ebd 100644
--- a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void pow_46e029() {
- float res = pow(1.0f, 1.0f);
+ float res = 1.0f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.glsl
index 4e3a1e9..570c291 100644
--- a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void pow_46e029() {
- float res = pow(1.0f, 1.0f);
+ float res = 1.0f;
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void pow_46e029() {
- float res = pow(1.0f, 1.0f);
+ float res = 1.0f;
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void pow_46e029() {
- float res = pow(1.0f, 1.0f);
+ float res = 1.0f;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.msl
index bd12603..f6b1cd9 100644
--- a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void pow_46e029() {
- float res = pow(1.0f, 1.0f);
+ float res = 1.0f;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.spvasm
index 9fb5446..dba627f 100644
--- a/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/pow/46e029.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 31
+; Bound: 29
; Schema: 0
OpCapability Shader
- %14 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -33,33 +32,32 @@
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
- %18 = OpTypeFunction %v4float
+ %16 = OpTypeFunction %v4float
%pow_46e029 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
- %13 = OpExtInst %float %14 Pow %float_1 %float_1
- OpStore %res %13
+ OpStore %res %float_1
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %18
- %20 = OpLabel
- %21 = OpFunctionCall %void %pow_46e029
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %pow_46e029
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 %pow_46e029
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %pow_46e029
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %29 = OpLabel
- %30 = OpFunctionCall %void %pow_46e029
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %pow_46e029
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.dxc.hlsl
index 2821990..56a6bf7 100644
--- a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void pow_4a46c9() {
- float3 res = pow((1.0f).xxx, (1.0f).xxx);
+ float3 res = (1.0f).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.fxc.hlsl
index 2821990..56a6bf7 100644
--- a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void pow_4a46c9() {
- float3 res = pow((1.0f).xxx, (1.0f).xxx);
+ float3 res = (1.0f).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.glsl
index 36ad968..11cb9b9 100644
--- a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void pow_4a46c9() {
- vec3 res = pow(vec3(1.0f), vec3(1.0f));
+ vec3 res = vec3(1.0f);
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void pow_4a46c9() {
- vec3 res = pow(vec3(1.0f), vec3(1.0f));
+ vec3 res = vec3(1.0f);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void pow_4a46c9() {
- vec3 res = pow(vec3(1.0f), vec3(1.0f));
+ vec3 res = vec3(1.0f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.msl
index e0fa00c..2c06a34 100644
--- a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void pow_4a46c9() {
- float3 res = pow(float3(1.0f), float3(1.0f));
+ float3 res = float3(1.0f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.spvasm
index 01a3076..dd4ce26 100644
--- a/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/pow/4a46c9.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
- %15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -33,36 +32,35 @@
%9 = OpTypeFunction %void
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
- %17 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+ %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v3float = OpTypePointer Function %v3float
- %20 = OpConstantNull %v3float
- %21 = OpTypeFunction %v4float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
%pow_4a46c9 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v3float Function %20
- %13 = OpExtInst %v3float %15 Pow %17 %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 %pow_4a46c9
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %pow_4a46c9
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 %pow_4a46c9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %pow_4a46c9
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %pow_4a46c9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %pow_4a46c9
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.dxc.hlsl
index 279bbac..b265ae4 100644
--- a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void pow_4f33b2() {
- vector<float16_t, 4> res = pow((float16_t(1.0h)).xxxx, (float16_t(1.0h)).xxxx);
+ vector<float16_t, 4> res = (float16_t(1.0h)).xxxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.glsl
index 2a31c91..685d969 100644
--- a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void pow_4f33b2() {
- f16vec4 res = pow(f16vec4(1.0hf), f16vec4(1.0hf));
+ f16vec4 res = f16vec4(1.0hf);
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void pow_4f33b2() {
- f16vec4 res = pow(f16vec4(1.0hf), f16vec4(1.0hf));
+ f16vec4 res = f16vec4(1.0hf);
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void pow_4f33b2() {
- f16vec4 res = pow(f16vec4(1.0hf), f16vec4(1.0hf));
+ f16vec4 res = f16vec4(1.0hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.msl
index 8f249be..652fe80 100644
--- a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void pow_4f33b2() {
- half4 res = pow(half4(1.0h), half4(1.0h));
+ half4 res = half4(1.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.spvasm
index be0a42a..475e4b4 100644
--- a/test/tint/builtins/gen/literal/pow/4f33b2.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/pow/4f33b2.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"
@@ -38,37 +37,36 @@
%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
+ %16 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v4half = OpTypePointer Function %v4half
- %21 = OpConstantNull %v4half
- %22 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v4half
+ %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%pow_4f33b2 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v4half Function %21
- %13 = OpExtInst %v4half %16 Pow %18 %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 %pow_4f33b2
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %pow_4f33b2
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 %pow_4f33b2
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %pow_4f33b2
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %pow_4f33b2
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %pow_4f33b2
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/749c42.wgsl b/test/tint/builtins/gen/literal/pow/749c42.wgsl
new file mode 100644
index 0000000..e1c6acc
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/749c42.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 pow(fa, fa) -> fa
+fn pow_749c42() {
+ var res = pow(1., 1.);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_749c42();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_749c42();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_749c42();
+}
diff --git a/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ecbf0c0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void pow_749c42() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_749c42();
+ 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() {
+ pow_749c42();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_749c42();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ecbf0c0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void pow_749c42() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_749c42();
+ 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() {
+ pow_749c42();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_749c42();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.glsl
new file mode 100644
index 0000000..d61fbdb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void pow_749c42() {
+ float res = 1.0f;
+}
+
+vec4 vertex_main() {
+ pow_749c42();
+ 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 pow_749c42() {
+ float res = 1.0f;
+}
+
+void fragment_main() {
+ pow_749c42();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_749c42() {
+ float res = 1.0f;
+}
+
+void compute_main() {
+ pow_749c42();
+}
+
+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/pow/749c42.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.msl
new file mode 100644
index 0000000..5aa140a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_749c42() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_749c42();
+ 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() {
+ pow_749c42();
+ return;
+}
+
+kernel void compute_main() {
+ pow_749c42();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.spvasm
new file mode 100644
index 0000000..52a393b
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %pow_749c42 "pow_749c42"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+ %pow_749c42 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_1
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %pow_749c42
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %21 = OpLabel
+ %22 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %22
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %pow_749c42
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %pow_749c42
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.wgsl
new file mode 100644
index 0000000..cadc514
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/749c42.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn pow_749c42() {
+ var res = pow(1.0, 1.0);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_749c42();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_749c42();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_749c42();
+}
diff --git a/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl
new file mode 100644
index 0000000..83e8d64
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/a8f6b2.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 pow(vec<4, fa>, vec<4, fa>) -> vec<4, fa>
+fn pow_a8f6b2() {
+ var res = pow(vec4(1.), vec4(1.));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_a8f6b2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_a8f6b2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_a8f6b2();
+}
diff --git a/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a36a572
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void pow_a8f6b2() {
+ float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_a8f6b2();
+ 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() {
+ pow_a8f6b2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_a8f6b2();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a36a572
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void pow_a8f6b2() {
+ float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_a8f6b2();
+ 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() {
+ pow_a8f6b2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_a8f6b2();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.glsl
new file mode 100644
index 0000000..d5d0cf0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void pow_a8f6b2() {
+ vec4 res = vec4(1.0f);
+}
+
+vec4 vertex_main() {
+ pow_a8f6b2();
+ 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 pow_a8f6b2() {
+ vec4 res = vec4(1.0f);
+}
+
+void fragment_main() {
+ pow_a8f6b2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_a8f6b2() {
+ vec4 res = vec4(1.0f);
+}
+
+void compute_main() {
+ pow_a8f6b2();
+}
+
+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/pow/a8f6b2.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.msl
new file mode 100644
index 0000000..36e1b89
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_a8f6b2() {
+ float4 res = float4(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_a8f6b2();
+ 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() {
+ pow_a8f6b2();
+ return;
+}
+
+kernel void compute_main() {
+ pow_a8f6b2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.spvasm
new file mode 100644
index 0000000..32d0af3
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/a8f6b2.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 %pow_a8f6b2 "pow_a8f6b2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+ %pow_a8f6b2 = 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 %pow_a8f6b2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %22 = OpLabel
+ %23 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %23
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %pow_a8f6b2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %pow_a8f6b2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.wgsl
new file mode 100644
index 0000000..c5553fb
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/a8f6b2.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn pow_a8f6b2() {
+ var res = pow(vec4(1.0), vec4(1.0));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_a8f6b2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_a8f6b2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_a8f6b2();
+}
diff --git a/test/tint/builtins/gen/literal/pow/bc91ed.wgsl b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl
new file mode 100644
index 0000000..3885637
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/bc91ed.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 pow(vec<2, fa>, vec<2, fa>) -> vec<2, fa>
+fn pow_bc91ed() {
+ var res = pow(vec2(1.), vec2(1.));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_bc91ed();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_bc91ed();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_bc91ed();
+}
diff --git a/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..2b5dc1c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void pow_bc91ed() {
+ float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_bc91ed();
+ 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() {
+ pow_bc91ed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_bc91ed();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..2b5dc1c
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void pow_bc91ed() {
+ float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_bc91ed();
+ 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() {
+ pow_bc91ed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_bc91ed();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.glsl
new file mode 100644
index 0000000..892ea2e
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void pow_bc91ed() {
+ vec2 res = vec2(1.0f);
+}
+
+vec4 vertex_main() {
+ pow_bc91ed();
+ 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 pow_bc91ed() {
+ vec2 res = vec2(1.0f);
+}
+
+void fragment_main() {
+ pow_bc91ed();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_bc91ed() {
+ vec2 res = vec2(1.0f);
+}
+
+void compute_main() {
+ pow_bc91ed();
+}
+
+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/pow/bc91ed.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.msl
new file mode 100644
index 0000000..47cfcb2
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_bc91ed() {
+ float2 res = float2(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_bc91ed();
+ 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() {
+ pow_bc91ed();
+ return;
+}
+
+kernel void compute_main() {
+ pow_bc91ed();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.spvasm
new file mode 100644
index 0000000..5433841
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %pow_bc91ed "pow_bc91ed"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantComposite %v2float %float_1 %float_1
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %pow_bc91ed = 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 %pow_bc91ed
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %pow_bc91ed
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %pow_bc91ed
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.wgsl
new file mode 100644
index 0000000..e9336ab
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/bc91ed.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn pow_bc91ed() {
+ var res = pow(vec2(1.0), vec2(1.0));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_bc91ed();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_bc91ed();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_bc91ed();
+}
diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.dxc.hlsl
index b2a002c..dc03903 100644
--- a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void pow_ce9ef5() {
- float16_t res = pow(float16_t(1.0h), float16_t(1.0h));
+ float16_t res = float16_t(1.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.glsl
index 3363c82..a3e589a 100644
--- a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void pow_ce9ef5() {
- float16_t res = pow(1.0hf, 1.0hf);
+ float16_t res = 1.0hf;
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void pow_ce9ef5() {
- float16_t res = pow(1.0hf, 1.0hf);
+ float16_t res = 1.0hf;
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void pow_ce9ef5() {
- float16_t res = pow(1.0hf, 1.0hf);
+ float16_t res = 1.0hf;
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.msl
index 45bbe91..46b6ca6 100644
--- a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void pow_ce9ef5() {
- half res = pow(1.0h, 1.0h);
+ half res = 1.0h;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.spvasm
index 67c7240..6d2f5a7 100644
--- a/test/tint/builtins/gen/literal/pow/ce9ef5.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/pow/ce9ef5.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"
@@ -38,35 +37,34 @@
%half = OpTypeFloat 16
%half_0x1p_0 = OpConstant %half 0x1p+0
%_ptr_Function_half = OpTypePointer Function %half
- %19 = OpConstantNull %half
- %20 = OpTypeFunction %v4float
+ %17 = OpConstantNull %half
+ %18 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%pow_ce9ef5 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_half Function %19
- %13 = OpExtInst %half %15 Pow %half_0x1p_0 %half_0x1p_0
- OpStore %res %13
+ %res = OpVariable %_ptr_Function_half Function %17
+ OpStore %res %half_0x1p_0
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %20
- %22 = OpLabel
- %23 = OpFunctionCall %void %pow_ce9ef5
+%vertex_main_inner = OpFunction %v4float None %18
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %pow_ce9ef5
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 %pow_ce9ef5
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %pow_ce9ef5
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %pow_ce9ef5
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %pow_ce9ef5
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/e42f20.wgsl b/test/tint/builtins/gen/literal/pow/e42f20.wgsl
new file mode 100644
index 0000000..066b74a
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/e42f20.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 pow(vec<3, fa>, vec<3, fa>) -> vec<3, fa>
+fn pow_e42f20() {
+ var res = pow(vec3(1.), vec3(1.));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_e42f20();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_e42f20();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_e42f20();
+}
diff --git a/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a46c9fa
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void pow_e42f20() {
+ float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_e42f20();
+ 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() {
+ pow_e42f20();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_e42f20();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a46c9fa
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void pow_e42f20() {
+ float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_e42f20();
+ 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() {
+ pow_e42f20();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_e42f20();
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.glsl
new file mode 100644
index 0000000..576ef1f
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void pow_e42f20() {
+ vec3 res = vec3(1.0f);
+}
+
+vec4 vertex_main() {
+ pow_e42f20();
+ 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 pow_e42f20() {
+ vec3 res = vec3(1.0f);
+}
+
+void fragment_main() {
+ pow_e42f20();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_e42f20() {
+ vec3 res = vec3(1.0f);
+}
+
+void compute_main() {
+ pow_e42f20();
+}
+
+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/pow/e42f20.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.msl
new file mode 100644
index 0000000..c5703d0
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_e42f20() {
+ float3 res = float3(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_e42f20();
+ 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() {
+ pow_e42f20();
+ return;
+}
+
+kernel void compute_main() {
+ pow_e42f20();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.spvasm
new file mode 100644
index 0000000..6386fcf
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %pow_e42f20 "pow_e42f20"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %pow_e42f20 = 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 %pow_e42f20
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %pow_e42f20
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %pow_e42f20
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.wgsl
new file mode 100644
index 0000000..23af6f1
--- /dev/null
+++ b/test/tint/builtins/gen/literal/pow/e42f20.wgsl.expected.wgsl
@@ -0,0 +1,19 @@
+fn pow_e42f20() {
+ var res = pow(vec3(1.0), vec3(1.0));
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_e42f20();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_e42f20();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_e42f20();
+}
diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.dxc.hlsl
index 1a7b88c2..972f4c3 100644
--- a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void pow_e60ea5() {
- float2 res = pow((1.0f).xx, (1.0f).xx);
+ float2 res = (1.0f).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.fxc.hlsl
index 1a7b88c2..972f4c3 100644
--- a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.fxc.hlsl
@@ -1,5 +1,5 @@
void pow_e60ea5() {
- float2 res = pow((1.0f).xx, (1.0f).xx);
+ float2 res = (1.0f).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.glsl
index ede9a15..09a81b2 100644
--- a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.glsl
@@ -1,7 +1,7 @@
#version 310 es
void pow_e60ea5() {
- vec2 res = pow(vec2(1.0f), vec2(1.0f));
+ vec2 res = vec2(1.0f);
}
vec4 vertex_main() {
@@ -21,7 +21,7 @@
precision mediump float;
void pow_e60ea5() {
- vec2 res = pow(vec2(1.0f), vec2(1.0f));
+ vec2 res = vec2(1.0f);
}
void fragment_main() {
@@ -35,7 +35,7 @@
#version 310 es
void pow_e60ea5() {
- vec2 res = pow(vec2(1.0f), vec2(1.0f));
+ vec2 res = vec2(1.0f);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.msl
index 5a964ba..f416b4c 100644
--- a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void pow_e60ea5() {
- float2 res = pow(float2(1.0f), float2(1.0f));
+ float2 res = float2(1.0f);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.spvasm
index 17d1989..79fe8c3 100644
--- a/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/pow/e60ea5.wgsl.expected.spvasm
@@ -1,10 +1,9 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 32
; Schema: 0
OpCapability Shader
- %15 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
@@ -33,36 +32,35 @@
%9 = OpTypeFunction %void
%v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
- %17 = OpConstantComposite %v2float %float_1 %float_1
+ %15 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float
- %20 = OpConstantNull %v2float
- %21 = OpTypeFunction %v4float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
%pow_e60ea5 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v2float Function %20
- %13 = OpExtInst %v2float %15 Pow %17 %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 %pow_e60ea5
+%vertex_main_inner = OpFunction %v4float None %19
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %pow_e60ea5
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 %pow_e60ea5
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %pow_e60ea5
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %32 = OpLabel
- %33 = OpFunctionCall %void %pow_e60ea5
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %pow_e60ea5
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.dxc.hlsl
index 6a13f47..e2d71b3 100644
--- a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void pow_f37b25() {
- vector<float16_t, 2> res = pow((float16_t(1.0h)).xx, (float16_t(1.0h)).xx);
+ vector<float16_t, 2> res = (float16_t(1.0h)).xx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.glsl
index c49c6cc..bc15e2a 100644
--- a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void pow_f37b25() {
- f16vec2 res = pow(f16vec2(1.0hf), f16vec2(1.0hf));
+ f16vec2 res = f16vec2(1.0hf);
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void pow_f37b25() {
- f16vec2 res = pow(f16vec2(1.0hf), f16vec2(1.0hf));
+ f16vec2 res = f16vec2(1.0hf);
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void pow_f37b25() {
- f16vec2 res = pow(f16vec2(1.0hf), f16vec2(1.0hf));
+ f16vec2 res = f16vec2(1.0hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.msl
index f2862ed..9510344 100644
--- a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void pow_f37b25() {
- half2 res = pow(half2(1.0h), half2(1.0h));
+ half2 res = half2(1.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.spvasm
index 88e21b6..2ab5bca 100644
--- a/test/tint/builtins/gen/literal/pow/f37b25.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/pow/f37b25.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"
@@ -38,37 +37,36 @@
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
%half_0x1p_0 = OpConstant %half 0x1p+0
- %18 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
+ %16 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v2half = OpTypePointer Function %v2half
- %21 = OpConstantNull %v2half
- %22 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v2half
+ %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%pow_f37b25 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v2half Function %21
- %13 = OpExtInst %v2half %16 Pow %18 %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 %pow_f37b25
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %pow_f37b25
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 %pow_f37b25
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %pow_f37b25
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %pow_f37b25
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %pow_f37b25
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.dxc.hlsl
index a7106e4..dae5676 100644
--- a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.dxc.hlsl
@@ -1,5 +1,5 @@
void pow_fa5429() {
- vector<float16_t, 3> res = pow((float16_t(1.0h)).xxx, (float16_t(1.0h)).xxx);
+ vector<float16_t, 3> res = (float16_t(1.0h)).xxx;
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.glsl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.glsl
index 289c6e6..be0b8fd 100644
--- a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.glsl
@@ -2,7 +2,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void pow_fa5429() {
- f16vec3 res = pow(f16vec3(1.0hf), f16vec3(1.0hf));
+ f16vec3 res = f16vec3(1.0hf);
}
vec4 vertex_main() {
@@ -23,7 +23,7 @@
precision mediump float;
void pow_fa5429() {
- f16vec3 res = pow(f16vec3(1.0hf), f16vec3(1.0hf));
+ f16vec3 res = f16vec3(1.0hf);
}
void fragment_main() {
@@ -38,7 +38,7 @@
#extension GL_AMD_gpu_shader_half_float : require
void pow_fa5429() {
- f16vec3 res = pow(f16vec3(1.0hf), f16vec3(1.0hf));
+ f16vec3 res = f16vec3(1.0hf);
}
void compute_main() {
diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.msl b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.msl
index 220abc4..2148fc7 100644
--- a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.msl
@@ -2,7 +2,7 @@
using namespace metal;
void pow_fa5429() {
- half3 res = pow(half3(1.0h), half3(1.0h));
+ half3 res = half3(1.0h);
}
struct tint_symbol {
diff --git a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.spvasm
index 68917f8..5ad9738 100644
--- a/test/tint/builtins/gen/literal/pow/fa5429.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/pow/fa5429.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"
@@ -38,37 +37,36 @@
%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
+ %16 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v3half = OpTypePointer Function %v3half
- %21 = OpConstantNull %v3half
- %22 = OpTypeFunction %v4float
+ %19 = OpConstantNull %v3half
+ %20 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%pow_fa5429 = OpFunction %void None %9
%12 = OpLabel
- %res = OpVariable %_ptr_Function_v3half Function %21
- %13 = OpExtInst %v3half %16 Pow %18 %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 %pow_fa5429
+%vertex_main_inner = OpFunction %v4float None %20
+ %22 = OpLabel
+ %23 = OpFunctionCall %void %pow_fa5429
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 %pow_fa5429
+ %29 = OpLabel
+ %30 = OpFunctionCall %void %pow_fa5429
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %34 = OpLabel
- %35 = OpFunctionCall %void %pow_fa5429
+ %32 = OpLabel
+ %33 = OpFunctionCall %void %pow_fa5429
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pow/749c42.wgsl b/test/tint/builtins/gen/var/pow/749c42.wgsl
new file mode 100644
index 0000000..28a6356
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/749c42.wgsl
@@ -0,0 +1,45 @@
+// 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 pow(fa, fa) -> fa
+fn pow_749c42() {
+ const arg_0 = 1.;
+ const arg_1 = 1.;
+ var res = pow(arg_0, arg_1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_749c42();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_749c42();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_749c42();
+}
diff --git a/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..ecbf0c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void pow_749c42() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_749c42();
+ 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() {
+ pow_749c42();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_749c42();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..ecbf0c0
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void pow_749c42() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_749c42();
+ 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() {
+ pow_749c42();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_749c42();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.glsl
new file mode 100644
index 0000000..d61fbdb
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void pow_749c42() {
+ float res = 1.0f;
+}
+
+vec4 vertex_main() {
+ pow_749c42();
+ 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 pow_749c42() {
+ float res = 1.0f;
+}
+
+void fragment_main() {
+ pow_749c42();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_749c42() {
+ float res = 1.0f;
+}
+
+void compute_main() {
+ pow_749c42();
+}
+
+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/pow/749c42.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.msl
new file mode 100644
index 0000000..5aa140a
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_749c42() {
+ float res = 1.0f;
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_749c42();
+ 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() {
+ pow_749c42();
+ return;
+}
+
+kernel void compute_main() {
+ pow_749c42();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.spvasm
new file mode 100644
index 0000000..52a393b
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.spvasm
@@ -0,0 +1,63 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 29
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %pow_749c42 "pow_749c42"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+%_ptr_Function_float = OpTypePointer Function %float
+ %16 = OpTypeFunction %v4float
+ %pow_749c42 = OpFunction %void None %9
+ %12 = OpLabel
+ %res = OpVariable %_ptr_Function_float Function %8
+ OpStore %res %float_1
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %v4float None %16
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %pow_749c42
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %21 = OpLabel
+ %22 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %22
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %void %pow_749c42
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %pow_749c42
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.wgsl
new file mode 100644
index 0000000..dab5398
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/749c42.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn pow_749c42() {
+ const arg_0 = 1.0;
+ const arg_1 = 1.0;
+ var res = pow(arg_0, arg_1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_749c42();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_749c42();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_749c42();
+}
diff --git a/test/tint/builtins/gen/var/pow/a8f6b2.wgsl b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl
new file mode 100644
index 0000000..97038ee
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl
@@ -0,0 +1,45 @@
+// 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 pow(vec<4, fa>, vec<4, fa>) -> vec<4, fa>
+fn pow_a8f6b2() {
+ const arg_0 = vec4(1.);
+ const arg_1 = vec4(1.);
+ var res = pow(arg_0, arg_1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_a8f6b2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_a8f6b2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_a8f6b2();
+}
diff --git a/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a36a572
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void pow_a8f6b2() {
+ float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_a8f6b2();
+ 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() {
+ pow_a8f6b2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_a8f6b2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a36a572
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void pow_a8f6b2() {
+ float4 res = (1.0f).xxxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_a8f6b2();
+ 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() {
+ pow_a8f6b2();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_a8f6b2();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.glsl
new file mode 100644
index 0000000..d5d0cf0
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void pow_a8f6b2() {
+ vec4 res = vec4(1.0f);
+}
+
+vec4 vertex_main() {
+ pow_a8f6b2();
+ 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 pow_a8f6b2() {
+ vec4 res = vec4(1.0f);
+}
+
+void fragment_main() {
+ pow_a8f6b2();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_a8f6b2() {
+ vec4 res = vec4(1.0f);
+}
+
+void compute_main() {
+ pow_a8f6b2();
+}
+
+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/pow/a8f6b2.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.msl
new file mode 100644
index 0000000..36e1b89
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_a8f6b2() {
+ float4 res = float4(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_a8f6b2();
+ 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() {
+ pow_a8f6b2();
+ return;
+}
+
+kernel void compute_main() {
+ pow_a8f6b2();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.spvasm
new file mode 100644
index 0000000..32d0af3
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/a8f6b2.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 %pow_a8f6b2 "pow_a8f6b2"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %17 = OpTypeFunction %v4float
+ %pow_a8f6b2 = 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 %pow_a8f6b2
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %22 = OpLabel
+ %23 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %23
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %25 = OpLabel
+ %26 = OpFunctionCall %void %pow_a8f6b2
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %28 = OpLabel
+ %29 = OpFunctionCall %void %pow_a8f6b2
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.wgsl
new file mode 100644
index 0000000..3c71ff7
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/a8f6b2.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn pow_a8f6b2() {
+ const arg_0 = vec4(1.0);
+ const arg_1 = vec4(1.0);
+ var res = pow(arg_0, arg_1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_a8f6b2();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_a8f6b2();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_a8f6b2();
+}
diff --git a/test/tint/builtins/gen/var/pow/bc91ed.wgsl b/test/tint/builtins/gen/var/pow/bc91ed.wgsl
new file mode 100644
index 0000000..e3891cf
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/bc91ed.wgsl
@@ -0,0 +1,45 @@
+// 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 pow(vec<2, fa>, vec<2, fa>) -> vec<2, fa>
+fn pow_bc91ed() {
+ const arg_0 = vec2(1.);
+ const arg_1 = vec2(1.);
+ var res = pow(arg_0, arg_1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_bc91ed();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_bc91ed();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_bc91ed();
+}
diff --git a/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..2b5dc1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void pow_bc91ed() {
+ float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_bc91ed();
+ 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() {
+ pow_bc91ed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_bc91ed();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..2b5dc1c
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void pow_bc91ed() {
+ float2 res = (1.0f).xx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_bc91ed();
+ 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() {
+ pow_bc91ed();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_bc91ed();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.glsl
new file mode 100644
index 0000000..892ea2e
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void pow_bc91ed() {
+ vec2 res = vec2(1.0f);
+}
+
+vec4 vertex_main() {
+ pow_bc91ed();
+ 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 pow_bc91ed() {
+ vec2 res = vec2(1.0f);
+}
+
+void fragment_main() {
+ pow_bc91ed();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_bc91ed() {
+ vec2 res = vec2(1.0f);
+}
+
+void compute_main() {
+ pow_bc91ed();
+}
+
+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/pow/bc91ed.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.msl
new file mode 100644
index 0000000..47cfcb2
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_bc91ed() {
+ float2 res = float2(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_bc91ed();
+ 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() {
+ pow_bc91ed();
+ return;
+}
+
+kernel void compute_main() {
+ pow_bc91ed();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.spvasm
new file mode 100644
index 0000000..5433841
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %pow_bc91ed "pow_bc91ed"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v2float = OpTypeVector %float 2
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantComposite %v2float %float_1 %float_1
+%_ptr_Function_v2float = OpTypePointer Function %v2float
+ %18 = OpConstantNull %v2float
+ %19 = OpTypeFunction %v4float
+ %pow_bc91ed = 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 %pow_bc91ed
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %pow_bc91ed
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %pow_bc91ed
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.wgsl
new file mode 100644
index 0000000..fee550e
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/bc91ed.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn pow_bc91ed() {
+ const arg_0 = vec2(1.0);
+ const arg_1 = vec2(1.0);
+ var res = pow(arg_0, arg_1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_bc91ed();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_bc91ed();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_bc91ed();
+}
diff --git a/test/tint/builtins/gen/var/pow/e42f20.wgsl b/test/tint/builtins/gen/var/pow/e42f20.wgsl
new file mode 100644
index 0000000..48cbde9
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e42f20.wgsl
@@ -0,0 +1,45 @@
+// 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 pow(vec<3, fa>, vec<3, fa>) -> vec<3, fa>
+fn pow_e42f20() {
+ const arg_0 = vec3(1.);
+ const arg_1 = vec3(1.);
+ var res = pow(arg_0, arg_1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_e42f20();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_e42f20();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_e42f20();
+}
diff --git a/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000..a46c9fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.dxc.hlsl
@@ -0,0 +1,30 @@
+void pow_e42f20() {
+ float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_e42f20();
+ 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() {
+ pow_e42f20();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_e42f20();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000..a46c9fa
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.fxc.hlsl
@@ -0,0 +1,30 @@
+void pow_e42f20() {
+ float3 res = (1.0f).xxx;
+}
+
+struct tint_symbol {
+ float4 value : SV_Position;
+};
+
+float4 vertex_main_inner() {
+ pow_e42f20();
+ 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() {
+ pow_e42f20();
+ return;
+}
+
+[numthreads(1, 1, 1)]
+void compute_main() {
+ pow_e42f20();
+ return;
+}
diff --git a/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.glsl b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.glsl
new file mode 100644
index 0000000..576ef1f
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.glsl
@@ -0,0 +1,49 @@
+#version 310 es
+
+void pow_e42f20() {
+ vec3 res = vec3(1.0f);
+}
+
+vec4 vertex_main() {
+ pow_e42f20();
+ 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 pow_e42f20() {
+ vec3 res = vec3(1.0f);
+}
+
+void fragment_main() {
+ pow_e42f20();
+}
+
+void main() {
+ fragment_main();
+ return;
+}
+#version 310 es
+
+void pow_e42f20() {
+ vec3 res = vec3(1.0f);
+}
+
+void compute_main() {
+ pow_e42f20();
+}
+
+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/pow/e42f20.wgsl.expected.msl b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.msl
new file mode 100644
index 0000000..c5703d0
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.msl
@@ -0,0 +1,33 @@
+#include <metal_stdlib>
+
+using namespace metal;
+void pow_e42f20() {
+ float3 res = float3(1.0f);
+}
+
+struct tint_symbol {
+ float4 value [[position]];
+};
+
+float4 vertex_main_inner() {
+ pow_e42f20();
+ 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() {
+ pow_e42f20();
+ return;
+}
+
+kernel void compute_main() {
+ pow_e42f20();
+ return;
+}
+
diff --git a/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.spvasm b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.spvasm
new file mode 100644
index 0000000..6386fcf
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.spvasm
@@ -0,0 +1,66 @@
+; SPIR-V
+; Version: 1.3
+; Generator: Google Tint Compiler; 0
+; Bound: 32
+; Schema: 0
+ OpCapability Shader
+ OpMemoryModel Logical GLSL450
+ OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
+ OpEntryPoint Fragment %fragment_main "fragment_main"
+ OpEntryPoint GLCompute %compute_main "compute_main"
+ OpExecutionMode %fragment_main OriginUpperLeft
+ OpExecutionMode %compute_main LocalSize 1 1 1
+ OpName %value "value"
+ OpName %vertex_point_size "vertex_point_size"
+ OpName %pow_e42f20 "pow_e42f20"
+ OpName %res "res"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %vertex_main "vertex_main"
+ OpName %fragment_main "fragment_main"
+ OpName %compute_main "compute_main"
+ OpDecorate %value BuiltIn Position
+ OpDecorate %vertex_point_size BuiltIn PointSize
+ %float = OpTypeFloat 32
+ %v4float = OpTypeVector %float 4
+%_ptr_Output_v4float = OpTypePointer Output %v4float
+ %5 = OpConstantNull %v4float
+ %value = OpVariable %_ptr_Output_v4float Output %5
+%_ptr_Output_float = OpTypePointer Output %float
+ %8 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %void = OpTypeVoid
+ %9 = OpTypeFunction %void
+ %v3float = OpTypeVector %float 3
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+%_ptr_Function_v3float = OpTypePointer Function %v3float
+ %18 = OpConstantNull %v3float
+ %19 = OpTypeFunction %v4float
+ %pow_e42f20 = 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 %pow_e42f20
+ OpReturnValue %5
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %24 = OpLabel
+ %25 = OpFunctionCall %v4float %vertex_main_inner
+ OpStore %value %25
+ OpStore %vertex_point_size %float_1
+ OpReturn
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %9
+ %27 = OpLabel
+ %28 = OpFunctionCall %void %pow_e42f20
+ OpReturn
+ OpFunctionEnd
+%compute_main = OpFunction %void None %9
+ %30 = OpLabel
+ %31 = OpFunctionCall %void %pow_e42f20
+ OpReturn
+ OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.wgsl b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.wgsl
new file mode 100644
index 0000000..a9f08dd
--- /dev/null
+++ b/test/tint/builtins/gen/var/pow/e42f20.wgsl.expected.wgsl
@@ -0,0 +1,21 @@
+fn pow_e42f20() {
+ const arg_0 = vec3(1.0);
+ const arg_1 = vec3(1.0);
+ var res = pow(arg_0, arg_1);
+}
+
+@vertex
+fn vertex_main() -> @builtin(position) vec4<f32> {
+ pow_e42f20();
+ return vec4<f32>();
+}
+
+@fragment
+fn fragment_main() {
+ pow_e42f20();
+}
+
+@compute @workgroup_size(1)
+fn compute_main() {
+ pow_e42f20();
+}