mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-06 14:43:31 +00:00
[spirv-writer] Add shift operators.
This CL adds generation for the OpShiftLeftLogical, OpShiftRightLogical and OpShiftRightArithmetic expressions. Bug: tint:5 Change-Id: I3436453350fc9afd3528b1ae238682b7abc6d636 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/19508 Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
parent
87a3f86155
commit
dc48af981a
@ -635,6 +635,12 @@ uint32_t Builder::GenerateBinaryExpression(ast::BinaryExpression* expr) {
|
|||||||
op = lhs_is_float_or_vec ? spv::Op::OpFOrdNotEqual : spv::Op::OpINotEqual;
|
op = lhs_is_float_or_vec ? spv::Op::OpFOrdNotEqual : spv::Op::OpINotEqual;
|
||||||
} else if (expr->IsOr()) {
|
} else if (expr->IsOr()) {
|
||||||
op = spv::Op::OpBitwiseOr;
|
op = spv::Op::OpBitwiseOr;
|
||||||
|
} else if (expr->IsShiftLeft()) {
|
||||||
|
op = spv::Op::OpShiftLeftLogical;
|
||||||
|
} else if (expr->IsShiftRight()) {
|
||||||
|
op = spv::Op::OpShiftRightLogical;
|
||||||
|
} else if (expr->IsShiftRightArith()) {
|
||||||
|
op = spv::Op::OpShiftRightArithmetic;
|
||||||
} else if (expr->IsSubtract()) {
|
} else if (expr->IsSubtract()) {
|
||||||
op = lhs_is_float_or_vec ? spv::Op::OpFSub : spv::Op::OpISub;
|
op = lhs_is_float_or_vec ? spv::Op::OpFSub : spv::Op::OpISub;
|
||||||
} else if (expr->IsXor()) {
|
} else if (expr->IsXor()) {
|
||||||
|
@ -120,11 +120,15 @@ TEST_P(BinaryArithSignedIntegerTest, Vector) {
|
|||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
BuilderTest,
|
BuilderTest,
|
||||||
BinaryArithSignedIntegerTest,
|
BinaryArithSignedIntegerTest,
|
||||||
testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpIAdd"},
|
testing::Values(
|
||||||
|
BinaryData{ast::BinaryOp::kAdd, "OpIAdd"},
|
||||||
BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"},
|
BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"},
|
||||||
BinaryData{ast::BinaryOp::kDivide, "OpSDiv"},
|
BinaryData{ast::BinaryOp::kDivide, "OpSDiv"},
|
||||||
BinaryData{ast::BinaryOp::kModulo, "OpSMod"},
|
BinaryData{ast::BinaryOp::kModulo, "OpSMod"},
|
||||||
BinaryData{ast::BinaryOp::kOr, "OpBitwiseOr"},
|
BinaryData{ast::BinaryOp::kOr, "OpBitwiseOr"},
|
||||||
|
BinaryData{ast::BinaryOp::kShiftLeft, "OpShiftLeftLogical"},
|
||||||
|
BinaryData{ast::BinaryOp::kShiftRight, "OpShiftRightLogical"},
|
||||||
|
BinaryData{ast::BinaryOp::kShiftRightArith, "OpShiftRightArithmetic"},
|
||||||
BinaryData{ast::BinaryOp::kSubtract, "OpISub"},
|
BinaryData{ast::BinaryOp::kSubtract, "OpISub"},
|
||||||
BinaryData{ast::BinaryOp::kXor, "OpBitwiseXor"}));
|
BinaryData{ast::BinaryOp::kXor, "OpBitwiseXor"}));
|
||||||
|
|
||||||
@ -203,11 +207,15 @@ TEST_P(BinaryArithUnsignedIntegerTest, Vector) {
|
|||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
BuilderTest,
|
BuilderTest,
|
||||||
BinaryArithUnsignedIntegerTest,
|
BinaryArithUnsignedIntegerTest,
|
||||||
testing::Values(BinaryData{ast::BinaryOp::kAdd, "OpIAdd"},
|
testing::Values(
|
||||||
|
BinaryData{ast::BinaryOp::kAdd, "OpIAdd"},
|
||||||
BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"},
|
BinaryData{ast::BinaryOp::kAnd, "OpBitwiseAnd"},
|
||||||
BinaryData{ast::BinaryOp::kDivide, "OpUDiv"},
|
BinaryData{ast::BinaryOp::kDivide, "OpUDiv"},
|
||||||
BinaryData{ast::BinaryOp::kModulo, "OpUMod"},
|
BinaryData{ast::BinaryOp::kModulo, "OpUMod"},
|
||||||
BinaryData{ast::BinaryOp::kOr, "OpBitwiseOr"},
|
BinaryData{ast::BinaryOp::kOr, "OpBitwiseOr"},
|
||||||
|
BinaryData{ast::BinaryOp::kShiftLeft, "OpShiftLeftLogical"},
|
||||||
|
BinaryData{ast::BinaryOp::kShiftRight, "OpShiftRightLogical"},
|
||||||
|
BinaryData{ast::BinaryOp::kShiftRightArith, "OpShiftRightArithmetic"},
|
||||||
BinaryData{ast::BinaryOp::kSubtract, "OpISub"},
|
BinaryData{ast::BinaryOp::kSubtract, "OpISub"},
|
||||||
BinaryData{ast::BinaryOp::kXor, "OpBitwiseXor"}));
|
BinaryData{ast::BinaryOp::kXor, "OpBitwiseXor"}));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user