BF16 absolute value tests use correct intrinsic for vectorization.
BF16 absolute value tests now use __builtin_fabsf, enabling vectorization and preserving results.
Previously, BF16 absolute value tests used __builtin_fabsf16, which after a compiler change, caused the vectorizer to reject them due to an unnecessary intermediate conversion. This commit switches the tests to use __builtin_fabsf, which correctly handles BF16 input by promoting it to a float. This allows the vectorizer to process the loops again, yielding the same runtime results but improving code generation efficiency.
In Details
A recent change (r17-6689) in match.pd prevented the folding of __bf16 -> _Float16 -> __bf16 conversion chains. This fold was incorrect because the _Float16 conversion is semantically required. Consequently, __builtin_fabsf16 applied to a __bf16 value now keeps this conversion, which the vectorizer rejects. Since float represents all __bf16 values exactly, using __builtin_fabsf allows the compiler to emit code that correctly computes the absolute value of __bf16 types, enabling vectorization of the affected test cases.
- __bf16
- A 16-bit brain floating-point format, often used in machine learning applications. It offers a wider dynamic range than FP16 but less precision.
- _Float16
- A standard C floating-point type representing 16-bit floating-point numbers, similar to IEEE 754 half-precision.
- vectorizer
- A compiler component that transforms loops or operations to use SIMD (Single Instruction, Multiple Data) instructions, allowing parallel processing of multiple data elements.
- __builtin_fabsf
- A GCC built-in function that computes the absolute value of a single-precision floating-point number.
- __builtin_fabsf16
- A GCC built-in function (or extension) to compute the absolute value of a 16-bit floating-point number (like _Float16 or __bf16).