https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127055

--- Comment #30 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Matthias Kretz <[email protected]>:

https://gcc.gnu.org/g:19fbd361c496ffc75cb20e9245031a506d4f0d9a

commit r17-3783-g19fbd361c496ffc75cb20e9245031a506d4f0d9a
Author: Matthias Kretz <[email protected]>
Date:   Tue Aug 25 17:06:28 2026 +0200

    x86: Vectorize floor/ceil/trunc also with trapping-math [PR127055]

    floor, ceil, and trunc are compiled to vrounds[sd] and vrndscales[sdh]
    with flag_trapping_math. The packed instructions were only allowed with
    !flag_trapping_math, even though there is no observable difference from
    executing vroundss 4 times or vroundps once.

    According to ISO 60559, "these operations shall not signal any exception
    except for signaling NaN input". Consequently, the vector instructions
    with ROUND_NO_EXC are doing exactly that.

    The 'round' function still requires !flag_trapping_math because it uses
    a floating-point add, which can signal inexact (at least).

    gcc/ChangeLog:

            PR target/127055
            * config/i386/sse.md (floor<mode>2): Drop !flag_trapping_math.
            (lfloor<mode><sseintvecmodelower>2): Likewise.
            (ceil<mode>2): Likewise.
            (lceil<mode><sseintvecmodelower>2): Likewise.
            (btrunc<mode>2): Likewise.

    gcc/testsuite/ChangeLog:

            * gcc.target/i386/avx-pr127055.c: New test.
            * gcc.target/i386/avx512f-pr127055.c: New test.
            * gcc.target/i386/avx512fp16-pr127055.c: New test.
            * gcc.target/i386/sse4_1-pr127055.c: New test.

    Signed-off-by: Matthias Kretz <[email protected]>

Reply via email to