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

Function ValidateFloatCompare

source/val/validate_logicals.cpp:65–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65spv_result_t ValidateFloatCompare(ValidationState_t& _,
66 const Instruction* inst) {
67 const spv::Op opcode = inst->opcode();
68 const uint32_t result_type = inst->type_id();
69 if (!_.IsBoolScalarType(result_type) && !_.IsBoolVectorType(result_type))
70 return _.diag(SPV_ERROR_INVALID_DATA, inst)
71 << "Expected bool scalar or vector type as Result Type: "
72 << spvOpcodeString(opcode);
73
74 const uint32_t left_operand_type = _.GetOperandTypeId(inst, 2);
75 if (!left_operand_type || (!_.IsFloatScalarType(left_operand_type) &&
76 !_.IsFloatVectorType(left_operand_type)))
77 return _.diag(SPV_ERROR_INVALID_DATA, inst)
78 << "Expected operands to be scalar or vector float: "
79 << spvOpcodeString(opcode);
80
81 if (_.GetDimension(result_type) != _.GetDimension(left_operand_type))
82 return _.diag(SPV_ERROR_INVALID_DATA, inst)
83 << "Expected vector sizes of Result Type and the operands to be "
84 "equal: "
85 << spvOpcodeString(opcode);
86
87 if (left_operand_type != _.GetOperandTypeId(inst, 3))
88 return _.diag(SPV_ERROR_INVALID_DATA, inst)
89 << "Expected left and right operands to have the same type: "
90 << spvOpcodeString(opcode);
91 return SPV_SUCCESS;
92}
93
94spv_result_t ValidateLogicalCompare(ValidationState_t& _,
95 const Instruction* inst,

Callers 1

LogicalsPassFunction · 0.85

Calls 10

spvOpcodeStringFunction · 0.85
IsBoolScalarTypeMethod · 0.80
IsBoolVectorTypeMethod · 0.80
diagMethod · 0.80
GetOperandTypeIdMethod · 0.80
IsFloatScalarTypeMethod · 0.80
IsFloatVectorTypeMethod · 0.80
GetDimensionMethod · 0.80
opcodeMethod · 0.45
type_idMethod · 0.45

Tested by

no test coverage detected