This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hello! Attached patch rewrites nearbyint expanders. The problem with the current approach is, that setting mask flag of precision interrupt on x87 only prevents interrupt generation, but the insn still sets interrupt flag. fclex clears the flag, but it also clears other flags (e.g. invalid flag, set by sNaN). This issue can be "solved" by disabling x87 insn for flag_trapping_math. The flag is considered by other instructions (e.g. ceil, floor) as "we don't care if insn throws an exception"), so based on this reasoning, we can as well convert nearbyint to rint (which doesn't require complex control word set-up). There is no issue with traps with SSE 4.1 round instruction. This instruction can suppress generation of precision interrupt by setting ROUND_NO_EXC bit in its immediate operand. 2018-09-24 Uros Bizjak <ubizjak@gmail.com> * config/i386/i386.md (frndintxf2_mask_pm): Remove. (frndintxf2_mask_pm_i387): Ditto. (nearbyintxf2): Rewrite expander pattern to match rintxf2. Enable for !flag_trapping_math. (nearbyint<mode>2): Enable x87 modes for !flag_trapping_math. Enable SSE modes for TARGET_SSE4_1 and expand them with round insn. Change operand 1 predicate to nonimmediate_operand. (attr "i387_cw"): Remove mask_pm. * config/i386/i386.h (enum ix86_stack_slot): Remove SLOT_CW_MASK_PM. (enum ix86_entity): Remove I387_MASK_PM. * config/i386/i386.c (ix86_i387_mode_needed): Do not handle I387_MASK_PM. (ix86_mode_needed): Ditto. (ix86_mode_after): Ditto. (ix86_mode_entry): Ditto. (ix86_mode_exit): Ditto. (emit_i387_cw_initialization): Do not handle I387_CW_MASK_PM. Patch was bootstrapped and regression tested on x86_64-linux-gnu. I'll wait a bit for possible comments on the approach. Uros.
Attachment:
p.diff.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |