[spirv-reader] Add INotEqual
Bug: tint:3
Change-Id: I5de89c15dfdcab1b454e2698244f51b0e2deb4ab
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19541
Reviewed-by: dan sinclair <dsinclair@google.com>
diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc
index e49ff51..6dddf29 100644
--- a/src/reader/spirv/function.cc
+++ b/src/reader/spirv/function.cc
@@ -50,6 +50,8 @@
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 476cc00..f33e58f 100644
--- a/src/reader/spirv/function_logical_test.cc
+++ b/src/reader/spirv/function_logical_test.cc
@@ -193,6 +193,27 @@
"__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