[llvm] [RFC][SPIR-V] Add llvm.arbitrary.fp.convert intrinsic (PR #164252)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 29 02:41:19 PDT 2025


================
@@ -21406,6 +21406,69 @@ environment <floatenv>` *except* for the rounding mode.
 This intrinsic is not supported on all targets. Some targets may not support
 all rounding modes.
 
+'``llvm.arbitrary.fp.convert``' Intrinsic
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Syntax:
+"""""""
+
+::
+
+      declare <type> @llvm.arbitrary.fp.convert(
+          <type> <value>, metadata <result interpretation>,
+          metadata <input interpretation>, metadata <rounding mode>,
+          i32 <saturation>)
+
+Overview:
+"""""""""
+
+The ``llvm.arbitrary.fp.convert`` intrinsic performs conversions
+between values whose interpretation differs from their representation
+in LLVM IR. The intrinsic is overloaded on both its return type and first
+argument. Metadata operands describe how the raw bits should be interpreted
+before and after the conversion.
----------------
Keenuts wrote:

If there are 2 intrinsics, then it's simpler to avoid overlap with existing instructions for IR -> IR (which may be a good thing?)
Isel should be able to fold the 2 into a single exotic->exotic instruction if available for the target no?

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


More information about the llvm-commits mailing list