Skip to content

Commit 9184b85

Browse files
author
Bruno Larsen (billionai)
committed
tests/tcg/ppc64le: added speed test
Added test that runs only instruction that were already ported to decodetree, so we can evaluate the speed difference between using the legacy system and decodetree. Signed-off-by: Bruno Larsen (billionai) <[email protected]>
1 parent 403fd14 commit 9184b85

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/tcg/ppc64le/speedTest.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <stdint.h>
2+
3+
/*
4+
* This code is only useful for testing speed difference between 2 qemu
5+
* instances, to see if there are significant speed differences.
6+
*
7+
* Was mainly used to see if moving to decodetree had an appreciable
8+
* speed difference. In this big loop, the final time difference was about
9+
* 0.5% faster on decodetree
10+
*/
11+
12+
int main(){
13+
volatile uint64_t i,max,one;
14+
i = 0;
15+
max = 1;
16+
max <<=38;
17+
one = 1;
18+
__asm__("ld 2, %[um]\n\t": [um] "=m" (one));
19+
__asm__("loop: \n\t");
20+
__asm__("ld 0, %[ii]\n\t": [ii] "=m" (i));
21+
__asm__("ld 1, %[mm]\n\t": [mm] "=m" (max));
22+
__asm__("add 0, 0, 2 \n\t");
23+
__asm__("cmpd 0, 1 \n\t");
24+
__asm__("std 0, %[ii]\n\t": [ii] "=m" (i));
25+
__asm__("std 1, %[mm]\n\t": [mm] "=m" (max));
26+
__asm__("blt loop \n\t");
27+
return 0;
28+
}

0 commit comments

Comments
 (0)