https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120691
--- Comment #20 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by H.J. Lu <[email protected]>: https://gcc.gnu.org/g:3dcf3410a743867a0744d3a3d737b2e0b9c035ac commit r16-4276-g3dcf3410a743867a0744d3a3d737b2e0b9c035ac Author: H.J. Lu <[email protected]> Date: Sat Aug 30 11:46:31 2025 -0700 libbid: Set rounding mode to round-to-nearest for _Decimal128 arithmetic Since _Decimal128 arithmetic requires the round-to-nearest rounding mode, define DFP_INIT_ROUNDMODE and DFP_RESTORE_ROUNDMODE, similar to FP_INIT_ROUNDMODE in sfp-machine.h, to set the rounding mode to round-to-nearest at _Decimal128 related arithmetic function entrances and restores it upon return. This doesn't require linking with libm when libgcc is used. libgcc/ PR target/120691 * Makefile.in (DECNUMINC): Add -I$(srcdir)/config/$(cpu_type). * config/i386/dfp-machine.h: New file. * config/i386/32/dfp-machine.h: Likewise. * config/i386/64/dfp-machine.h: Likewise. libgcc/config/libbid/ PR target/120691 * bid128_div.c: Run DFP_INIT_ROUNDMODE at function entrace and DFP_RESTORE_ROUNDMODE at function exit. * bid128_rem.c: Likewise. * bid128_sqrt.c: Likewise. * bid64_div.c (bid64_div): Likewise. * bid64_sqrt.c (bid64_sqrt): Likewise. * bid_conf.h: Include <dfp-machine.h>. * dfp-machine.h: New file. gcc/testsuite/ PR target/120691 * gcc.target/i386/pr120691.c: New test. Signed-off-by: H.J. Lu <[email protected]>
