2 #output: Basic clock cycles, total @: *\n
3 #output: Memory source stall cycles: 82\n
4 #output: Memory read-after-write stall cycles: 0\n
5 #output: Movem source stall cycles: 6\n
6 #output: Movem destination stall cycles: 880\n
7 #output: Movem address stall cycles: 4\n
8 #output: Multiplication source stall cycles: 18\n
9 #output: Jump source stall cycles: 6\n
10 #output: Branch misprediction stall cycles: 0\n
11 #output: Jump target stall cycles: 0\n
12 #sim: --cris-cycles=basic
14 .include "testutils.inc"
16 ; Macros for testing correctness of movem destination stall
17 ; cycles for various insn types. Beware: macro parameters can
18 ; be comma or space-delimited. There are problems (i.e. bugs)
19 ; with using space-delimited operands and operands with
20 ; non-alphanumeric characters, like "[]-." so use comma for
21 ; them. Lots of trouble passing empty parameters and parameters
22 ; with comma. Ugh. FIXME: Report bugs, fix bugs, fix other
23 ; shortcomings, fix that darn old macro-parameter-in-string.
25 ; Helper macro. Unfortunately I find no cleaner way to unify
26 ; one and two-operand cases, the main problem being the comma
27 ; operand delimiter clashing with macro operand delimiter.
28 .macro t_S_x_y S insn x y=none
48 ; An insn-type that has a single register operand. The register
49 ; may or may not be a source register for the insn.
55 ; An insn-type that jumps to the destination of the register.
78 ; An insn-type that has a size-modifier and two register
81 t_S_x_y \S \insn r3 r8
82 t_S_x_y \S \insn r8 r3
84 t_S_x_y \S \insn r4 r3
85 t_S_x_y \S \insn r8 r9
88 ; An insn-type that has two register operands.
93 ; An t_r_rx insn with a byte or word-size modifier.
99 ; Ditto with a dword-size modifier.
105 ; An insn-type that has a size-modifier, a constant and a
108 t_S_x_y \S \insn 24 r3
110 t_S_x_y \S \insn 24 r8
113 ; An insn-type that has a constant and a register operand.
118 ; An t_c_r insn with a byte or word-size modifier.
124 ; Ditto with a dword-size modifier.
130 ; An insn-type that has size-modifier, a memory operand and a
134 t_S_x_y \S,\insn,[r4],r3
136 t_S_x_y \S,\insn,[r8],r5
138 t_S_x_y \S,\insn,[r3],r9
139 t_S_x_y \S,\insn,[r8],r9
145 t_S_x_y \S,\insn,r3,[r4]
146 t_S_x_y \S,\insn,r8,[r3]
147 t_S_x_y \S,\insn,r3,[r8]
148 t_S_x_y \S,\insn,r9,[r8]
151 ; An insn-type that has a memory operand and a register operand.
156 ; An t_m_r insn with a byte or word-size modifier.
162 ; Ditto with a dword-size modifier.
168 ; Insn types of the regular type (r, c, m, size d w b).
175 ; Similar, sizes w b.
182 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
186 ; Initialize registers so they don't contain unknowns.
192 ; Movem source area. Register contents must be valid
193 ; addresses, aligned on a cache boundary.
209 ; The actual tests. The numbers in the comments specify the
210 ; number of movem destination stall cycles. Some of them may be
211 ; filed as memory source address stalls, multiplication source
212 ; stalls or jump source stalls, duly marked so.
216 t_dwb add ; (3+3+3)*3+3*3+(3+3+3)*3 (6 mem src)
220 t_m_r addc ; (3+3+3) (2 mem src)
222 t_dwb move ; (3+3)+(3+3+3)*2+3*2+(3+3+3)*3 (6 mem src)
223 t_xr_m .b move ; 3+3+3 (2 mem src)
224 t_xr_m .w move ; 3+3+3 (2 mem src)
225 t_xr_m .d move ; 3+3+3 (2 mem src)
227 t_S_x_y none addi r3.b r8 ; 3
228 t_S_x_y none addi r8.w r3 ; 3
229 t_S_x_y none addi r4.d r3 ; 3
230 t_S_x_y none addi r8.w r9
232 ; Addo has three-operand syntax, so we have to expand (a useful
233 ; subset of) "t_dwb".
234 t_S_x_y none addi r3.b "r8,acr" ; 3
235 t_S_x_y none addi r8.w "r3,acr" ; 3
236 t_S_x_y none addi r4.d "r3,acr" ; 3
237 t_S_x_y none addi r8.w "r9,acr"
239 t_S_x_y .b addo 42 "r8,acr"
240 t_S_x_y .w addo 4200 "r3,acr" ; 3
241 t_S_x_y .d addo 420000 "r3,acr" ; 3
244 t_S_x_y .d,addo,[r4],"r3,acr" ; 3 (1 mem src)
245 t_S_x_y .b,addo,[r3],"r8,acr" ; 3 (1 mem src)
246 t_S_x_y .w,addo,[r8],"r3,acr" ; 3
247 t_S_x_y .w,addo,[r8],"r9,acr"
250 t_S_x_y none addoq 42 "r8,acr"
251 t_S_x_y none addoq 42 "r3,acr" ; 3
255 t_wb adds ; (3+3+3)*2+3*2+(3+3+3)*2 (4 mem src)
256 t_wb addu ; (3+3+3)*2+3*2+(3+3+3)*2 (4 mem src)
258 t_dwb and ; (3+3+3)*3+3*3+(3+3+3)*3 (6 mem src)
261 t_dwbr_r asr ; (3+3+3)*3
264 t_dwbr_r bound ; (3+3+3)*3
270 t_dwb cmp ; (3+3+3)*3+3*3+(3+3+3)*3 (6 mem src)
275 t_wbm_r cmps ; (3+3+3)*2 (4 mem src)
276 t_wbm_r cmpu ; (3+3+3)*2 (4 mem src)
278 t_r_r dstep ; (3+3+3)
280 ; FIXME: idxd, fidxi, ftagd, ftagi when supported.
282 t_r_j jsr ; 3 (2 jump src)
283 t_r_j jump ; 3 (2 jump src)
287 ; The "quick operand" must be in range [. to .+15*2] so we can't
289 t_S_x_y none lapcq .+4 r3
290 t_S_x_y none lapcq .+4 r8
292 t_dwbr_r lsl ; (3+3+3)*3
295 t_dwbr_r lsr ; (3+3+3)*3
300 t_S_x_y none mcp srp r3 ; 3
301 t_S_x_y none mcp srp r8
305 t_S_x_y none move srp r8
306 t_S_x_y none move srp r3
307 t_S_x_y none move r8 srp
308 t_S_x_y none move r3 srp ; 3
310 ; FIXME: move supreg,Rd and move Rs,supreg when supported.
312 t_wb movs ; (3+3)*2+0+(3+3)*2 (4 mem src)
313 t_wb movu ; (3+3)*2+0+(3+3)*2 (4 mem src)
315 t_dwbr_r muls ; (3+3+3)*3 (9 mul src)
316 t_dwbr_r mulu ; (3+3+3)*3 (9 mul src)
318 t_dwbr_r neg ; (3+3)*3
322 t_dwb or ; (3+3+3)*3+3*3+(3+3+3)*3 (6 mem src)
327 t_dwb sub ; (3+3+3)*3+3*3+(3+3+3)*3 (6 mem src)
330 t_wb subs ; (3+3+3)*2+3*2+(3+3+3)*2 (4 mem src)
331 t_wb subu ; (3+3+3)*2+3*2+(3+3+3)*2 (4 mem src)
333 t_r swapw ; 3 cycles.
334 t_r swapnwbr ; 3 cycles.
336 t_r_j jsrc ; 3 (2 jump src)
344 t_xm_r none movem ; (3+3) (2 mem src, 1+1 movem addr)
345 ; As implied by the comment, all movem destination penalty
346 ; cycles (but one) are accounted for as memory source address
347 ; and movem source penalties. There are also two movem address
348 ; cache-line straddle penalties.
349 t_xr_m none movem ; (3+3+2+2) (2 mem, 6 movem src, +2 movem addr)