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]

[comitted]: Revert 80387 register argument passing patch


Hello!

My -mx87regparm patch that enabled FP arguments passing through x87
registers caused miscompilation of register argument passing (PR
target/30120).

Although all problems, exposed in PR target/30120, could be solved by
setting the stack layout of entry block and correcting ouptut stack of
entry block to input stack of successor BB on each edge from entry
block, the usolvable problems arise due to handling of "uninitialized"
variables.

Currently, gcc blindly emits "fld (nan)" for _each_ uninitialized
variable on the edge from entry block. "Uninitialized" in sense of
"live at entry" and this simply can't be mixed with register passing
"live" variables. "fld (nan)" was always emitted in such way that it
was put in st(0) /thus, corrupting stack layout/, so we would sooner
or later trip on wrong mixture of uninitialized and regpassing
variables that would silently corrupt stack-passed arguments.

The unfortunate conclusion of all this mess is, that variables simply
can't be passed in stack, although reg-stack.c in some way advertises
this funcitonality (look for the comment in subst_stack_regs()).

As speed gains were not that spectacular (if any at all, beacuse insn
with memory operands are as fast as other insn), and thus a lot more
pain than gain was introduced, I reverted the patch.


2006-12-11 Uros Bizjak <ubizjak@gmail.com>


	PR target/30120
	Revert:
	2006-11-15  Uros Bizjak  <ubizjak@gmail.com>

* config/i386/i386.opt: New target option -mx87regparm.

	* config/i386/i386.h (struct ix86_args): Add x87_nregs, x87_regno,
	float_in_x87: Add new variables. mmx_words, sse_words: Remove.
	(X87_REGPARM_MAX): Define.

	* config/i386/i386.c (override_options): Error out for
	-mx87regparm but no 80387 support.
	(ix86_attribute_table): Add x87regparm.
	(ix86_handle_cconv_attribute): Update comments for x87regparm.
	(ix86_comp_type_attributes): Check for mismatched x87regparm types.
	(ix86_function_x87regparm): New function.
	(ix86_function_arg_regno_p): Add X87_REGPARM_MAX 80387 floating
	point registers.
	(init_cumulative_args): Initialize x87_nregs and float_in_x87
	variables.
	(function_arg_advance): Process x87_nregs and x87_regno when
	floating point argument is to be passed in 80387 register.
	(function_arg): Pass XFmode arguments in 80387 registers for local
	functions.  Pass SFmode and DFmode arguments to local functions
	in 80387 registers when flag_unsafe_math_optimizations is set.

	* reg-stack.c (convert_regs_entry): Disable NaN load for
	stack registers that are used for argument passing.

	* doc/extend.texi: Document x87regparm function attribute.
	* doc/invoke.texi: Document -mx87regparm.

testsuite/ChangeLog:

	PR target/30120
	* gcc.target/i386/pr30120.c: New test.
	Revert:
	2006-11-15  Uros Bizjak  <ubizjak@gmail.com>

	* gcc.target/i386/x87regparm-1.c: New test.
	* gcc.target/i386/x87regparm-2.c: New test.
	* gcc.target/i386/x87regparm-3.c: New test.
	* gcc.target/i386/x87regparm-4.c: New test.

Patch was regression tested on i686-pc-linux-gnu for c, c++ and fortran.

Uros.

Attachment: i386-nox87regparm.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]