Bug 71278 - Inline nearbyint for SSE4.1
Summary: Inline nearbyint for SSE4.1
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 6.0
: P3 enhancement
Target Milestone: 9.0
Assignee: Uroš Bizjak
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2016-05-25 14:21 UTC by Joseph S. Myers
Modified: 2018-09-26 15:02 UTC (History)
0 users

See Also:
Host:
Target: i?86-*-* x86_64-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph S. Myers 2016-05-25 14:21:32 UTC
For SSE4.1, the nearbyint and nearbyintf functions should be inlined using the roundsd / roundss instructions with immediate operand 12.  (There's already support for inlining rint and rintf with immediate operand 4, though as noted in bug 71277 this is wrongly conditioned on !flag_trapping_math.)
Comment 1 Uroš Bizjak 2018-09-26 15:01:49 UTC
Author: uros
Date: Tue Sep 25 14:26:11 2018
New Revision: 264571

URL: https://gcc.gnu.org/viewcvs?rev=264571&root=gcc&view=rev
Log:
	PR target/71278
	* 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.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.h
    trunk/gcc/config/i386/i386.md
    trunk/gcc/reg-stack.c
Comment 2 Uroš Bizjak 2018-09-26 15:02:47 UTC
Fixed for gcc-9.