MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / ValidateBitCount

Function ValidateBitCount

source/val/validate_bitwise.cpp:204–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202}
203
204spv_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.
230spv_result_t BitwisePass(ValidationState_t& _, const Instruction* inst) {

Callers 1

BitwisePassFunction · 0.85

Calls 9

spvOpcodeStringFunction · 0.85
ValidateBaseTypeFunction · 0.85
IsIntScalarTypeMethod · 0.80
IsIntVectorTypeMethod · 0.80
diagMethod · 0.80
GetOperandTypeIdMethod · 0.80
GetDimensionMethod · 0.80
opcodeMethod · 0.45
type_idMethod · 0.45

Tested by

no test coverage detected