Thread (4 messages) 4 messages, 2 authors, 2021-02-25

Re: HELP: MIPS PC Relative Addressing

From: "Maciej W. Rozycki" <macro@orcam.me.uk>
Date: 2021-02-25 02:58:38

Possibly related (same subject, not in this thread)

On Thu, 25 Feb 2021, Jiaxun Yang wrote:
quoted
There is a far easier way to do this, which is to just emit an assembler
macro, and let the assembler generate the labels and relocs.  This is what
the RISC-V GCC port does by default.  This prevents some optimizations like
scheduling the two instructions, but enables some other optimizations like
loop unrolling.  So it is a tossup.  Sometimes we get better code with the
assembler macro, and sometimes we get better code by emitting the auipc and
addi separately.
Thanks all,

I'll take this approach first, add "lla, dlla" pseudo-instructions to
assembler and seeking optimization
in future.
 The DLA and LA macros are supposed to do that already, no need to invent 
new names.

 They may not have been implemented for R6, but I'm not sure.  There was 
some resistance against macros at one point as the new generation came to 
work on the MIPS assembler and consequently inconsistencies resulted in 
the language that may not have been removed to date.

 In any case you need to use `-mno-explicit-relocs' with GCC then so as 
not to break the compiler's semantics or assumptions.
Btw I found we don't have any document for MIPS pseudo-instructions. RISC-V
put them in ISA manual
but it is not the case for MIPS. Is it possible to have one in binutils?
 There are MIPS assembly language books available; I'm fairly sure Dominic 
Sweetman's "See MIPS Run" has a chapter (I don't have the book at hand).  
I don't think GNU binutils documentation is supposed to describe the 
assembly dialects supported, except maybe for GNU extensions (pseudo-ops).

  Maciej
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help