================
@@ -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.
+
+The source format suffix determines the interpretation and required integer 
element width:
+
+| Suffix       | Source format  | Width |
+| ------------ | -------------- | ----- |
+| `f8e5m2`     | `Float8E5M2`   | 8     |
+| `f8e4m3fn`   | `Float8E4M3FN` | 8     |
+| `f8e5m3fnu`  | `Float8E5M3FNU`| 8     |
+
+The destination suffix determines the result element type:
+
+| Suffix | Result element type |
+| ------ | ------------------- |
+| `f16`  | `_Float16`          |
+| `bf16` | `__bf16`            |
+| `f32`  | `float`             |
+
+The `f16` suffix denotes `_Float16` in every language mode, including OpenCL.
+The three source suffixes and three destination suffixes form exactly nine
+builtin spellings.
----------------
MrSidims wrote:

Looks redundant.

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