| 92 | } |
| 93 | |
| 94 | spv_result_t ValidateLogicalCompare(ValidationState_t& _, |
| 95 | const Instruction* inst, |
| 96 | uint32_t operand_index = 2) { |
| 97 | const spv::Op opcode = inst->opcode(); |
| 98 | const uint32_t result_type = inst->type_id(); |
| 99 | if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type)) |
| 100 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 101 | << "Expected bool scalar or vector type as Result Type: " |
| 102 | << spvOpcodeString(opcode); |
| 103 | |
| 104 | const uint32_t operand_1 = _.GetOperandTypeId(inst, operand_index); |
| 105 | const uint32_t operand_2 = _.GetOperandTypeId(inst, operand_index + 1); |
| 106 | if (result_type != operand_1 || result_type != operand_2) |
| 107 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 108 | << "Expected both operands to be of Result Type: " |
| 109 | << spvOpcodeString(opcode); |
| 110 | return SPV_SUCCESS; |
| 111 | } |
| 112 | |
| 113 | spv_result_t ValidateLogicalNot(ValidationState_t& _, const Instruction* inst, |
| 114 | uint32_t operand_index = 2) { |
no test coverage detected