23 {
24
25#if defined(__i386__) || (defined __x86_64__)
26 asm( "\txor %%ecx,%%ecx\n"
27 "\tmov $500000,%%ecx\n"
28 "test_loop:\n"
29 "\tjmp test_jmp\n"
30 "\tnop\n"
31 "test_jmp:\n"
32 "\txor %%eax,%%eax\n"
33 "\tjnz test_jmp2\n"
34 "\tinc %%eax\n"
35 "test_jmp2:\n"
36 "\tdec %%ecx\n"
37 "\tjnz test_loop\n"
38 :
39 :
40 : "cc", "%ecx", "%eax"
41 );
42 return 0;
43
44#elif defined(__arm__)
45
46 asm( "\teor r3,r3,r3\n"
47 "\tldr r3,=500000\n"
48 "test_loop:\n"
49 "\tB test_jmp\n"
50 "\tnop\n"
51 "test_jmp:\n"
52 "\teor r2,r2,r2\n"
53 "\tcmp r2,#1\n"
54 "\tbge test_jmp2\n"
55 "\tnop\n"
56 "\tadd r2,r2,#1\n"
57 "test_jmp2:\n"
58 "\tsub r3,r3,#1\n"
59 "\tcmp r3,#1\n"
60 "\tbgt test_loop\n"
61 :
62 :
63 : "cc", "r2", "r3"
64 );
65
66 return 0;
67#elif defined(__aarch64__)
68 asm( "\teor x3,x3,x3\n"
69 "\tldr x3,=500000\n"
70 "test_loop:\n"
71 "\tB test_jmp\n"
72 "\tnop\n"
73 "test_jmp:\n"
74 "\teor x2,x2,x2\n"
75 "\tcmp x2,#1\n"
76 "\tbge test_jmp2\n"
77 "\tnop\n"
78 "\tadd x2,x2,#1\n"
79 "test_jmp2:\n"
80 "\tsub x3,x3,#1\n"
81 "\tcmp x3,#1\n"
82 "\tbgt test_loop\n"
83 :
84 :
85 : "cc", "x2", "x3"
86 );
87
88 return 0;
89#elif defined(__powerpc__)
90
91
92 asm( "\txor 3,3,3\n"
93 "\tlis 3,500000@ha\n"
94 "\taddi 3,3,500000@l\n"
95 "test_loop:\n"
96 "\tb test_jmp\n"
97 "\tnop\n"
98 "test_jmp:\n"
99 "\txor 4,4,4\n"
100 "\tcmpwi cr0,4,1\n"
101 "\tbge test_jmp2\n"
102 "\tnop\n"
103 "\taddi 4,4,1\n"
104 "test_jmp2:\n"
105 "\taddi 3,3,-1\n"
106 "\tcmpwi cr0,3,1\n"
107 "\tbgt test_loop\n"
108 :
109 :
110 : "cr0", "r3", "r4"
111 );
112
113 return 0;
114#endif
115
116 return -1;
117
118}