Support pending Intel extensions (#4116)
This patch supports new Intel extensions added via
https://github.com/KhronosGroup/SPIRV-Headers/pull/176
SPV_INTEL_fooat_controls2 requires extra support to add
two new operand types:
SPV_OPERAND_TYPE_FPDENORM_MODE
SPV_OPERAND_TYPE_FPOPERATION_MODE
diff --git a/include/spirv-tools/libspirv.h b/include/spirv-tools/libspirv.h
index 8f412a6..201ee58 100644
--- a/include/spirv-tools/libspirv.h
+++ b/include/spirv-tools/libspirv.h
@@ -260,6 +260,11 @@
SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_OPERATION, // Sec 3.6
SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_IMPORTED_ENTITY, // Sec 3.7
+ // The following are concrete enum types from SPV_INTEL_float_controls2
+ // https://github.com/intel/llvm/blob/39fa9b0cbfbae88327118990a05c5b387b56d2ef/sycl/doc/extensions/SPIRV/SPV_INTEL_float_controls2.asciidoc
+ SPV_OPERAND_TYPE_FPDENORM_MODE, // Sec 3.17 FP Denorm Mode
+ SPV_OPERAND_TYPE_FPOPERATION_MODE, // Sec 3.18 FP Operation Mode
+
// This is a sentinel value, and does not represent an operand type.
// It should come last.
SPV_OPERAND_TYPE_NUM_OPERAND_TYPES,
diff --git a/source/binary.cpp b/source/binary.cpp
index 75a997d..7448721 100644
--- a/source/binary.cpp
+++ b/source/binary.cpp
@@ -655,7 +655,9 @@
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_COMPOSITE_TYPE:
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_TYPE_QUALIFIER:
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_OPERATION:
- case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_IMPORTED_ENTITY: {
+ case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_IMPORTED_ENTITY:
+ case SPV_OPERAND_TYPE_FPDENORM_MODE:
+ case SPV_OPERAND_TYPE_FPOPERATION_MODE: {
// A single word that is a plain enum value.
// Map an optional operand type to its corresponding concrete type.
diff --git a/source/disassemble.cpp b/source/disassemble.cpp
index e763251..966a59c 100644
--- a/source/disassemble.cpp
+++ b/source/disassemble.cpp
@@ -326,7 +326,9 @@
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_COMPOSITE_TYPE:
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_TYPE_QUALIFIER:
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_OPERATION:
- case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_IMPORTED_ENTITY: {
+ case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_IMPORTED_ENTITY:
+ case SPV_OPERAND_TYPE_FPDENORM_MODE:
+ case SPV_OPERAND_TYPE_FPOPERATION_MODE: {
spv_operand_desc entry;
if (grammar_.lookupOperand(operand.type, word, &entry))
assert(false && "should have caught this earlier");
diff --git a/source/operand.cpp b/source/operand.cpp
index 6755eab..5a69fb2 100644
--- a/source/operand.cpp
+++ b/source/operand.cpp
@@ -265,6 +265,11 @@
case SPV_OPERAND_TYPE_IMAGE_CHANNEL_DATA_TYPE:
return "image channel data type";
+ case SPV_OPERAND_TYPE_FPDENORM_MODE:
+ return "FP denorm mode";
+ case SPV_OPERAND_TYPE_FPOPERATION_MODE:
+ return "FP operation mode";
+
case SPV_OPERAND_TYPE_NONE:
return "NONE";
default:
@@ -348,6 +353,8 @@
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_TYPE_QUALIFIER:
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_OPERATION:
case SPV_OPERAND_TYPE_CLDEBUG100_DEBUG_IMPORTED_ENTITY:
+ case SPV_OPERAND_TYPE_FPDENORM_MODE:
+ case SPV_OPERAND_TYPE_FPOPERATION_MODE:
return true;
default:
break;