From 3c3cf3cc219d5bbfef70b124405a66e2dc5db654 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Thu, 4 Jun 2020 17:05:55 +0000 Subject: [PATCH] [spirv-writer] Add support for is_inf This CL adds support for generating OpIsInf. Bug: tint:5 Change-Id: Ia208695d78f9914000e893435f37be45adb81022 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/22623 Reviewed-by: David Neto --- src/writer/spirv/builder.cc | 2 ++ src/writer/spirv/builder_intrinsic_test.cc | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/writer/spirv/builder.cc b/src/writer/spirv/builder.cc index e224ebd317..7269a30165 100644 --- a/src/writer/spirv/builder.cc +++ b/src/writer/spirv/builder.cc @@ -1252,6 +1252,8 @@ uint32_t Builder::GenerateIntrinsic(const std::string& name, op = spv::Op::OpAll; } else if (name == "is_nan") { op = spv::Op::OpIsNan; + } else if (name == "is_inf") { + op = spv::Op::OpIsInf; } if (op == spv::Op::OpNop) { error_ = "unable to determine operator for: " + name; diff --git a/src/writer/spirv/builder_intrinsic_test.cc b/src/writer/spirv/builder_intrinsic_test.cc index ba40b10096..f5151dabfe 100644 --- a/src/writer/spirv/builder_intrinsic_test.cc +++ b/src/writer/spirv/builder_intrinsic_test.cc @@ -167,7 +167,8 @@ TEST_P(IntrinsicFloatTest, Call_Float_Vector) { } INSTANTIATE_TEST_SUITE_P(BuilderTest, IntrinsicFloatTest, - testing::Values(IntrinsicData{"is_nan", "OpIsNan"})); + testing::Values(IntrinsicData{"is_nan", "OpIsNan"}, + IntrinsicData{"is_inf", "OpIsInf"})); } // namespace } // namespace spirv