Bug 28806 - lround is not expanded inline to SSE conversion sequence
Summary: lround is not expanded inline to SSE conversion sequence
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P3 enhancement
Target Milestone: 4.3.0
Assignee: Richard Biener
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: missed-optimization
Depends on:
Blocks: 28177
  Show dependency treegraph
 
Reported: 2006-08-22 15:00 UTC by Richard Biener
Modified: 2006-10-28 18:23 UTC (History)
1 user (show)

See Also:
Host:
Target: x86_64-*-*, i?86-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-08-22 15:01:10


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Biener 2006-08-22 15:00:25 UTC
The C99 lround function should be expanded inline to
  (long)(x + copysign (0.5, x))
Comment 1 Richard Biener 2006-08-22 15:01:10 UTC
Mine.  I have a patch in testing.
Comment 2 Richard Biener 2006-10-28 11:31:01 UTC
Subject: Bug 28806

Author: rguenth
Date: Sat Oct 28 11:30:41 2006
New Revision: 118105

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118105
Log:
2006-10-28  Richard Guenther  <rguenther@suse.de>

	PR target/28806
	* builtins.c (expand_builtin_int_roundingfn_2): Expand
	BUILT_IN_LROUND and BUILT_IN_LLROUND from here.
	(expand_builtin): Adjust likewise.
	* genopinit.c (optabs[]): Add lround optab.
	* optabs.c (init_optabs): Initialize lround_optab.
	* optabs.h (enum convert_optab_index): Add COI_lround.
	(lround_optab): Define.
	* config/i386/i386-protos.h (ix86_expand_lround): Declare.
	* config/i386/i386.c (ix86_sse_copysign_to_positive): New
	static function.
	(ix86_expand_lround): New function.
	* config/i386/i386.md (lround<mode>di2, lround<mode>si2):
	New expanders.
	* doc/md.texi (lroundMN2): Document.

	* gcc.target/i386/math-torture/lround.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.target/i386/math-torture/lround.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c
    trunk/gcc/config/i386/i386-protos.h
    trunk/gcc/config/i386/i386.c
    trunk/gcc/config/i386/i386.md
    trunk/gcc/doc/md.texi
    trunk/gcc/genopinit.c
    trunk/gcc/optabs.c
    trunk/gcc/optabs.h
    trunk/gcc/testsuite/ChangeLog

Comment 3 Andrew Pinski 2006-10-28 18:22:39 UTC
Fixed.