GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
i386

i386: Fix CCMP instruction support checks for floating-point modes

Ensures CCMP instruction generation respects available floating-point instruction set support on x86.

This commit corrects how the GCC compiler checks for support of the CCMP instruction on i386 targets when dealing with floating-point comparisons. Previously, the compiler might attempt to generate CCMP sequences for modes like DFmode (double-precision) or SFmode (single-precision) without verifying that the necessary hardware instruction sets (like SSE or AVX512FP16) were enabled. The fix restricts the use of CCMP based on the target’s floating-point capabilities, preventing incorrect code generation.

In Details

The ix86_gen_ccmp_first function in gcc/config/i386/i386-expand.cc is modified to properly check the availability of floating-point instruction sets before generating CCMP instructions. Previously, it accepted DFmode, SFmode, and HFmode comparisons without sufficient checks against target features. The updated logic constrains XFmode to x87, DFmode/SFmode to x87 or SSE with SSE math, and HFmode to AVX512FP16 targets, aligning code generation with hardware capabilities.

For Context
i386
Refers to the x86 instruction set architecture, starting with the Intel 80386 processor. GCC's i386 backend handles code generation for this architecture and its extensions.
CCMP instruction
A specific x86 instruction used for conditional comparison, often related to floating-point operations, that can conditionally set a register based on a comparison result.
floating-point modes
Representations of floating-point numbers within the compiler, such as SFmode (single-precision, 32-bit float), DFmode (double-precision, 64-bit double), and HFmode (half-precision, 16-bit float).
SSE
Streaming SIMD Extensions, a set of instructions for x86 processors that accelerates multimedia and scientific applications. SSE includes instructions for floating-point operations.
AVX512FP16
An extension to the AVX-512 instruction set that adds support for 16-bit (half-precision) floating-point operations.
x87
A set of floating-point math instructions introduced by the Intel 8087 coprocessor and integrated into x86 processors. It provides complex floating-point arithmetic capabilities.
Filed Under: i386compileroptimizationfloating point