8 {
9
10#if defined(__i386__) || (defined __x86_64__)
11 asm( " xor %%ecx,%%ecx\n"
12 " mov $499999,%%ecx\n"
13 "55:\n"
14 " dec %%ecx\n"
15 " jnz 55b\n"
16 :
17 :
18 : "cc", "%ecx"
19 );
20 return 0;
21#elif defined(__PPC__)
22 asm( " nop # to give us an even million\n"
23 " lis 15,499997@ha # load high 16-bits of counter\n"
24 " addi 15,15,499997@l # load low 16-bits of counter\n"
25 "55:\n"
26 " addic. 15,15,-1 # decrement counter\n"
27 " bne 0,55b # loop until zero\n"
28 :
29 :
30 : "cc", "15"
31 );
32 return 0;
33#elif defined(__ia64__)
34
35 asm( " mov loc6=166666 // below is 6 instr.\n"
36 " ;; // because of that we count 4 too few\n"
37 "55:\n"
38 " add loc6=-1,loc6 // decrement count\n"
39 " ;;\n"
40 " cmp.ne p2,p3=0,loc6\n"
41 "(p2) br.cond.dptk 55b // if not zero, loop\n"
42 :
43 :
44 : "p2", "loc6"
45 );
46 return 0;
47#elif defined(__sparc__)
48 asm( " sethi %%hi(333333), %%l0\n"
49 " or %%l0,%%lo(333333),%%l0\n"
50 "55:\n"
51 " deccc %%l0 ! decrement count\n"
52 " bnz 55b ! repeat until zero\n"
53 " nop ! branch delay slot\n"
54 :
55 :
56 : "cc", "l0"
57 );
58 return 0;
59#elif defined(__arm__)
60 asm( " ldr r2,42f @ set count\n"
61 " b 55f\n"
62 "42: .word 333332\n"
63 "55:\n"
64 " add r2,r2,#-1\n"
65 " cmp r2,#0\n"
66 " bne 55b @ repeat till zero\n"
67 :
68 :
69 : "cc", "r2"
70 );
71 return 0;
72#elif defined(__aarch64__)
73 asm( " ldr x2,=333332 // set count\n"
74 "55:\n"
75 " add x2,x2,#-1\n"
76 " cmp x2,#0\n"
77 " bne 55b // repeat till zero\n"
78 :
79 :
80 : "cc", "r2"
81 );
82 return 0;
83#endif
84
86
87}