Skip to content

Support AH/FIZ from FEAT_AFP for independent DAZ and FTZ? #762

Description

@MikhailRyazanov

The flags for input and output denormals (DAZ and FTZ) are currently translated into the single FZ flag:

sse2neon/sse2neon.h

Lines 3272 to 3284 in 1741f18

// ARM Platform Behavior:
// - ARM FPCR/FPSCR bit 24 provides unified FZ+DAZ behavior. Setting either
// _MM_FLUSH_ZERO_ON or _MM_DENORMALS_ZERO_ON enables the same ARM bit.
// - ARMv7 NEON: "Flush-to-zero mode always enabled" per ARM ARM (impl may vary)
// - ARMv8: FPCR.FZ correctly controls denormal handling for NEON operations
FORCE_INLINE void _mm_setcsr(unsigned int a)
{
_MM_SET_ROUNDING_MODE(a & _MM_ROUND_MASK);
// ARM FPCR.bit24 handles both FZ and DAZ - set if either is requested
_MM_SET_FLUSH_ZERO_MODE(
(a & _MM_FLUSH_ZERO_MASK) |
((a & _MM_DENORMALS_ZERO_MASK) ? _MM_FLUSH_ZERO_ON : 0));
}

However, Armv8.7 introduced FEAT_AFP with the new flags AH (Alternate Handling) and FIZ (Flush Inputs to Zero) in the FPCR register that make the independent control of flushing denormal inputs and/or outputs to zero possible. Are there any plans to use this for a more correct translation of DAZ and FTZ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions