[Bug middle-end/107723] lround/ceil/floor with -fno-fp-int-builtin-inexact
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107723 Andrew Pinski changed: What|Removed |Added Summary|RISC-V lround/ceil/floor|lround/ceil/floor with |with|-fno-fp-int-builtin-inexact |-fno-fp-int-builtin-inexact | Component|target |middle-end --- Comment #1 from Andrew Pinski --- This is not a target issue though. As x86_64 produces: ceilh: sub rsp, 8 callceil add rsp, 8 cvttsd2si rax, xmm0 ret cvttsd2si will raise inexact also.
[Bug middle-end/107723] lround/ceil/floor with -fno-fp-int-builtin-inexact
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107723 --- Comment #2 from Andrew Pinski --- Hmm, only lround is documented and the other two are not, I filed PR 107724 for the missing documentation.
[Bug middle-end/107723] lround/ceil/floor with -fno-fp-int-builtin-inexact
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107723 --- Comment #3 from Kevin Lee --- aarch64 also produces ceil1: fcvtps x0, d0 ret Since it has been changed to middle-end, I'll delete riscv as the target
[Bug middle-end/107723] lround/ceil/floor with -fno-fp-int-builtin-inexact
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107723 Xi Ruoyao changed: What|Removed |Added Ever confirmed|0 |1 Last reconfirmed||2023-11-17 CC||xry111 at gcc dot gnu.org Status|UNCONFIRMED |NEW --- Comment #4 from Xi Ruoyao --- long x(double y) { return __builtin_trunc(y); } In 005t.original (!) it's already "optimized" to { return (long int) y; } Despite -fno-fp-int-builtin-inexact is set.
[Bug middle-end/107723] lround/ceil/floor with -fno-fp-int-builtin-inexact
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107723 --- Comment #5 from GCC Commits --- The master branch has been updated by Xi Ruoyao : https://gcc.gnu.org/g:99182ea09f10beca8445396cbab491899536f5c3 commit r14-6455-g99182ea09f10beca8445396cbab491899536f5c3 Author: Xi Ruoyao Date: Fri Nov 24 11:08:19 2023 +0800 Only allow (int)trunc(x) to (int)x simplification with -ffp-int-builtin-inexact [PR107723] With -fno-fp-int-builtin-inexact, trunc is not allowed to raise FE_INEXACT and it should produce an integral result (if the input is not NaN or Inf). Thus FE_INEXACT should not be raised. But (int)x may raise FE_INEXACT when x is a non-integer, non-NaN, and non-Inf value. C23 recommends to do so in a footnote. Thus we should not simplify (int)trunc(x) to (int)x if -fno-fp-int-builtin-inexact is in-effect. gcc/ChangeLog: PR middle-end/107723 * convert.cc (convert_to_integer_1) [case BUILT_IN_TRUNC]: Break early if !flag_fp_int_builtin_inexact and flag_trapping_math. gcc/testsuite/ChangeLog: PR middle-end/107723 * gcc.dg/torture/builtin-fp-int-inexact-trunc.c: New test.