This is the mail archive of the gcc@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]

Re: dangerous cleverness? ppc int<->float conversions, subreg


Zack Weinberg <zack@codesourcery.com> writes:

> I came up with a clever trick to avoid the problem.  If the above pattern
> is written instead
> 
>   (set (subreg:DI (match_operand:DF 0 "gpc_reg_operand" "=f") 0)
>        (fix:DI (match_operand:DF 1 "gpc_reg_operand" "f")))
> 
> then register allocation happily assigns operand 0 a floating point
> register and we carry on, generating what appears to be correct assembly.
> 
> I am worried that this trick is _too_ clever and something horrible will
> happen on code which is marginally more complicated than __fixunsdfsi.
> Can any experts on SUBREGs, the PPC, etc. offer clues?  The rs6000 bits
> of the patch I'm working on are below, to give you an idea.  I may be
> trying to get it to work on sparc as well.

No, this can't work the way you wrote it.  It would cause code like

(set (subreg:DI (reg:DF 111)) (fix:DI ...))
(set (mem:DI ...) (reg:DI 111))

which is not valid.

The right way to do what you want to do is to change register
allocation when this flag is specified, so that it only allocates a FP
register as a last resort.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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