10 #if defined(__i386__) || (defined __x86_64__) 11 asm(
" xor %%ecx,%%ecx\n" 12 " mov $499999,%%ecx\n" 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" 26 " addic. 15,15,-1 # decrement counter\n" 27 " bne 0,55b # loop until zero\n" 33 #elif defined(__ia64__) 35 asm(
" mov loc6=166666 // below is 6 instr.\n" 36 " ;; // because of that we count 4 too few\n" 38 " add loc6=-1,loc6 // decrement count\n" 40 " cmp.ne p2,p3=0,loc6\n" 41 "(p2) br.cond.dptk 55b // if not zero, loop\n" 47 #elif defined(__sparc__) 48 asm(
" sethi %%hi(333333), %%l0\n" 49 " or %%l0,%%lo(333333),%%l0\n" 51 " deccc %%l0 ! decrement count\n" 52 " bnz test_loop ! repeat until zero\n" 53 " nop ! branch delay slot\n" 59 #elif defined(__arm__) 60 asm(
" ldr r2,count @ set count\n" 62 "count: .word 333332\n" 66 " bne test_loop @ repeat till zero\n" 72 #elif defined(__aarch64__) 73 asm(
" ldr x2,=333332 // set count\n" 77 " bne test_loop // repeat till zero\n" 94 #if defined(__i386__) || (defined __x86_64__) 96 int saved_cw,result,cw;
99 asm(
" mov $100000,%%ecx\n" 101 " fldl %1 # load value onto fp stack\n" 102 " fnstcw %0 # store control word to mem\n" 103 " movzwl %0, %%eax # load cw from mem, zero extending\n" 104 " movb $12, %%ah # set cw for \"round to zero\"\n" 105 " movw %%ax, %3 # store back to memory\n" 106 " fldcw %3 # save new rounding mode\n" 107 " fistpl %2 # save stack value as integer to mem\n" 108 " fldcw %0 # restore old cw\n" 109 " loop big_loop # loop to make the count more obvious\n" 111 :
"m"(saved_cw),
"m"(three),
"m"(result),
"m"(cw)
112 :
"cc",
"%ecx",
"%eax" 126 #if defined(__i386__) || defined(__ILP32__) 128 char buffer_out[16384];
130 asm(
" mov $1000,%%edx\n" 132 "loadstore: # test 8-bit store\n" 133 " mov $0xd, %%al # set eax to d\n" 134 " mov $16384, %%ecx\n" 135 " mov %0, %%edi # set destination\n" 136 " rep stosb # store d 16384 times, auto-increment\n" 141 :
"cc",
"%esi",
"%edi",
"%edx",
"%ecx",
"%eax",
"memory" 144 #elif defined (__x86_64__) 146 char buffer_out[16384];
148 asm(
" mov $1000,%%edx\n" 150 "loadstore: # test 8-bit store\n" 151 " mov $0xd, %%al # set eax to d\n" 152 " mov $16384, %%ecx\n" 153 " mov %0, %%rdi # set destination\n" 154 " rep stosb # store d 16384 times, auto-increment\n" 159 :
"cc",
"%esi",
"%edi",
"%edx",
"%ecx",
"%eax",
"memory" #define CODE_UNIMPLEMENTED
int instructions_million(void)
int instructions_rep(void)
int instructions_fldcw(void)