This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: dangerous cleverness? ppc int<->float conversions, subreg
- To: Zack Weinberg <zack at codesourcery dot com>
- Subject: Re: dangerous cleverness? ppc int<->float conversions, subreg
- From: Geoff Keating <geoffk at geoffk dot org>
- Date: 23 Oct 2001 11:48:04 -0700
- CC: gcc at gcc dot gnu dot org
- References: <20011022161325.C29432@codesourcery.com>
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>