| 202 | } |
| 203 | |
| 204 | spv_result_t ValidateBitCount(ValidationState_t& _, const Instruction* inst) { |
| 205 | const spv::Op opcode = inst->opcode(); |
| 206 | const uint32_t result_type = inst->type_id(); |
| 207 | if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type)) |
| 208 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 209 | << "Expected int scalar or vector type as Result Type: " |
| 210 | << spvOpcodeString(opcode); |
| 211 | |
| 212 | const uint32_t base_type = _.GetOperandTypeId(inst, 2); |
| 213 | |
| 214 | if (spv_result_t error = ValidateBaseType(_, inst, base_type)) { |
| 215 | return error; |
| 216 | } |
| 217 | |
| 218 | const uint32_t base_dimension = _.GetDimension(base_type); |
| 219 | const uint32_t result_dimension = _.GetDimension(result_type); |
| 220 | |
| 221 | if (base_dimension != result_dimension) |
| 222 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 223 | << "Expected Base dimension to be equal to Result Type " |
| 224 | "dimension: " |
| 225 | << spvOpcodeString(opcode); |
| 226 | return SPV_SUCCESS; |
| 227 | } |
| 228 | |
| 229 | // Validates correctness of bitwise instructions. |
| 230 | spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst) { |
no test coverage detected