From 11d9ac1ee120b4f17b029dcbe8f62565a6c62d86 Mon Sep 17 00:00:00 2001 From: David Neto Date: Tue, 14 Apr 2020 20:56:14 +0000 Subject: [PATCH] [spirv-reader] Add INotEqual Bug: tint:3 Change-Id: I5de89c15dfdcab1b454e2698244f51b0e2deb4ab Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19541 Reviewed-by: dan sinclair --- src/reader/spirv/function.cc | 2 ++ src/reader/spirv/function_logical_test.cc | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index e49ff511a5..6dddf2972e 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -50,6 +50,8 @@ ast::BinaryOp ConvertBinaryOp(SpvOp opcode) { return ast::BinaryOp::kDivide; case SpvOpIEqual: return ast::BinaryOp::kEqual; + case SpvOpINotEqual: + return ast::BinaryOp::kNotEqual; default: break; } diff --git a/src/reader/spirv/function_logical_test.cc b/src/reader/spirv/function_logical_test.cc index 476cc00e47..f33e58f274 100644 --- a/src/reader/spirv/function_logical_test.cc +++ b/src/reader/spirv/function_logical_test.cc @@ -193,6 +193,27 @@ INSTANTIATE_TEST_SUITE_P( "__vec_2__bool", AstFor("v2int_30_40"), "equal", AstFor("v2int_40_30")})); +INSTANTIATE_TEST_SUITE_P( + SpvParserTest_INotEqual, + SpvBinaryLogicalTest, + ::testing::Values( + // Both uint + BinaryData{"bool", "uint_10", "OpINotEqual", "uint_20", "__bool", + "ScalarConstructor{10}", "not_equal", + "ScalarConstructor{20}"}, + // Both int + BinaryData{"bool", "int_30", "OpINotEqual", "int_40", "__bool", + "ScalarConstructor{30}", "not_equal", + "ScalarConstructor{40}"}, + // Both v2uint + BinaryData{"v2bool", "v2uint_10_20", "OpINotEqual", "v2uint_20_10", + "__vec_2__bool", AstFor("v2uint_10_20"), "not_equal", + AstFor("v2uint_20_10")}, + // Both v2int + BinaryData{"v2bool", "v2int_30_40", "OpINotEqual", "v2int_40_30", + "__vec_2__bool", AstFor("v2int_30_40"), "not_equal", + AstFor("v2int_40_30")})); + } // namespace } // namespace spirv } // namespace reader