https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71277
Bug ID: 71277 Summary: SSE4.1 rounding generation should not depend on flag_trapping_math Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jsm28 at gcc dot gnu.org Target Milestone: --- Target: i?86-*-* x86_64-*-* For SSE4.1 code generation, i386.md supports inlining calls to rint / ceil / floor / trunc and the float versions thereof with the roundsd / roundss instructions. But this is conditioned on !flag_trapping_math. It should not be so conditioned: * For rint, the instruction raises exactly the desired exceptions. * For ceil / floor / trunc, "inexact" should properly not be raised as per TS 18661-1. The instruction used right now does raise "inexact", but you just need to OR 8 (ROUND_NO_EXC) into the immediate operand to avoid raising "inexact". (For avoidance of doubt, this bug report is only about those built-in functions, not about the more complicated code generation for the "round" function, where it's likely "inexact" would be harder to avoid.)