01 May 2023, 11:17 | #1 |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 680
|
cycle counting with vamos
Here is a simple bash script to get the cycle count for instructions in vamos:
Code:
#!/bin/bash [ "$1" != "" ] && cpu=-C$1 case $1 in 20) rts=10 ;; *) rts=16 ;; esac readarray -t f < asm for i in "${!f[@]}"; do line="${f[$i]}" echo " $line" >x.s echo " rts" >>x.s /opt/amiga/bin/m68k-amigaos-gcc x.s -o x -nostdlib r=$(vamos -v $cpu x |& grep cycles) r=${r#*cycles:} r=$[r - $rts] echo "$line = $r" done Code:
add.l d0,d0 lsl.l #2,d0 move.b d0,(a0) move.w d0,(a0) move.l d0,(a0) move.l d0,(a0)+ move.l d0,-(a0) move.l (a0)+,d0 move.l -(a0),d0 move.l d0,(2,a0) move.l d0,(2,a0,d0) move.l (a0),(a0) move.l (2,a0),(2,a0) move.l (2,a0,d0),(2,a0,d0) move.l 0x10000,d0 move.l d0,0x10000 mulu #0x2,d0 mulu #0x3,d0 mulu #0x101,d0 muls #0x5555,d0 lea (a5,a5.l),a1 Code:
add.l d0,d0 = 6 lsl.l #2,d0 = 12 move.b d0,(a0) = 8 move.w d0,(a0) = 8 move.l d0,(a0) = 12 move.l d0,(a0)+ = 12 move.l d0,-(a0) = 12 move.l (a0)+,d0 = 12 move.l -(a0),d0 = 14 move.l d0,(2,a0) = 16 move.l d0,(2,a0,d0) = 18 move.l (a0),(a0) = 20 move.l (2,a0),(2,a0) = 28 move.l (2,a0,d0),(2,a0,d0) = 32 move.l 0x10000,d0 = 20 move.l d0,0x10000 = 20 mulu #0x2,d0 = 44 mulu #0x3,d0 = 46 mulu #0x101,d0 = 46 muls #0x5555,d0 = 72 lea (a5,a5.l),a1 = 12 Last edited by bebbo; 01 May 2023 at 13:34. |
01 May 2023, 12:09 | #2 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,176
|
Interesting! Does it estimate best/worse cases for 68020+ or is it just for 68000 ?
|
01 May 2023, 13:34 | #3 |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 680
|
I updated the script to support the parameter "20" for 68020. Output is then
Code:
add.l d0,d0 = 2 lsl.l #2,d0 = 4 move.b d0,(a0) = 4 move.w d0,(a0) = 4 move.l d0,(a0) = 4 move.l d0,(a0)+ = 4 move.l d0,-(a0) = 5 move.l (a0)+,d0 = 6 move.l -(a0),d0 = 7 move.l d0,(2,a0) = 5 move.l d0,(2,a0,d0) = 7 move.l (a0),(a0) = 8 move.l (2,a0),(2,a0) = 10 move.l (2,a0,d0),(2,a0,d0) = 14 move.l 0x10000,d0 = 6 move.l d0,0x10000 = 6 mulu #0x2,d0 = 29 mulu #0x3,d0 = 29 mulu #0x101,d0 = 29 muls #0x5555,d0 = 29 lea (a5,a5.l),a1 = 9 Last edited by bebbo; 01 May 2023 at 13:54. |
01 May 2023, 14:03 | #4 |
Alien Bleed
Join Date: Aug 2022
Location: UK
Posts: 4,176
|
So does it just count cycles for each instruction or does it also take into consideration pipelining across a sequence of instructions?
|
01 May 2023, 16:01 | #5 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Counting Zorro slots | Wrangler | Coders. System | 8 | 17 September 2022 12:06 |
[ARexx] Error while counting icons (bug?) | mateusz_s | Coders. Scripting | 3 | 14 September 2021 11:14 |
Running AmigaOS 3.1.4 shell on vamos | palaste | support.Other | 6 | 26 November 2020 11:19 |
Amitools / vamos project | copse | Coders. General | 4 | 01 January 2014 20:59 |
|
|