as: M32R-Directives

1 
1 9.22.2 M32R Directives
1 ----------------------
1 
1 The Renesas M32R version of 'as' has a few architecture specific
1 directives:
1 
1 'low EXPRESSION'
1      The 'low' directive computes the value of its expression and places
1      the lower 16-bits of the result into the immediate-field of the
1      instruction.  For example:
1 
1              or3   r0, r0, #low(0x12345678) ; compute r0 = r0 | 0x5678
1              add3, r0, r0, #low(fred)   ; compute r0 = r0 + low 16-bits of address of fred
1 
1 'high EXPRESSION'
1      The 'high' directive computes the value of its expression and
1      places the upper 16-bits of the result into the immediate-field of
1      the instruction.  For example:
1 
1              seth  r0, #high(0x12345678) ; compute r0 = 0x12340000
1              seth, r0, #high(fred)       ; compute r0 = upper 16-bits of address of fred
1 
1 'shigh EXPRESSION'
1      The 'shigh' directive is very similar to the 'high' directive.  It
1      also computes the value of its expression and places the upper
1      16-bits of the result into the immediate-field of the instruction.
1      The difference is that 'shigh' also checks to see if the lower
1      16-bits could be interpreted as a signed number, and if so it
1      assumes that a borrow will occur from the upper-16 bits.  To
1      compensate for this the 'shigh' directive pre-biases the upper 16
1      bit value by adding one to it.  For example:
1 
1      For example:
1 
1              seth  r0, #shigh(0x12345678) ; compute r0 = 0x12340000
1              seth  r0, #shigh(0x00008000) ; compute r0 = 0x00010000
1 
1      In the second example the lower 16-bits are 0x8000.  If these are
1      treated as a signed value and sign extended to 32-bits then the
1      value becomes 0xffff8000.  If this value is then added to
1      0x00010000 then the result is 0x00008000.
1 
1      This behaviour is to allow for the different semantics of the 'or3'
1      and 'add3' instructions.  The 'or3' instruction treats its 16-bit
1      immediate argument as unsigned whereas the 'add3' treats its 16-bit
1      immediate as a signed value.  So for example:
1 
1              seth  r0, #shigh(0x00008000)
1              add3  r0, r0, #low(0x00008000)
1 
1      Produces the correct result in r0, whereas:
1 
1              seth  r0, #shigh(0x00008000)
1              or3   r0, r0, #low(0x00008000)
1 
1      Stores 0xffff8000 into r0.
1 
1      Note - the 'shigh' directive does not know where in the assembly
1      source code the lower 16-bits of the value are going set, so it
1      cannot check to make sure that an 'or3' instruction is being used
1      rather than an 'add3' instruction.  It is up to the programmer to
1      make sure that correct directives are used.
1 
1 '.m32r'
1      The directive performs a similar thing as the _-m32r_ command line
1      option.  It tells the assembler to only accept M32R instructions
1      from now on.  An instructions from later M32R architectures are
1      refused.
1 
1 '.m32rx'
1      The directive performs a similar thing as the _-m32rx_ command line
1      option.  It tells the assembler to start accepting the extra
1      instructions in the M32RX ISA as well as the ordinary M32R ISA.
1 
1 '.m32r2'
1      The directive performs a similar thing as the _-m32r2_ command line
1      option.  It tells the assembler to start accepting the extra
1      instructions in the M32R2 ISA as well as the ordinary M32R ISA.
1 
1 '.little'
1      The directive performs a similar thing as the _-little_ command
1      line option.  It tells the assembler to start producing
1      little-endian code and data.  This option should be used with care
1      as producing mixed-endian binary files is fraught with danger.
1 
1 '.big'
1      The directive performs a similar thing as the _-big_ command line
1      option.  It tells the assembler to start producing big-endian code
1      and data.  This option should be used with care as producing
1      mixed-endian binary files is fraught with danger.
1