| 63 | } |
| 64 | |
| 65 | spv_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 | |
| 94 | spv_result_t ValidateLogicalCompare(ValidationState_t& _, |
| 95 | const Instruction* inst, |
no test coverage detected