[ir][spirv-writer] Implement pow builtin
Bug: tint:1906
Change-Id: I6f716a57fcb61c813152e30996099455f3910c15
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/141239
Kokoro: Kokoro <noreply+kokoro@google.com>
Auto-Submit: James Price <jrprice@google.com>
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/writer/spirv/ir/generator_impl_ir.cc b/src/tint/writer/spirv/ir/generator_impl_ir.cc
index 49be7ac..51dcf1d 100644
--- a/src/tint/writer/spirv/ir/generator_impl_ir.cc
+++ b/src/tint/writer/spirv/ir/generator_impl_ir.cc
@@ -1273,6 +1273,9 @@
case builtin::Function::kNormalize:
glsl_ext_inst(GLSLstd450Normalize);
break;
+ case builtin::Function::kPow:
+ glsl_ext_inst(GLSLstd450Pow);
+ break;
case builtin::Function::kSin:
glsl_ext_inst(GLSLstd450Sin);
break;
diff --git a/src/tint/writer/spirv/ir/generator_impl_ir_builtin_test.cc b/src/tint/writer/spirv/ir/generator_impl_ir_builtin_test.cc
index 1a8c7d2..e5f8bc3 100644
--- a/src/tint/writer/spirv/ir/generator_impl_ir_builtin_test.cc
+++ b/src/tint/writer/spirv/ir/generator_impl_ir_builtin_test.cc
@@ -365,6 +365,8 @@
BuiltinTestCase{kF32, builtin::Function::kMin, "FMin"},
BuiltinTestCase{kI32, builtin::Function::kMin, "SMin"},
BuiltinTestCase{kU32, builtin::Function::kMin, "UMin"},
+ BuiltinTestCase{kF32, builtin::Function::kPow, "Pow"},
+ BuiltinTestCase{kF16, builtin::Function::kPow, "Pow"},
BuiltinTestCase{kF32, builtin::Function::kStep, "Step"},
BuiltinTestCase{kF16, builtin::Function::kStep, "Step"}));