This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH][MIPS] Optionally disable odd-numbered single-precision registers
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Matthew Fortune <Matthew dot Fortune at imgtec dot com>
- Cc: "binutils\ at sourceware dot org" <binutils at sourceware dot org>, "macro\ at codesourcery dot com" <macro at codesourcery dot com>, "Joseph Myers \(joseph\ at codesourcery dot com\)" <joseph at codesourcery dot com>, Rich Fuhler <Rich dot Fuhler at imgtec dot com>, "qiuji\ at loongson dot cn" <qiuji at loongson dot cn>
- Date: Sun, 25 May 2014 13:12:29 +0100
- Subject: Re: [PATCH][MIPS] Optionally disable odd-numbered single-precision registers
- Authentication-results: sourceware.org; auth=none
- References: <6D39441BF12EF246A7ABCE6654B0235353AE75 at LEMAIL01 dot le dot imgtec dot org>
Matthew Fortune <Matthew.Fortune@imgtec.com> writes:
> This patch adds support for disabling the use of odd-numbered
> single-precision registers for arithmetic options. It aims
> to implement the restriction on loongson-3a where these registers
> cannot be used for single-precision operations (in FR=0/FP32 mode).
> We have also decided to limit the number of single-precision
> registers usable by default for generic MIPS architectures so that
> generic code can run on the loongson-3a. Targeting a specific
> architecture will however allow access to all registers by default.
>
> The corresponding (as yet un-committed) GCC patch is:
> http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01975.html
>
> After this patch is applied then pre-existing GCC compilers will
> end up with warnings from the assembler when building mips32 or
> mips32r2 code as the pre-existing compilers will use 32 single-
> precision registers. Is this acceptable?
Hmm, it sounds likely to surprise people. Maybe this is one of
the few cases where GCC and GAS should have different defaults.
In the GCC case it's controlling whether the code uses odd
registers, so -mno-oddspreg is the safe choice. But in the
GAS code it controls a warning, so -moddspreg is the safe choice.
Maybe we should define ISA_HAS_ODD_SINGLE_FPR so that it takes
the mips_opts.arch as well as the mips_opts.isa, then make it
true for CPU_R5900 and false for CPU_LOONGSON_3A. Then the error:
> + if (opts->fp != 64 && opts->arch == CPU_LOONGSON_3A && !opts->nooddspreg)
> + as_bad (_("`arch=loongson3a' requires `nooddspreg' when using "
> + "`fp=32' or `fp=xx'"));
could apply whenever !ISA_HAS_ODD_SINGLE_FPR. The default could also
be set based on ISA_HAS_ODD_SINGLE_FPR.
Thanks,
Richard