2018-01-03 13:17:27 +08:00
@c Copyright (C) 2007-2018 Free Software Foundation, Inc.
2007-06-29 22:09:34 +08:00
@c This is part of the GAS manual.
@c For copying conditions, see the file as.texinfo.
@ifset GENERIC
@page
@node CR16-Dependent
@chapter CR16 Dependent Features
@end ifset
@ifclear GENERIC
@node Machine Dependencies
@chapter CR16 Dependent Features
@end ifclear
@cindex CR16 support
@menu
* CR16 Operand Qualifiers:: CR16 Machine Operand Qualifiers
2011-01-18 21:37:39 +08:00
* CR16 Syntax:: Syntax for the CR16
2007-06-29 22:09:34 +08:00
@end menu
@node CR16 Operand Qualifiers
@section CR16 Operand Qualifiers
@cindex CR16 Operand Qualifiers
2013-01-11 03:51:55 +08:00
The National Semiconductor CR16 target of @code{@value{AS}} has a few machine dependent operand qualifiers.
2007-06-29 22:09:34 +08:00
Operand expression type qualifier is an optional field in the instruction operand, to determines the type of the expression field of an operand. The @code{@@} is required. CR16 architecture uses one of the following expression qualifiers:
@table @code
2013-01-11 03:51:55 +08:00
@item s
2007-06-29 22:09:34 +08:00
- @code{Specifies expression operand type as small}
2013-01-11 03:51:55 +08:00
@item m
2007-06-29 22:09:34 +08:00
- @code{Specifies expression operand type as medium}
2013-01-11 03:51:55 +08:00
@item l
2007-06-29 22:09:34 +08:00
- @code{Specifies expression operand type as large}
2013-01-11 03:51:55 +08:00
@item c
2007-06-29 22:09:34 +08:00
- @code{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.}
2013-01-11 03:51:55 +08:00
@item got/GOT
2008-11-27 20:01:26 +08:00
- @code{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}
2013-01-11 03:51:55 +08:00
@item cgot/cGOT
2008-11-27 20:01:26 +08:00
- @code{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.}
2007-06-29 22:09:34 +08:00
@end table
CR16 target operand qualifiers and its size (in bits):
@table @samp
2013-03-14 18:00:46 +08:00
@item Immediate Operand: s
4 bits.
@item Immediate Operand: m
16 bits, for movb and movw instructions.
@item Immediate Operand: m
20 bits, movd instructions.
@item Immediate Operand: l
32 bits.
@item Absolute Operand: s
Illegal specifier for this operand.
@item Absolute Operand: m
20 bits, movd instructions.
@item Displacement Operand: s
8 bits.
@item Displacement Operand: m
16 bits.
@item Displacement Operand: l
24 bits.
2007-06-29 22:09:34 +08:00
@end table
For example:
@example
1 @code{movw $_myfun@@c,r1}
This loads the address of _myfun, shifted right by 1, into r1.
2 @code{movd $_myfun@@c,(r2,r1)}
This loads the address of _myfun, shifted right by 1, into register-pair r2-r1.
2013-01-11 03:51:55 +08:00
2007-06-29 22:09:34 +08:00
3 @code{_myfun_ptr:}
@code{.long _myfun@@c}
@code{loadd _myfun_ptr, (r1,r0)}
@code{jal (r1,r0)}
This .long directive, the address of _myfunc, shifted right by 1 at link time.
2008-11-27 20:01:26 +08:00
4 @code{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 @code{loadd _myfunc@@cGOT(r12), (r1,r0)}
2013-01-11 03:51:55 +08:00
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.
2007-06-29 22:09:34 +08:00
@end example
2011-01-18 21:37:39 +08:00
@node CR16 Syntax
@section CR16 Syntax
@menu
* CR16-Chars:: Special Characters
@end menu
@node CR16-Chars
@subsection Special Characters
@cindex line comment character, CR16
@cindex CR16 line comment character
The presence of a @samp{#} on a line indicates the start of a comment
that extends to the end of the current line. If the @samp{#} appears
as the first character of a line, the whole line is treated as a
comment, but in this case the line can also be a logical line number
directive (@pxref{Comments}) or a preprocessor control command
(@pxref{Preprocessing}).
@cindex line separator, CR16
@cindex statement separator, CR16
@cindex CR16 line separator
The @samp{;} character can be used to separate statements on the same
line.