xref: /openbsd-src/gnu/usr.bin/binutils-2.17/gas/doc/c-bfin.texi (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod@c Copyright 2005
2*3d8817e4Smiod@c Free Software Foundation, Inc.
3*3d8817e4Smiod@c This is part of the GAS manual.
4*3d8817e4Smiod@c For copying conditions, see the file as.texinfo.
5*3d8817e4Smiod@ifset GENERIC
6*3d8817e4Smiod@page
7*3d8817e4Smiod@node BFIN-Dependent
8*3d8817e4Smiod@chapter Blackfin Dependent Features
9*3d8817e4Smiod@end ifset
10*3d8817e4Smiod@ifclear GENERIC
11*3d8817e4Smiod@node Machine Dependencies
12*3d8817e4Smiod@chapter Blackfin Dependent Features
13*3d8817e4Smiod@end ifclear
14*3d8817e4Smiod
15*3d8817e4Smiod@cindex Blackfin support
16*3d8817e4Smiod@menu
17*3d8817e4Smiod* BFIN Syntax::			BFIN Syntax
18*3d8817e4Smiod* BFIN Directives::		BFIN Directives
19*3d8817e4Smiod@end menu
20*3d8817e4Smiod
21*3d8817e4Smiod@node BFIN Syntax
22*3d8817e4Smiod@section Syntax
23*3d8817e4Smiod@cindex BFIN syntax
24*3d8817e4Smiod@cindex syntax, BFIN
25*3d8817e4Smiod
26*3d8817e4Smiod@table @code
27*3d8817e4Smiod@item Special Characters
28*3d8817e4SmiodAssembler input is free format and may appear anywhere on the line.
29*3d8817e4SmiodOne instruction may extend across multiple lines or more than one
30*3d8817e4Smiodinstruction may appear on the same line.  White space (space, tab,
31*3d8817e4Smiodcomments or newline) may appear anywhere between tokens.  A token must
32*3d8817e4Smiodnot have embedded spaces.  Tokens include numbers, register names,
33*3d8817e4Smiodkeywords, user identifiers, and also some multicharacter special
34*3d8817e4Smiodsymbols like "+=", "/*" or "||".
35*3d8817e4Smiod
36*3d8817e4Smiod@item Instruction Delimiting
37*3d8817e4SmiodA semicolon must terminate every instruction.  Sometimes a complete
38*3d8817e4Smiodinstruction will consist of more than one operation.  There are two
39*3d8817e4Smiodcases where this occurs.  The first is when two general operations
40*3d8817e4Smiodare combined.  Normally a comma separates the different parts, as in
41*3d8817e4Smiod
42*3d8817e4Smiod@smallexample
43*3d8817e4Smioda0= r3.h * r2.l, a1 = r3.l * r2.h ;
44*3d8817e4Smiod@end smallexample
45*3d8817e4Smiod
46*3d8817e4SmiodThe second case occurs when a general instruction is combined with one
47*3d8817e4Smiodor two memory references for joint issue.  The latter portions are
48*3d8817e4Smiodset off by a "||" token.
49*3d8817e4Smiod
50*3d8817e4Smiod@smallexample
51*3d8817e4Smioda0 = r3.h * r2.l || r1 = [p3++] || r4 = [i2++];
52*3d8817e4Smiod@end smallexample
53*3d8817e4Smiod
54*3d8817e4Smiod@item Register Names
55*3d8817e4Smiod
56*3d8817e4SmiodThe assembler treats register names and instruction keywords in a case
57*3d8817e4Smiodinsensitive manner.  User identifiers are case sensitive.  Thus, R3.l,
58*3d8817e4SmiodR3.L, r3.l and r3.L are all equivalent input to the assembler.
59*3d8817e4Smiod
60*3d8817e4SmiodRegister names are reserved and may not be used as program identifiers.
61*3d8817e4Smiod
62*3d8817e4SmiodSome operations (such as "Move Register") require a register pair.
63*3d8817e4SmiodRegister pairs are always data registers and are denoted using a colon,
64*3d8817e4Smiodeg., R3:2.  The larger number must be written firsts.  Note that the
65*3d8817e4Smiodhardware only supports odd-even pairs, eg., R7:6, R5:4, R3:2, and R1:0.
66*3d8817e4Smiod
67*3d8817e4SmiodSome instructions (such as --SP (Push Multiple)) require a group of
68*3d8817e4Smiodadjacent registers.  Adjacent registers are denoted in the syntax by
69*3d8817e4Smiodthe range enclosed in parentheses and separated by a colon, eg., (R7:3).
70*3d8817e4SmiodAgain, the larger number appears first.
71*3d8817e4Smiod
72*3d8817e4SmiodPortions of a particular register may be individually specified.  This
73*3d8817e4Smiodis written with a dot (".") following the register name and then a
74*3d8817e4Smiodletter denoting the desired portion.  For 32-bit registers, ".H"
75*3d8817e4Smioddenotes the most significant ("High") portion.  ".L" denotes the
76*3d8817e4Smiodleast-significant portion.  The subdivisions of the 40-bit registers
77*3d8817e4Smiodare described later.
78*3d8817e4Smiod
79*3d8817e4Smiod@item Accumulators
80*3d8817e4SmiodThe set of 40-bit registers A1 and A0 that normally contain data that
81*3d8817e4Smiodis being manipulated.  Each accumulator can be accessed in four ways.
82*3d8817e4Smiod
83*3d8817e4Smiod@table @code
84*3d8817e4Smiod@item one 40-bit register
85*3d8817e4SmiodThe register will be referred to as A1 or A0.
86*3d8817e4Smiod@item one 32-bit register
87*3d8817e4SmiodThe registers are designated as A1.W or A0.W.
88*3d8817e4Smiod@item two 16-bit registers
89*3d8817e4SmiodThe registers are designated as A1.H, A1.L, A0.H or A0.L.
90*3d8817e4Smiod@item one 8-bit register
91*3d8817e4SmiodThe registers are designated as A1.X or A0.X for the bits that
92*3d8817e4Smiodextend beyond bit 31.
93*3d8817e4Smiod@end table
94*3d8817e4Smiod
95*3d8817e4Smiod@item Data Registers
96*3d8817e4SmiodThe set of 32-bit registers (R0, R1, R2, R3, R4, R5, R6 and R7) that
97*3d8817e4Smiodnormally contain data for manipulation.  These are abbreviated as
98*3d8817e4SmiodD-register or Dreg.  Data registers can be accessed as 32-bit registers
99*3d8817e4Smiodor as two independent 16-bit registers.  The least significant 16 bits
100*3d8817e4Smiodof each register is called the "low" half and is desginated with ".L"
101*3d8817e4Smiodfollowing the register name.  The most significant 16 bits are called
102*3d8817e4Smiodthe "high" half and is designated with ".H". following the name.
103*3d8817e4Smiod
104*3d8817e4Smiod@smallexample
105*3d8817e4Smiod   R7.L, r2.h, r4.L, R0.H
106*3d8817e4Smiod@end smallexample
107*3d8817e4Smiod
108*3d8817e4Smiod@item Pointer Registers
109*3d8817e4SmiodThe set of 32-bit registers (P0, P1, P2, P3, P4, P5, SP and FP) that
110*3d8817e4Smiodnormally contain byte addresses of data structures.  These are
111*3d8817e4Smiodabbreviated as P-register or Preg.
112*3d8817e4Smiod
113*3d8817e4Smiod@smallexample
114*3d8817e4Smiodp2, p5, fp, sp
115*3d8817e4Smiod@end smallexample
116*3d8817e4Smiod
117*3d8817e4Smiod@item Stack Pointer SP
118*3d8817e4SmiodThe stack pointer contains the 32-bit address of the last occupied
119*3d8817e4Smiodbyte location in the stack.  The stack grows by decrementing the
120*3d8817e4Smiodstack pointer.
121*3d8817e4Smiod
122*3d8817e4Smiod@item Frame Pointer FP
123*3d8817e4SmiodThe frame pointer contains the 32-bit address of the previous frame
124*3d8817e4Smiodpointer in the stack.  It is located at the top of a frame.
125*3d8817e4Smiod
126*3d8817e4Smiod@item Loop Top
127*3d8817e4SmiodLT0 and LT1.  These registers contain the 32-bit address of the top of
128*3d8817e4Smioda zero overhead loop.
129*3d8817e4Smiod
130*3d8817e4Smiod@item Loop Count
131*3d8817e4SmiodLC0 and LC1.  These registers contain the 32-bit counter of the zero
132*3d8817e4Smiodoverhead loop executions.
133*3d8817e4Smiod
134*3d8817e4Smiod@item Loop Bottom
135*3d8817e4SmiodLB0 and LB1.  These registers contain the 32-bit address of the bottom
136*3d8817e4Smiodof a zero overhead loop.
137*3d8817e4Smiod
138*3d8817e4Smiod@item Index Registers
139*3d8817e4SmiodThe set of 32-bit registers (I0, I1, I2, I3) that normally contain byte
140*3d8817e4Smiodaddresses of data structures.  Abbreviated I-register or Ireg.
141*3d8817e4Smiod
142*3d8817e4Smiod@item Modify Registers
143*3d8817e4SmiodThe set of 32-bit registers (M0, M1, M2, M3) that normally contain
144*3d8817e4Smiodoffset values that are added and subracted to one of the index
145*3d8817e4Smiodregisters.  Abbreviated as Mreg.
146*3d8817e4Smiod
147*3d8817e4Smiod@item Length Registers
148*3d8817e4SmiodThe set of 32-bit registers (L0, L1, L2, L3) that normally contain the
149*3d8817e4Smiodlength in bytes of the circular buffer.  Abbreviated as Lreg.  Clear
150*3d8817e4Smiodthe Lreg to disable circular addressing for the corresponding Ireg.
151*3d8817e4Smiod
152*3d8817e4Smiod@item Base Registers
153*3d8817e4SmiodThe set of 32-bit registers (B0, B1, B2, B3) that normally contain the
154*3d8817e4Smiodbase address in bytes of the circular buffer.  Abbreviated as Breg.
155*3d8817e4Smiod
156*3d8817e4Smiod@item Floating Point
157*3d8817e4SmiodThe Blackfin family has no hardware floating point but the .float
158*3d8817e4Smioddirective generates ieee floating point numbers for use with software
159*3d8817e4Smiodfloating point libraries.
160*3d8817e4Smiod
161*3d8817e4Smiod@item Blackfin Opcodes
162*3d8817e4SmiodFor detailed information on the Blackfin machine instruction set, see
163*3d8817e4Smiodthe Blackfin(r) Processor Instruction Set Reference.
164*3d8817e4Smiod
165*3d8817e4Smiod@end table
166*3d8817e4Smiod
167*3d8817e4Smiod@node BFIN Directives
168*3d8817e4Smiod@section Directives
169*3d8817e4Smiod@cindex BFIN directives
170*3d8817e4Smiod@cindex directives, BFIN
171*3d8817e4Smiod
172*3d8817e4SmiodThe following directives are provided for compatibility with the VDSP assembler.
173*3d8817e4Smiod
174*3d8817e4Smiod@table @code
175*3d8817e4Smiod@item .byte2
176*3d8817e4SmiodInitializes a four byte data object.
177*3d8817e4Smiod@item .byte4
178*3d8817e4SmiodInitializes a two byte data object.
179*3d8817e4Smiod@item .db
180*3d8817e4SmiodTBD
181*3d8817e4Smiod@item .dd
182*3d8817e4SmiodTBD
183*3d8817e4Smiod@item .dw
184*3d8817e4SmiodTBD
185*3d8817e4Smiod@item .var
186*3d8817e4SmiodDefine and initialize a 32 bit data object.
187*3d8817e4Smiod@end table
188