MIPS: why addu/daddu for move?

Ian Lance Taylor ian@zembu.com
Tue Sep 26 13:50:00 GMT 2000


   From: cgd@sibyte.com (Chris G. Demetriou)
   Date: 26 Sep 2000 13:21:50 -0700

   I've noticed that the MIPS binutils seems to prefer addu/daddu for
   'move' over 'or'.

   I note that, for instance, See MIPS Run indicates that 'move' "will be
   implemented as 'or' by most MIPS assemblers.

   Additionally, the MIPS assembler seems to encode 'move' as 'or'
   (regardless of ISA, though I'll admit i wasn't exhaustive.)


   Any reason for the GNU tools' encoding?

Some of the advanced MIPS chips have two addition pipelines, but only
one logical pipeline.  Using addu/daddu means that it is more likely
that the instruction will execute in parallel with other instructions.
This was actually pointed out by some MIPS hardware vendor, but I
don't remember which one.

   'or' has the benefit -- or drawback -- that it doesn't sign extend,
   i.e. it preserves the upper register contents on machines with 64-bit
   GPRs...

   I could imagine that things might expect that if you're using a 64-bit
   GPR machine but -mips1/-mips2 in the compiler/assembler, that 'move'
   will extend bit 31 into 32:64... but that seems like a bad assumption
   to make (and is at odds with the practices used/encouraged by other
   assemblers and MIPS texts 8-).

Yeah, I think that's a bad assumption.

In general, if you aren't running in 32-bit mode, you should use
-mips3 with the assembler.  Or use -mgp32/-mgp64 as appropriate,
although those are new with the 2.10 release.

Ian


More information about the Binutils mailing list