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: Why pass HAVE_32BIT_GPRS to OPCODE_IS_MEMBER?


ica2_ts@csv.ica.uni-stuttgart.de ("Thiemo Seufer") writes:
> Why differentiate between forced and non-forced 32bit GPRS?
> The assembler should handle both identically.

So, I think the answer to this is that by some chain of logic you
might end up with 'non-canonical 32-bit values' (i.e. 32-bit values
but where bits 63:32 != bit 31) in registers, if you're in
forced-32-bit mode.

In that case, you would need to use 'or' or 'daddu' to avoid
unimplemented behaviour, but you might not be able to use daddu
because the processor is configured to disallow it.

I'm not sure what I think of that answer for -mgp32, and don't know
enough about -mabi=32 to speak about what should be done there.


To go back to the original patch message:

	http://sources.redhat.com/ml/binutils/1999-12/msg00123.html

It and the messages that preceeded it:

	http://sources.redhat.com/ml/binutils/1999-10/msg00133.html
	http://sources.redhat.com/ml/binutils/1999-10/msg00135.html

shed some light on the issue.

In fact, -mgp32 seems to be intended for when you're running w/o
64-bit extensions enabled, on mips3 and later parts.  (e.g. MIPS64
in user mode with SR:PX set to 0.)

In that case, you _can't_ get non-canonical values in the registers;
any operations that you would attempt to produce those values would
instead trap as reserved or illegal.

I don't know how abi=32 code is intended to be run.  if it simply
defines calling conventions, and not processor mode, then you need to
use 'or' rather than 'addu'.  If it defines processor mode as well,
then addu would be sufficient.


In any event, my personal preference is to nuke the gp32 arg to
OPCODE_IS_MEMBER, and assemble "move" as a macro, and use -mtune to
schedule preference of 'or' vs. 'add'.

I think i'd code the selection like:

	if ((mips_isa & INSN_ISA3)
	    && (forced 32-bit with gp32 or abi=32)) {

		emit 'or' for sanity.

	} else {

		switch (tune) {

		/* processor tuning here!!! */

		default:
			move32_insn = "addu";
			move64_insn = "daddu";
		}

		if (mips_isa & INSN_ISA3)
			emit move64_insn;
		else
			emit move32_insn;
	}

or use better (existing) checks for 64-bit ISA rather than the
(mips_ISA & INSN_ISA3) above.  8-)


cgd


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