Allow round for HFmode in i386 optab hook to aid vectorization.
Enables the 'round' operation for 16-bit float (HFmode) in the i386 backend's optab hook, preventing unnecessary conversions during vectorization.
This change updates the i386 backend’s ix86_optab_supported_p function to recognize the ‘round’ operation for HFmode (_Float16). Previously, this was not explicitly supported, leading to the compiler inserting unnecessary extend/truncate operations when vectorizing code that used _Float16 rounding. By allowing direct support, the compiler can avoid these extra operations, improving vectorization efficiency.
In Details
Aligns the ix86_optab_supported_p hook with the behavior of ceil, floor, and btrunc by returning true for round_optab in HFmode. This prevents match.pd from narrowing (_Float16) round ((double) x) to a direct internal function when OPTIMIZE_FOR_BOTH is active, thereby avoiding enforced extend/truncate operations during vectorization.
- HFmode
- GCC's internal mode for representing the 16-bit floating-point type, commonly known as _Float16.
- optab hook
- A mechanism in GCC where backend-specific functions are called to determine if an operation is supported or to retrieve information about it, often used for optimization and code generation.
- vectorization
- An optimization technique where the compiler transforms code to operate on multiple data elements simultaneously using SIMD (Single Instruction, Multiple Data) instructions.
- i386
- Refers to the x86 instruction set architecture, commonly used in desktop and server processors. In this context, it specifies the target architecture for the GCC compiler.