GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
alpha

Alpha correctly handles dynamic rounding-math

Alpha now honors -frounding-math by selecting dynamic rounding for floating-point operations.

Floating-point rounding modes on Alpha are controlled by instructions, which previously defaulted to static rounding. This commit modifies the default rounding mode to dynamic when -frounding-math is enabled and no specific rounding mode is provided. This ensures that runtime rounding mode changes are respected, fixing issues in several floating-point test cases.

In Details

Alpha FP instructions encode rounding modes directly. Previously, alpha_fprm defaulted to ALPHA_FPRM_NORM and was only altered by explicit -mfp-rounding-mode flags. This commit changes the default to ALPHA_FPRM_DYN when -frounding-math is active and -mfp-rounding-mode is not specified, ensuring that runtime rounding can be dynamically controlled. VAX floating-point instructions are unaffected due to their lack of dynamic rounding support.

For Context
-frounding-math
A GCC flag that enables dynamic rounding of floating-point operations, allowing the rounding mode to be changed at runtime.
Alpha FP instructions
Specific machine instructions for the Alpha architecture that handle floating-point arithmetic. Some of these instructions can directly encode the rounding mode.
FPCR
Floating-Point Control Register. A hardware register that controls various aspects of floating-point operations, including rounding modes on some architectures.
ALPHA_FPRM_DYN
A specific value representing dynamic rounding mode for Alpha's floating-point environment.
ALPHA_FPRM_NORM
A specific value representing normal (usually static) rounding mode for Alpha's floating-point environment.
VAX floating-point instructions
Floating-point instructions designed for the VAX architecture, which do not support dynamic rounding modes.
Filed Under: alphaoptimizationrounding-math