Bugs in MIPS FUNCTION_ARG_REGNO_P ?
Mark Mitchell
mark@codesourcery.com
Wed Mar 3 08:20:00 GMT 2004
Jim Wilson wrote:
> On Tue, 2004-03-02 at 23:25, Mark Mitchell wrote:
>
>>>>#define FUNCTION_ARG_REGNO_P(N) \
>>>> ((IN_RANGE((N), GP_ARG_FIRST, GP_ARG_LAST) \
>>>> || (IN_RANGE((N), FP_ARG_FIRST, FP_ARG_LAST) \
>>>> && ((N) % FP_INC == 0) && mips_abi != ABI_O64)) \
>>>> && !fixed_regs[N])
>
>
> This changed between 3.2 and 3.3. 3.2 has
> #define FUNCTION_ARG_REGNO_P(N) \
> (((N) >= GP_ARG_FIRST && (N) <= GP_ARG_LAST) \
> || (! TARGET_SOFT_FLOAT \
> && ((N) >= FP_ARG_FIRST && (N) <= FP_ARG_LAST) \
> && (TARGET_FLOAT64 || (0 == (N) % 2))))
> which will work.
>
> Note that a || was changed to a && and a set of parentheses was dropped,
> which breaks the code.
>
> The key point here is that O32 uses f12/f14 because we can't access odd
> numbered registers, but O64 uses f12/f13/f14/f15. This assumes that O64
> always uses TARGET_FLOAT64, but that is probably a reasonable
> assumption.
Yes.
The current situation is optimization bugs waiting to happen. We are
lying to the optimizers, telling them that these registers cannot be
used for argument-passing, even though they can be so used.
I think this line
&& ((N) % FP_INC == 0) && mips_abi != ABI_O64))
should become:
&& (((N) % FP_INC == 0) || mips_abi == ABI_O64)))
which would say that the register is an argument register if it is even,
*or* if we are on o64, because then all of $f12-$f15 are usable.
Do you agree?
I don't have a good o64 target environment for running DejaGNU tests, so
I could make the change but I'd have a hard time testing it properly.
Does anyone have an o64 system around to test on?
If not, how do you feel about considering than an obvious fix?
Thanks,
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
More information about the Gcc
mailing list