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

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 4 04:29:16 PDT 2025


================
@@ -995,6 +1012,22 @@ unsigned getArrayComponentCount(const MachineRegisterInfo *MRI,
   return foldImm(ResType->getOperand(2), MRI);
 }
 
+size_t computeFPFastMathDefaultInfoVecIndex(size_t BitWidth) {
+  switch (BitWidth) {
+  case 16: // half
+    return 0;
+  case 32: // float
+    return 1;
+  case 64: // double
+    return 2;
+  default:
+    report_fatal_error("Expected BitWidth to be 16, 32, 64", false);
+  }
+  assert(false && "Unreachable code");
+  // This return is just to avoid compiler warnings.
+  return 0;
----------------
Keenuts wrote:

Does this works here?
```suggestion
  llvm_unreachable();
```

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


More information about the llvm-commits mailing list