[llvm] [SPIR-V] Implement SPV_KHR_float_controls2 (PR #146941)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 04:25:34 PDT 2025


================
@@ -589,3 +589,30 @@ Group and Subgroup Operations
 For workgroup and subgroup operations, LLVM uses function calls to represent SPIR-V's
 group-based instructions. These builtins facilitate group synchronization, data sharing,
 and collective operations essential for efficient parallel computation.
+
+SPIR-V Instructions Mapped to LLVM Metadata
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Some SPIR-V instructions don't have a direct equivalent in the LLVM IR language. To
+address this, the SPIR-V Target uses different specific LLVM named metadata to convey
+the necessary information. The SPIR-V specification allows multiple module-scope
+instructions, where as LLVM named metadata must be unique. Therefore, the encoding of
+such instructions has the following format:
+
+.. code-block:: llvm
+
+  !spirv.<OpCodeName> = !{!<InstructionMetadata1>, !<InstructionMetadata2>, ..}
+  !<InstructionMetadata1> = !{<Operand1>, <Operand2>, ..}
+  !<InstructionMetadata2> = !{<Operand1>, <Operand2>, ..}
+
+Below, you will find the mappings between SPIR-V instruction and their corresponding
+LLVM IR representations.
++--------------------+---------------------------------------------------------+
----------------
MrSidims wrote:

[Formatting is screwed](https://github.com/llvm/llvm-project/blob/00548e5b0f61e2b22416bdcc5cc069a133c2943b/llvm/docs/SPIRVUsage.rst), I suspect an empty line is missing before the table.

https://github.com/llvm/llvm-project/pull/146941


More information about the llvm-commits mailing list