xref: /dflybsd-src/contrib/binutils-2.27/gas/doc/c-cr16.texi (revision e656dc90e3d65d744d534af2f5ea88cf8101ebcf)
1*a9fa9459Szrj@c Copyright (C) 2007-2016 Free Software Foundation, Inc.
2*a9fa9459Szrj@c This is part of the GAS manual.
3*a9fa9459Szrj@c For copying conditions, see the file as.texinfo.
4*a9fa9459Szrj
5*a9fa9459Szrj@ifset GENERIC
6*a9fa9459Szrj@page
7*a9fa9459Szrj@node CR16-Dependent
8*a9fa9459Szrj@chapter CR16 Dependent Features
9*a9fa9459Szrj@end ifset
10*a9fa9459Szrj@ifclear GENERIC
11*a9fa9459Szrj@node Machine Dependencies
12*a9fa9459Szrj@chapter CR16 Dependent Features
13*a9fa9459Szrj@end ifclear
14*a9fa9459Szrj
15*a9fa9459Szrj@cindex CR16 support
16*a9fa9459Szrj@menu
17*a9fa9459Szrj* CR16 Operand Qualifiers::     CR16 Machine Operand Qualifiers
18*a9fa9459Szrj* CR16 Syntax::                 Syntax for the CR16
19*a9fa9459Szrj@end menu
20*a9fa9459Szrj
21*a9fa9459Szrj@node CR16 Operand Qualifiers
22*a9fa9459Szrj@section CR16 Operand Qualifiers
23*a9fa9459Szrj@cindex CR16 Operand Qualifiers
24*a9fa9459Szrj
25*a9fa9459SzrjThe National Semiconductor CR16 target of @code{@value{AS}} has a few machine dependent operand qualifiers.
26*a9fa9459Szrj
27*a9fa9459SzrjOperand 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:
28*a9fa9459Szrj
29*a9fa9459Szrj@table @code
30*a9fa9459Szrj@item  s
31*a9fa9459Szrj- @code{Specifies expression operand type as small}
32*a9fa9459Szrj@item  m
33*a9fa9459Szrj- @code{Specifies expression operand type as medium}
34*a9fa9459Szrj@item  l
35*a9fa9459Szrj- @code{Specifies expression operand type as large}
36*a9fa9459Szrj@item  c
37*a9fa9459Szrj- @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.}
38*a9fa9459Szrj@item  got/GOT
39*a9fa9459Szrj- @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}
40*a9fa9459Szrj@item  cgot/cGOT
41*a9fa9459Szrj- @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.}
42*a9fa9459Szrj@end table
43*a9fa9459Szrj
44*a9fa9459SzrjCR16 target operand qualifiers and its size (in bits):
45*a9fa9459Szrj
46*a9fa9459Szrj@table @samp
47*a9fa9459Szrj@item Immediate Operand: s
48*a9fa9459Szrj4 bits.
49*a9fa9459Szrj
50*a9fa9459Szrj@item Immediate Operand: m
51*a9fa9459Szrj16 bits, for movb and movw instructions.
52*a9fa9459Szrj
53*a9fa9459Szrj@item Immediate Operand: m
54*a9fa9459Szrj20 bits, movd instructions.
55*a9fa9459Szrj
56*a9fa9459Szrj@item Immediate Operand: l
57*a9fa9459Szrj32 bits.
58*a9fa9459Szrj
59*a9fa9459Szrj@item Absolute Operand: s
60*a9fa9459SzrjIllegal specifier for this operand.
61*a9fa9459Szrj
62*a9fa9459Szrj@item Absolute Operand: m
63*a9fa9459Szrj20 bits, movd instructions.
64*a9fa9459Szrj
65*a9fa9459Szrj@item Displacement Operand: s
66*a9fa9459Szrj8 bits.
67*a9fa9459Szrj
68*a9fa9459Szrj@item Displacement Operand: m
69*a9fa9459Szrj16 bits.
70*a9fa9459Szrj
71*a9fa9459Szrj@item Displacement Operand: l
72*a9fa9459Szrj24 bits.
73*a9fa9459Szrj
74*a9fa9459Szrj@end table
75*a9fa9459Szrj
76*a9fa9459SzrjFor example:
77*a9fa9459Szrj@example
78*a9fa9459Szrj1   @code{movw $_myfun@@c,r1}
79*a9fa9459Szrj
80*a9fa9459Szrj    This loads the address of _myfun, shifted right by 1, into r1.
81*a9fa9459Szrj
82*a9fa9459Szrj2   @code{movd $_myfun@@c,(r2,r1)}
83*a9fa9459Szrj
84*a9fa9459Szrj    This loads the address of _myfun, shifted right by 1, into register-pair r2-r1.
85*a9fa9459Szrj
86*a9fa9459Szrj3   @code{_myfun_ptr:}
87*a9fa9459Szrj    @code{.long _myfun@@c}
88*a9fa9459Szrj    @code{loadd _myfun_ptr, (r1,r0)}
89*a9fa9459Szrj    @code{jal (r1,r0)}
90*a9fa9459Szrj
91*a9fa9459Szrj    This .long directive, the address of _myfunc, shifted right by 1 at link time.
92*a9fa9459Szrj
93*a9fa9459Szrj4   @code{loadd  _data1@@GOT(r12), (r1,r0)}
94*a9fa9459Szrj
95*a9fa9459Szrj    This loads the address of _data1, into global offset table (ie GOT) and its offset value from GOT loads into register-pair r2-r1.
96*a9fa9459Szrj
97*a9fa9459Szrj5   @code{loadd  _myfunc@@cGOT(r12), (r1,r0)}
98*a9fa9459Szrj
99*a9fa9459Szrj    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.
100*a9fa9459Szrj@end example
101*a9fa9459Szrj
102*a9fa9459Szrj@node CR16 Syntax
103*a9fa9459Szrj@section CR16 Syntax
104*a9fa9459Szrj@menu
105*a9fa9459Szrj* CR16-Chars::                Special Characters
106*a9fa9459Szrj@end menu
107*a9fa9459Szrj
108*a9fa9459Szrj@node CR16-Chars
109*a9fa9459Szrj@subsection Special Characters
110*a9fa9459Szrj
111*a9fa9459Szrj@cindex line comment character, CR16
112*a9fa9459Szrj@cindex CR16 line comment character
113*a9fa9459SzrjThe presence of a @samp{#} on a line indicates the start of a comment
114*a9fa9459Szrjthat extends to the end of the current line.  If the @samp{#} appears
115*a9fa9459Szrjas the first character of a line, the whole line is treated as a
116*a9fa9459Szrjcomment, but in this case the line can also be a logical line number
117*a9fa9459Szrjdirective (@pxref{Comments}) or a preprocessor control command
118*a9fa9459Szrj(@pxref{Preprocessing}).
119*a9fa9459Szrj
120*a9fa9459Szrj@cindex line separator, CR16
121*a9fa9459Szrj@cindex statement separator, CR16
122*a9fa9459Szrj@cindex CR16 line separator
123*a9fa9459SzrjThe @samp{;} character can be used to separate statements on the same
124*a9fa9459Szrjline.
125