aboutsummaryrefslogtreecommitdiff
path: root/source/val/validate_extensions.cpp
diff options
context:
space:
mode:
authorToomas Remmelg <toomas.remmelg@codeplay.com>2019-08-15 14:38:37 +0100
committeralan-baker <alanbaker@google.com>2019-08-15 09:38:37 -0400
commit7b4e5bd5ec823b1ae76dbfc972632a87682c33ac (patch)
treee0deff3e0eaf83800da1c0efdcec60d8c869e008 /source/val/validate_extensions.cpp
parentdac9210dcb324a26c729f55a6e2010019c79fbc6 (diff)
downloadSPIRV-Tools-7b4e5bd5ec823b1ae76dbfc972632a87682c33ac.tar.gz
Update remquo validation to match the OpenCL Extended Instruction Set Specification (#2791)
Diffstat (limited to 'source/val/validate_extensions.cpp')
-rw-r--r--source/val/validate_extensions.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/source/val/validate_extensions.cpp b/source/val/validate_extensions.cpp
index ec769db8..1a646059 100644
--- a/source/val/validate_extensions.cpp
+++ b/source/val/validate_extensions.cpp
@@ -923,8 +923,7 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
case OpenCLLIB::Fract:
case OpenCLLIB::Modf:
- case OpenCLLIB::Sincos:
- case OpenCLLIB::Remquo: {
+ case OpenCLLIB::Sincos: {
if (!_.IsFloatScalarOrVectorType(result_type)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< ext_inst_name() << ": "
@@ -939,24 +938,14 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
"3, 4, 8 or 16 components";
}
- uint32_t operand_index = 4;
- const uint32_t x_type = _.GetOperandTypeId(inst, operand_index++);
+ const uint32_t x_type = _.GetOperandTypeId(inst, 4);
if (result_type != x_type) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< ext_inst_name() << ": "
<< "expected type of operand X to be equal to Result Type";
}
- if (ext_inst_key == OpenCLLIB::Remquo) {
- const uint32_t y_type = _.GetOperandTypeId(inst, operand_index++);
- if (result_type != y_type) {
- return _.diag(SPV_ERROR_INVALID_DATA, inst)
- << ext_inst_name() << ": "
- << "expected type of operand Y to be equal to Result Type";
- }
- }
-
- const uint32_t p_type = _.GetOperandTypeId(inst, operand_index++);
+ const uint32_t p_type = _.GetOperandTypeId(inst, 5);
uint32_t p_storage_class = 0;
uint32_t p_data_type = 0;
if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) {
@@ -985,7 +974,8 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
}
case OpenCLLIB::Frexp:
- case OpenCLLIB::Lgamma_r: {
+ case OpenCLLIB::Lgamma_r:
+ case OpenCLLIB::Remquo: {
if (!_.IsFloatScalarOrVectorType(result_type)) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< ext_inst_name() << ": "
@@ -1000,14 +990,24 @@ spv_result_t ValidateExtInst(ValidationState_t& _, const Instruction* inst) {
"3, 4, 8 or 16 components";
}
- const uint32_t x_type = _.GetOperandTypeId(inst, 4);
+ uint32_t operand_index = 4;
+ const uint32_t x_type = _.GetOperandTypeId(inst, operand_index++);
if (result_type != x_type) {
return _.diag(SPV_ERROR_INVALID_DATA, inst)
<< ext_inst_name() << ": "
<< "expected type of operand X to be equal to Result Type";
}
- const uint32_t p_type = _.GetOperandTypeId(inst, 5);
+ if (ext_inst_key == OpenCLLIB::Remquo) {
+ const uint32_t y_type = _.GetOperandTypeId(inst, operand_index++);
+ if (result_type != y_type) {
+ return _.diag(SPV_ERROR_INVALID_DATA, inst)
+ << ext_inst_name() << ": "
+ << "expected type of operand Y to be equal to Result Type";
+ }
+ }
+
+ const uint32_t p_type = _.GetOperandTypeId(inst, operand_index++);
uint32_t p_storage_class = 0;
uint32_t p_data_type = 0;
if (!_.GetPointerTypeInfo(p_type, &p_data_type, &p_storage_class)) {