Next: CR16 Syntax, Up: CR16-Dependent

#### 9.6.1 CR16 Operand Qualifiers

The National Semiconductor CR16 target of `as` has a few machine dependent operand qualifiers.

Operand expression type qualifier is an optional field in the instruction operand, to determines the type of the expression field of an operand. The `@` is required. CR16 architecture uses one of the following expression qualifiers:

`s`
  - `Specifies expression operand type as small`
`m`
  - `Specifies expression operand type as medium`
`l`
  - `Specifies expression operand type as large`
`c`
  - `Specifies the CR16 Assembler generates a relocation entry for the operand, where pc has implied bit, the expression is adjusted accordingly. The linker uses the relocation entry to update the operand address at link time.`
`got/GOT`
  - `Specifies the CR16 Assembler generates a relocation entry for the operand, offset from Global Offset Table. The linker uses this relocation entry to update the operand address at link time`
`cgot/cGOT`
  - `Specifies the CompactRISC Assembler generates a relocation entry for the operand, where pc has implied bit, the expression is adjusted accordingly. The linker uses the relocation entry to update the operand address at link time.`

CR16 target operand qualifiers and its size (in bits):

‘`Immediate Operand`’
  - s —– 4 bits
‘``’
  - m —– 16 bits, for movb and movw instructions.
‘``’
  - m —– 20 bits, movd instructions.
‘``’
  - l —– 32 bits
‘`Absolute Operand`’
  - s —– Illegal specifier for this operand.
‘``’
  - m —– 20 bits, movd instructions.
‘`Displacement Operand`’
  - s —– 8 bits
‘``’
  - m —– 16 bits
‘``’
  - l —– 24 bits

For example:

         1   movw $_myfun@c,r1

             This loads the address of _myfun, shifted right by 1, into r1.

         2   movd $_myfun@c,(r2,r1)

             This loads the address of _myfun, shifted right by 1, into register-pair r2-r1.

         3   _myfun_ptr:
             .long _myfun@c
             loadd _myfun_ptr, (r1,r0)
             jal (r1,r0)

             This .long directive, the address of _myfunc, shifted right by 1 at link time.

         4   loadd  _data1@GOT(r12), (r1,r0)

             This loads the address of _data1, into global offset table (ie GOT) and its offset value from GOT loads into register-pair r2-r1.

         5   loadd  _myfunc@cGOT(r12), (r1,r0)

             This loads the address of _myfun, shifted right by 1, into global offset table (ie GOT) and its offset value from GOT loads into register-pair r1-r0.