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

Marcos Maronas via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 07:21:17 PDT 2025


maarquitos14 wrote:

@Keenuts I have updated this PR to make `FPFastMathDefault` use constant instructions instead of immediates for the bitmask. A summary of the update: I added a new function in `SPIRVEmitIntrinsics` where I go through the `FPFastMathDefault/ContractionOff/SignedZeroInfNanPreserve` metadata, and create constants for the values that will be required for these execution modes. Then, in `SPIRVAsmPrinter`, I loop over the constants in the module and I build a hashtable where the key is the immediate value, and the value is the `MachineInstr` representing the constant. Then, when outputting the `OpExecutionMode` the hashtable is queried to get the constant. I think this was the least intrusive way of proceeding, but I'm open to suggestions :)

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


More information about the llvm-commits mailing list