This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

Re: Patch to add -mfp32 support to MIPS gas



Thanks for the feedback,

Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> writes:

> Just curious: Who needs to set GPR/FPR sizes explicitly on MIPS?
> It's usually a ABI property.

Perhaps the -mabi switch should affect registers sizes too.  Hopefully the
patch would make it easier for that to happen in the future.

> > +#define HAVE_32BIT_GPRS					\
> > +   (mips_gp32 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
> > +
> > +#define HAVE_32BIT_FPRS					\
> > +   (mips_fp32 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
> > +
> > +#define HAVE_64BIT_GPRS (! HAVE_32BIT_GPRS)
> > +#define HAVE_64BIT_FPRS (! HAVE_32BIT_FPRS)
> > +
> > +#define HAVE_32BIT_ADDRESSES				\
> > +   (HAVE_32BIT_GPRS || bfd_arch_bits_per_address (stdoutput) == 32)
> 
> How is mips_32bitmode handled WRT this?

I'm not sure whether you mean "how does mips_32bitmode affect these macros?"
or "how do these macros affect mips_32bitmode?".

For the first, mips_32bitmode gets set if a 32-bit ISA and a 64-bit CPU are
specified on the command line.  So if no 64-bit ISA is specified in the
source code, mips_32bitmode already implies HAVE_32BIT_GPRS and
HAVE_32BIT_FPRS.

If a 64-bit ISA *is* specified in the source code, GAS (before and after the
patch) will assume that registers are 64 bits wide while generating code for
that ISA.  mips_32bitmode didn't have any effect before the patch, and
doesn't after it.  -mgp32 is there for the case when you want GAS to assume
that registers are 32 bits wide even when handling a 64-bit ISA.

As to setting mips_32bitmode if -mgp32 or -mfp32 is specified.  Well,
the code has this to say about -mgp32 setting mips_32bitmode:

      /* We deliberately don't allow "-gp32" to set the MIPS_32BITMODE
	 flag in object files because to do so would make it
	 impossible to link with libraries compiled without "-gp32".
	 This is unnecessarily restrictive.

	 We could solve this problem by adding "-gp32" multilibs to
	 gcc, but to set this flag before gcc is built with such
	 multilibs will break too many systems.  */
#if 0
      mips_32bitmode = 1;
#endif

I thought the same argument would apply to -mfp32.

> Perhaps there should be some checking for consistency with ABI's
> definitions then.

If the chosen ABI does affect GAS's handling of registers in the future, I
agree it should check for consistency then.  But I'd rather save ABI
handling for another day.

Richard


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