================ @@ -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**: ---------------- MrSidims wrote:
I believe the document should also mention, that fp environment has no effect on the builtins behaviour. I also wonder what is the expected behaviour of -ffinite-math-only and so also -ffast-math flag when a code with the builtins is compiled. https://github.com/llvm/llvm-project/pull/212647 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
