RX Dependent Features
*********************

RX Options
==========

The Renesas RX port of AS has a few target specfic command line options:

-m32bit-doubles
     This option controls the ABI and indicates to use a 32-bit float ABI. It has no effect on the assembled instructions, but it does influence the behaviour of the .double pseudo-op. This is the default.

-m64bit-doubles
     This option controls the ABI and indicates to use a 64-bit float ABI. It has no effect on the assembled instructions, but it does influence the behaviour of the .double pseudo-op.

-mbig-endian
     This option controls the ABI and indicates to use a big-endian data ABI.  It has no effect on the assembled instructions, but it does influence the behaviour of the .short, .hword, .int, .word, .long, .quad and .octa pseudo-ops.

-mlittle-endian
     This option controls the ABI and indicates to use a little-endian data ABI.  It has no effect on the assembled instructions, but it does influence the behaviour of the .short, .hword, .int, .word, .long, .quad and .octa pseudo-ops. This is the default.

-muse-conventional-section-names
     This option controls the default names given to the code (.text), initialised data (.data) and uninitialised data sections (.bss).

-muse-renesas-section-names
     This option controls the default names given to the code (.P), initialised data (.D_1) and uninitialised data sections (.B_1). This is the default.

-msmall-data-limit
     This option tells the assembler that the small data limit feature of the RX port of GCC is being used.  This results in the assembler generating an undefined reference to a symbol called __gp for use by the relocations that are needed to support the small data limit feature.   This option is not enabled by default as it would otherwise pollute the symbol table.

-mpid
     This option tells the assembler that the position independent data of the RX port of GCC is being used.  This results in the assembler generating an undefined reference to a symbol called __pid_base, and also setting the RX_PID flag bit in the e_flags field of the ELF header of the object file.

-mint-register=NUM
     This option tells the assembler how many registers have been reserved for use by interrupt handlers.  This is needed in order to compute the correct values for the %gpreg and %pidreg meta registers.

-mgcc-abi
     This option tells the assembler that the old GCC ABI is being used by the assembled code.  With this version of the ABI function arguments that are passed on the stack are aligned to a 32-bit boundary.

-mrx-abi
     This option tells the assembler that the official RX ABI is being used by the assembled code.  With this version of the ABI function arguments that are passed on the stack are aligned to their natural alignments.  This option is the default.

-mcpu=NAME
     This option tells the assembler the target CPU type.  Currently the rx200, rx600 and rx610 are recognised as valid cpu names.  Attempting to assemble an instruction not supported by the indicated cpu type will result in an error message being generated.

Symbolic Operand Modifiers
==========================

The assembler supports one modifier when using symbol addresses in RX instruction operands.  The general syntax is the following:

     %gp(symbol)

The modifier returns the offset from the __GP symbol to the specified symbol as a 16-bit value.  The intent is that this offset should be used in a register+offset move instruction when generating references to small data.  Ie, like this:

       mov.W	 %gp(_foo)[%gpreg], r1

The assembler also supports two meta register names which can be used to refer to registers whose values may not be known to the programmer.  These meta register names are:

%gpreg
     The small data address register.

%pidreg
     The PID base address register.

Both registers normally have the value r13, but this can change if some registers have been reserved for use by interrupt handlers or if both the small data limit and position independent data features are being used at the same time.

Assembler Directives
====================

The RX version of AS has the following specific assembler directives:

.3byte
     Inserts a 3-byte value into the output file at the current location.

.fetchalign
     If the next opcode following this directive spans a fetch line boundary (8 byte boundary), the opcode is aligned to that boundary. If the next opcode does not span a fetch line, this directive has no effect.  Note that one or more labels may be between this directive and the opcode; those labels are aligned as well.  Any inserted bytes due to alignment will form a NOP opcode.

Floating Point
==============

The floating point formats generated by directives are these.

.float
     Single precision (32-bit) floating point constants.

.double
     If the -m64bit-doubles command line option has been specified then then double directive generates double precision (64-bit) floating point constants, otherwise it generates single precision (32-bit) floating point constants.  To force the generation of 64-bit floating point constants used the dc.d directive instead.

Syntax for the RX
=================

Special Characters
------------------

The presence of a ; appearing anywhere on a line indicates the start of a comment that extends to the end of that line.

If a # appears as the first character of a line then the whole line is treated as a comment, but in this case the line can also be a logical line number directive (see Comments) or a preprocessor control command (see Preprocessing).

The ! character can be used to separate statements on the same line.