mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-03 03:35:59 +00:00
[spirv-reader] Add logical and, logical or
Bug: tint:3 Change-Id: Ia2bde9644a8e3cdd5871570354a380f968760711 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19562 Reviewed-by: dan sinclair <dsinclair@google.com>
This commit is contained in:
parent
fae8368dfe
commit
da0a4e9c91
@ -64,6 +64,10 @@ ast::BinaryOp ConvertBinaryOp(SpvOp opcode) {
|
|||||||
return ast::BinaryOp::kOr;
|
return ast::BinaryOp::kOr;
|
||||||
case SpvOpBitwiseXor:
|
case SpvOpBitwiseXor:
|
||||||
return ast::BinaryOp::kXor;
|
return ast::BinaryOp::kXor;
|
||||||
|
case SpvOpLogicalAnd:
|
||||||
|
return ast::BinaryOp::kLogicalAnd;
|
||||||
|
case SpvOpLogicalOr:
|
||||||
|
return ast::BinaryOp::kLogicalOr;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,8 @@ std::string CommonTypes() {
|
|||||||
%v2int = OpTypeVector %int 2
|
%v2int = OpTypeVector %int 2
|
||||||
%v2float = OpTypeVector %float 2
|
%v2float = OpTypeVector %float 2
|
||||||
|
|
||||||
|
%v2bool_t_f = OpConstantComposite %v2bool %true %false
|
||||||
|
%v2bool_f_t = OpConstantComposite %v2bool %false %true
|
||||||
%v2uint_10_20 = OpConstantComposite %v2uint %uint_10 %uint_20
|
%v2uint_10_20 = OpConstantComposite %v2uint %uint_10 %uint_20
|
||||||
%v2uint_20_10 = OpConstantComposite %v2uint %uint_20 %uint_10
|
%v2uint_20_10 = OpConstantComposite %v2uint %uint_20 %uint_10
|
||||||
%v2int_30_40 = OpConstantComposite %v2int %int_30 %int_40
|
%v2int_30_40 = OpConstantComposite %v2int %int_30 %int_40
|
||||||
@ -214,6 +216,28 @@ 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_LogicalAnd,
|
||||||
|
SpvBinaryLogicalTest,
|
||||||
|
::testing::Values(BinaryData{"bool", "true", "OpLogicalAnd", "false",
|
||||||
|
"__bool", "ScalarConstructor{true}",
|
||||||
|
"logical_and", "ScalarConstructor{false}"},
|
||||||
|
BinaryData{"v2bool", "v2bool_t_f", "OpLogicalAnd",
|
||||||
|
"v2bool_f_t", "__vec_2__bool",
|
||||||
|
AstFor("v2bool_t_f"), "logical_and",
|
||||||
|
AstFor("v2bool_f_t")}));
|
||||||
|
|
||||||
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
|
SpvParserTest_LogicalOr,
|
||||||
|
SpvBinaryLogicalTest,
|
||||||
|
::testing::Values(BinaryData{"bool", "true", "OpLogicalOr", "false",
|
||||||
|
"__bool", "ScalarConstructor{true}",
|
||||||
|
"logical_or", "ScalarConstructor{false}"},
|
||||||
|
BinaryData{"v2bool", "v2bool_t_f", "OpLogicalOr",
|
||||||
|
"v2bool_f_t", "__vec_2__bool",
|
||||||
|
AstFor("v2bool_t_f"), "logical_or",
|
||||||
|
AstFor("v2bool_f_t")}));
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace spirv
|
} // namespace spirv
|
||||||
} // namespace reader
|
} // namespace reader
|
||||||
|
Loading…
x
Reference in New Issue
Block a user