keith@mips.com (Keith Garrett) (06/30/91)
[discussion of possible differences between 32 & 64 bit instructions deleted] In article <MEISSNER.91Jun28105156@tiktok.osf.org> meissner@osf.org (Michael Meissner) writes: >The other thing I've thought about is how do you do generalized >external references. On the current R[236]000's a normal (non-GP) >reference is two instructions: > > lui $at,addr>>16 > <lw/sw> <reg>,addr&0xffff($at) this won't work in the general case. the offset is sign-extended before it is added to the base register contents. here is the general solution: lui $at,(addr>>16)&0xffff ori $at,addr&0xffff <lw/sw> <reg>,0($at) > >I wonder whether we will need four instructions in the 64 bit >universe. how about: lui $at,(addr>>48)&0xffff ori $at,(addr>>32)&0xffff sll $at,16 ori $at,(addr>>16)&0xffff sll $at,16 ori $at,addr&0xffff <lw/sw> <reg>,0($at) there may be a better solution for this, that i haven't considered. an alternative for either case: <lw/ld> $at,offset($gp) <lw/sw> <reg>,0($at) this requires an extra memory reference, but is probably an overall win for 64 bits, and is OK for 32 bits. -- Keith Garrett "This is *MY* opinion, OBVIOUSLY" (408) 524-8110 Mips Computer Systems, 930 Arques Ave MS 1-02, Sunnyvale, Ca. 94088-3650 "Beware of the half-truth - you may have gotten hold of the wrong half." keith@mips.com -or- {ames,decwrl,prls}!mips!keith -Rabbi Seymour Essrog
meissner@osf.org (Michael Meissner) (07/01/91)
In article <5240@spim.mips.COM> keith@mips.com (Keith Garrett) writes: | [discussion of possible differences between 32 & 64 bit instructions deleted] | In article <MEISSNER.91Jun28105156@tiktok.osf.org> meissner@osf.org (Michael Meissner) writes: | >The other thing I've thought about is how do you do generalized | >external references. On the current R[236]000's a normal (non-GP) | >reference is two instructions: | > | > lui $at,addr>>16 | > <lw/sw> <reg>,addr&0xffff($at) | this won't work in the general case. the offset is sign-extended before | it is added to the base register contents. here is the general solution: | lui $at,(addr>>16)&0xffff | ori $at,addr&0xffff | <lw/sw> <reg>,0($at) Umm, the optimal solution is to have a new relocation type that corrects the lui, so that only two instructions are needed. In fact, that's what MIPS currently uses. However, you can't get that relocation from the assembler as two discreete instructions, you have to use one macro instruction, and let the assembler generate the code. -- Michael Meissner email: meissner@osf.org phone: 617-621-8861 Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142 You are in a twisty little passage of standards, all conflicting.