[spirv-reader] Add FOrdEqual, FOrdNotEqual

Unordered equality and inequality is not yet in WGSL
https://github.com/gpuweb/gpuweb/issues/706

Bug: tint:3
Change-Id: I45761ee490829f180110c578283bf136a185de9f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19563
Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
David Neto 2020-04-15 13:59:31 +00:00 committed by dan sinclair
parent da0a4e9c91
commit d4c8ab967b
2 changed files with 25 additions and 0 deletions

View File

@ -55,8 +55,10 @@ ast::BinaryOp ConvertBinaryOp(SpvOp opcode) {
case SpvOpShiftRightArithmetic: case SpvOpShiftRightArithmetic:
return ast::BinaryOp::kShiftRightArith; return ast::BinaryOp::kShiftRightArith;
case SpvOpIEqual: case SpvOpIEqual:
case SpvOpFOrdEqual:
return ast::BinaryOp::kEqual; return ast::BinaryOp::kEqual;
case SpvOpINotEqual: case SpvOpINotEqual:
case SpvOpFOrdNotEqual:
return ast::BinaryOp::kNotEqual; return ast::BinaryOp::kNotEqual;
case SpvOpBitwiseAnd: case SpvOpBitwiseAnd:
return ast::BinaryOp::kAnd; return ast::BinaryOp::kAnd;

View File

@ -195,6 +195,17 @@ INSTANTIATE_TEST_SUITE_P(
"__vec_2__bool", AstFor("v2int_30_40"), "equal", "__vec_2__bool", AstFor("v2int_30_40"), "equal",
AstFor("v2int_40_30")})); AstFor("v2int_40_30")}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_FOrdEqual,
SpvBinaryLogicalTest,
::testing::Values(BinaryData{"bool", "float_50", "OpFOrdEqual", "float_60",
"__bool", "ScalarConstructor{50.000000}",
"equal", "ScalarConstructor{60.000000}"},
BinaryData{"v2bool", "v2float_50_60", "OpFOrdEqual",
"v2float_60_50", "__vec_2__bool",
AstFor("v2float_50_60"), "equal",
AstFor("v2float_60_50")}));
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
SpvParserTest_INotEqual, SpvParserTest_INotEqual,
SpvBinaryLogicalTest, SpvBinaryLogicalTest,
@ -216,6 +227,18 @@ INSTANTIATE_TEST_SUITE_P(
"__vec_2__bool", AstFor("v2int_30_40"), "not_equal", "__vec_2__bool", AstFor("v2int_30_40"), "not_equal",
AstFor("v2int_40_30")})); AstFor("v2int_40_30")}));
INSTANTIATE_TEST_SUITE_P(
SpvParserTest_FOrdNotEqual,
SpvBinaryLogicalTest,
::testing::Values(BinaryData{"bool", "float_50", "OpFOrdNotEqual",
"float_60", "__bool",
"ScalarConstructor{50.000000}", "not_equal",
"ScalarConstructor{60.000000}"},
BinaryData{"v2bool", "v2float_50_60", "OpFOrdNotEqual",
"v2float_60_50", "__vec_2__bool",
AstFor("v2float_50_60"), "not_equal",
AstFor("v2float_60_50")}));
INSTANTIATE_TEST_SUITE_P( INSTANTIATE_TEST_SUITE_P(
SpvParserTest_LogicalAnd, SpvParserTest_LogicalAnd,
SpvBinaryLogicalTest, SpvBinaryLogicalTest,