| 402 | } |
| 403 | |
| 404 | const analysis::Constant* FoldTranspose( |
| 405 | IRContext* context, Instruction* inst, |
| 406 | const std::vector<const analysis::Constant*>& constants) { |
| 407 | assert(inst->opcode() == spv::Op::OpTranspose); |
| 408 | |
| 409 | analysis::TypeManager* type_mgr = context->get_type_mgr(); |
| 410 | if (!inst->IsFloatingPointFoldingAllowed()) { |
| 411 | if (HasFloatingPoint(type_mgr->GetType(inst->type_id()))) { |
| 412 | return nullptr; |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | const analysis::Constant* matrix = constants[0]; |
| 417 | if (matrix == nullptr) { |
| 418 | return nullptr; |
| 419 | } |
| 420 | |
| 421 | auto* result_type = type_mgr->GetType(inst->type_id()); |
| 422 | return TransposeMatrix(matrix, result_type->AsMatrix(), context); |
| 423 | } |
| 424 | |
| 425 | ConstantFoldingRule FoldVectorTimesMatrix() { |
| 426 | return [](IRContext* context, Instruction* inst, |
nothing calls this directly
no test coverage detected