================
@@ -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**:
+
+`bits` is a non-Boolean, non-enumeration integer or a supported fixed-length 
vector of such integers holding the encoded floating-point value.
+The result is a scalar for a scalar input or a vector with the same number of 
elements for a vector input.
+Supported vector kinds are GNU `vector_size` and Clang/OpenCL 
`ext_vector_type`.
+The result preserves which of those two vector kinds the input uses.
+Sizeless vectors and target-specific fixed-length vector kinds are rejected.
+Preserving both the lane count and a target-specific vector kind after widening
+the element type can produce an invalid type or ABI combination, such as a
+widened NEON vector.
----------------
MrSidims wrote:

I believe it's useful for a compiler developer, but not for a user. So I'd 
remove it from this document.

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