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

Function ValidateLogicalCompare

source/val/validate_logicals.cpp:94–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94spv_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
113spv_result_t ValidateLogicalNot(ValidationState_t& _, const Instruction* inst,
114 uint32_t operand_index = 2) {

Callers 1

LogicalsPassFunction · 0.85

Calls 7

spvOpcodeStringFunction · 0.85
IsBoolScalarTypeMethod · 0.80
IsBoolVectorTypeMethod · 0.80
diagMethod · 0.80
GetOperandTypeIdMethod · 0.80
opcodeMethod · 0.45
type_idMethod · 0.45

Tested by

no test coverage detected