Previous: V850 Directives, Up: V850-Dependent
as
implements all the standard V850 opcodes.
as
also implements the following pseudo ops:
hi0()
‘mulhi hi0(here - there), r5, r6’
computes the difference between the address of labels 'here' and 'there', takes the upper 16 bits of this difference, shifts it down 16 bits and then multiplies it by the lower 16 bits in register 5, putting the result into register 6.
lo()
‘addi lo(here - there), r5, r6’
computes the difference between the address of labels 'here' and 'there', takes the lower 16 bits of this difference and adds it to register 5, putting the result into register 6.
hi()
‘movhi hi(here), r0, r6’ ‘movea lo(here), r6, r6’
The reason for this special behaviour is that movea performs a sign extension on its immediate operand. So for example if the address of 'here' was 0xFFFFFFFF then without the special behaviour of the hi() pseudo-op the movhi instruction would put 0xFFFF0000 into r6, then the movea instruction would takes its immediate operand, 0xFFFF, sign extend it to 32 bits, 0xFFFFFFFF, and then add it into r6 giving 0xFFFEFFFF which is wrong (the fifth nibble is E). With the hi() pseudo op adding in the top bit of the lo() pseudo op, the movhi instruction actually stores 0 into r6 (0xFFFF + 1 = 0x0000), so that the movea instruction stores 0xFFFFFFFF into r6 - the right value.
hilo()
‘mov hilo(here), r6’
computes the absolute address of label 'here' and puts the result into register 6.
sdaoff()
‘ld.w sdaoff(_a_variable)[gp],r6’
loads the contents of the location pointed to by the label '_a_variable' into register 6, provided that the label is located somewhere within +/- 32K of the address held in the GP register. [Note the linker assumes that the GP register contains a fixed address set to the address of the label called '__gp'. This can either be set up automatically by the linker, or specifically set by using the ‘--defsym __gp=<value>’ command line option].
tdaoff()
‘sld.w tdaoff(_a_variable)[ep],r6’
loads the contents of the location pointed to by the label '_a_variable' into register 6, provided that the label is located somewhere within +256 bytes of the address held in the EP register. [Note the linker assumes that the EP register contains a fixed address set to the address of the label called '__ep'. This can either be set up automatically by the linker, or specifically set by using the ‘--defsym __ep=<value>’ command line option].
zdaoff()
‘movea zdaoff(_a_variable),zero,r6’
puts the address of the label '_a_variable' into register 6, assuming that the label is somewhere within the first 32K of memory. (Strictly speaking it also possible to access the last 32K of memory as well, as the offsets are signed).
ctoff()
‘callt ctoff(table_func1)’
will put the call the function whoes address is held in the call table at the location labeled 'table_func1'.
.longcall name
name
. The linker will attempt to shorten this call
sequence if name
is within a 22bit offset of the call. Only
valid if the -mrelax
command line switch has been enabled.
.longjump name
name
. The linker will attempt to shorten this code
sequence if name
is within a 22bit offset of the jump. Only
valid if the -mrelax
command line switch has been enabled.
For information on the V850 instruction set, see V850 Family 32-/16-Bit single-Chip Microcontroller Architecture Manual from NEC. Ltd.