================
@@ -3682,6 +3682,103 @@ C-style cast applied to each element of the first 
argument.
 
 Query for this feature with `__has_builtin(__builtin_convertvector)`.
 
+(langext-builtin-elementwise-convert-from-arbitrary-fp)=
+
+### `__builtin_elementwise_convert_from_*`
+
+The `__builtin_elementwise_convert_from_*` family interprets an integer as the 
bits of a narrow floating-point format that has no corresponding C type and 
converts it to a native floating-point type.
+
+**Syntax**:
+
+```c++
+__builtin_elementwise_convert_from_<source_format>_<destination_type>(bits)
+```
+
+**Examples**:
+
+```c++
+typedef unsigned char uchar4 __attribute__((ext_vector_type(4)));
+typedef float float4 __attribute__((ext_vector_type(4)));
+
+unsigned char b; uchar4 vb;
+
+// Interpret b as a Float8E4M3FN value and widen it to _Float16.
+__builtin_elementwise_convert_from_f8e4m3fn_f16(b)
+
+// The same, elementwise, for four Float8E5M2 values.
+__builtin_elementwise_convert_from_f8e5m2_f32(vb)
+```
+
+**Description**:
----------------
chinmaydd wrote:

Thanks, added to the documentation. The conversion is exact or overflows to 
infinity, so rounding mode has no effect. Under `-ffinite-math-only` the call 
gets `nnan ninf`, so NaN or inf results are
undefined, as with other FP ops.

https://github.com/llvm/llvm-project/pull/212647
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to