Add 16-bit floating point support to PowerPC
Introduces support for 16-bit floating-point types (_Float16 and __bf16) on little-endian 64-bit PowerPC systems.
This extensive commit adds support for two 16-bit floating-point formats, _Float16 and __bf16, to GCC for little-endian 64-bit PowerPC architectures. It introduces new compiler flags (-mfloat16, -mno-float16) and configuration options to control this support, enabling it by default on relevant systems. The implementation details how these 16-bit values are passed and returned in registers and memory, leveraging specific PowerPC instructions.
In Details
This patch introduces support for _Float16 (IEEE 754-2008 binary16) and __bf16 (bfloat16) to little-endian 64-bit PowerPC targets. New options -mfloat16/-mno-float16 and --with-powerpc-float16/--without-powerpc-float16 are added. Scalar 16-bit values are passed/returned in bits 48-63 of vector registers using instructions like lxsihzx and stxsihzx, while 128-bit vector 16-bit floats use Altivec registers. Macros __FLOAT16__, __BFLOAT16__, __FLOAT16_HW__, and __BFLOAT16_HW__ are defined based on hardware support.
- PowerPC
- A RISC instruction set architecture developed by Apple, IBM, and Motorola. GCC supports various PowerPC processor families.
- _Float16
- A GCC extension representing the IEEE 754-2008 binary16 floating-point format, which uses 16 bits (1 sign, 5 exponent, 10 mantissa).
- __bf16
- A GCC extension representing the bfloat16 format, a 16-bit floating-point format commonly used in machine learning, which has 1 sign, 8 exponent, and 7 mantissa bits.
- little-endian
- A byte order where the least significant byte of a multi-byte word is stored at the lowest memory address. PowerPC can operate in either big-endian or little-endian mode.
- Altivec
- A SIMD (Single Instruction, Multiple Data) instruction set extension for PowerPC processors, designed for high-performance multimedia and vector processing.
- SIMD
- Single Instruction, Multiple Data. A class of parallel computers in Flynn's taxonomy. SIMD instructions allow a single operation to be performed on multiple data points simultaneously, significantly speeding up vector and array processing.