Subversion Repositories Kolibri OS

Rev

Rev 313 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;
  2. ;
  3. ;  k6, k7, p5 & p6 based on Robert Redelmeier's burnCPU tests
  4. ;  ported by Ghost
  5. ;
  6. ; Çàìåòêè :
  7. ;       ïåðåïèñòü ðåàêöèþ íà îøèáêè
  8.  
  9. k6:
  10.         finit
  11.         push    ebp
  12.         mov     ebp, esp
  13.         and     ebp, -32
  14.         sub     esp, 96
  15.         fldpi
  16.         fld     qword [rtt]
  17.         fstp    qword [ebp - 24]
  18.         fld     qword [e]
  19.         fstp    qword [ebp - 32]
  20.         mov     edx, [half]
  21.         mov     [ebp - 8], edx
  22. k6_after_check:
  23.         xor     eax, eax
  24.         mov     ebx, eax
  25.         lea     esi, [eax - 1]
  26.         mov     ecx, 400000000
  27.         mov     [ebp - 4], ecx
  28. align   32
  29.         ;rev. eng. win. ver. (lea esi, [esi]) ; Ghost
  30. k6_crunch:                             
  31.         fld     qword [ebp+esi*8-16]            ; CALC BLOCK
  32.         fmul    qword [ebp+esi*8-24]
  33.         add     edx, [half + 9 + esi + esi * 8] ;!!!
  34.         jnz     $ + 2
  35.         faddp  
  36.         fld     qword [ebp+esi*8-16]
  37.         dec     ebx
  38.         sub     edx, [half + 9 + esi + esi * 8] ;!!!
  39.         jmp     $ + 2
  40.         fmul    qword [ebp+esi*8-24]
  41.         inc     ebx
  42.         dec     dword [ebp+esi*8+4]
  43.         fsubp  
  44.         jnz     k6_crunch                       ; time for testing ?
  45.  
  46.         test    ebx, ebx                        ; TEST BLOCK
  47.         jnz     k6_int_exit
  48.         cmp     edx, [half]
  49.         jnz     k6_int_exit
  50.         fldpi
  51.         fcomp   st1
  52.         fstsw   ax
  53.         sahf
  54.         jz      k6_after_check
  55.         dec     ebx
  56. k6_int_exit:
  57.         dec     ebx
  58.         add     esp, 96
  59.         pop     ebp
  60.         mov     eax, -1
  61.         int     0x40
  62. ;#######################################################################
  63. ;#######################################################################
  64. k7:     finit
  65.         mov     ebp, esp
  66.         and     ebp,-32
  67.         sub     esp,96
  68.         fld     qword [rtt]
  69.         fstp    qword [ebp-40]
  70.         fld     qword [e]
  71.         fstp    qword [ebp-32]
  72.         fldpi
  73.         fldpi
  74.         xor     eax, eax
  75.         xor     ebx, ebx
  76.         xor     ecx, ecx
  77.         mov     edx, half
  78.         lea     esi,[eax-1]
  79.         mov     [ebp-12], eax
  80.         mov     [ebp-8], edx
  81.  
  82. k7_after_check:
  83.         mov     dword[ebp-4], 0x32A9F880;0x850000000    ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  84. ALIGN 16
  85. k7_crunch:
  86.         fxch                                    ; CALC BLOCK
  87.         fld     qword [ebp+esi*8-24]            ; 17 instr / 6.0 cycles
  88.         fmul    qword [ebp+esi*8-32]
  89.         faddp
  90.         dec     ecx
  91.         fld     qword [ebp+esi*8-24]
  92.         dec     ebx
  93.         inc     dword [ebp+esi*8-12]
  94.         inc     ecx
  95.         fmul    qword [ebp+esi*8-32]
  96.         inc     ebx
  97.         dec     dword [ebp+esi*8-4]
  98.         jmp     $+2
  99.         fsubp    st2, st0
  100.         jnz     k7_crunch                       ; time for testing ?
  101.         test    ebx, ebx                        ; TEST BLOCK
  102.         jnz     k7_int_exit
  103.         test    ecx, ecx
  104.         jnz     k7_int_exit
  105.         cmp     edx, half
  106.         jnz     k7_int_exit
  107.         fcom    st1
  108.         fstsw   ax
  109.         sahf
  110.         jz      k7_after_check
  111.         dec     ebx
  112. k7_int_exit:
  113.         dec     ebx
  114.         add     esp,96
  115.         mov     eax, -1
  116.         int     0x40
  117. ;#######################################################################
  118. ;#######################################################################
  119. p5:     finit
  120.         push    ebp
  121.         mov     ebp, esp
  122.         and     ebp, -32
  123.         sub     esp, 96
  124.         fld     qword [half]
  125.         fstp    qword [ebp - 24]
  126.         fld     qword [rtt]
  127.         fst     qword [ebp - 16]
  128.         fld     st
  129.         fld     st
  130. p5_after_check:
  131.         xor     eax, eax
  132.         mov     eax, ebx
  133.         mov     ecx, 200000000
  134. align   32
  135.                                 ;# MAIN LOOP  16 flops / 18 cycles
  136. p5_crunch:         
  137.         fmul    qword [ebp - 24]
  138.         fxch    st1
  139.         fadd    qword [ebp - 16]
  140.         fxch    st2
  141.         fmul    qword [ebp - 24]
  142.         fxch    st1
  143.         fadd    qword [ebp - 16]
  144.         fxch    st2
  145.  
  146.         fmul    qword [ebp - 24]
  147.         fxch    st1
  148.         fadd    qword [ebp - 16]
  149.         fxch    st2
  150.         fmul    qword [ebp - 24]
  151.         fxch    st1
  152.         fadd    qword [ebp - 16]
  153.         fxch    st2
  154.  
  155.         fmul    qword [ebp - 24]
  156.         fxch    st1
  157.         fadd    qword [ebp - 16]
  158.         fxch    st2
  159.         fmul    qword [ebp - 24]
  160.         fxch    st1
  161.         fadd    qword [ebp - 16]
  162.         fxch    st2
  163.  
  164.         fmul    qword [ebp - 24]
  165.         fxch    st1
  166.         fadd    qword [ebp - 16]
  167.         fxch    st2
  168.         fmul    qword [ebp - 24]
  169.         fxch    st1
  170.         fadd    qword [ebp - 16]
  171.         fxch    st2
  172.  
  173.         dec     ecx
  174.         jnz     p5_crunch
  175.  
  176.         jmp     p5_after_check
  177. ;#######################################################################
  178. ;#######################################################################       
  179. p6:     finit
  180.         push    ebp
  181.         mov     ebp, esp
  182.         and     ebp, -32
  183.         sub     esp, 96
  184.         fldpi
  185.         fld     qword [rtt]
  186.         fstp    qword [ebp - 24]
  187.         fld     qword [e]
  188.         fstp    qword [ebp - 32]
  189.         mov     edx, [half]
  190.         mov     [ebp - 8], edx
  191. p6_after_check:
  192.         xor     eax, eax
  193.         mov     ebx, eax
  194.         lea     esi, [eax - 1]
  195.         mov     ecx, 539000000          ;# check after this count  
  196.         mov     [ebp - 4], ecx
  197. align   32
  198. p6_crunch:                              ;# MAIN LOOP    21uops / 8.0 clocks
  199.         fld     qword [ebp+esi*8-16]
  200.         fmul    qword [ebp+esi*8-24]
  201.         add     edx, [half]
  202.         jnz     $ + 2
  203.         faddp  
  204.         fld     qword [ebp - 24]
  205.         dec     ebx
  206.         sub     edx, [half + 9 + esi + esi*8]
  207.         jmp     $ + 2
  208.         fmul    qword [ebp+esi*8-24]
  209.         inc     ebx
  210.         dec     dword [ebp+esi*8+4]
  211.         fsubp  
  212.         jnz     p6_crunch              
  213.  
  214.         test    ebx, ebx                ;# Testing block
  215.         mov     ebx, 0
  216.         jnz     p6_int_exit
  217.         cmp     edx, [half]
  218.         jnz     p6_int_exit
  219.         fldpi
  220.         fcomp   st1
  221.         fstsw   ax
  222.         sahf
  223.         jz      p6_after_check          ;# fp result = pi ?
  224.         dec     ebx
  225. p6_int_exit:                            ;# error abort
  226.         dec     ebx
  227.         add     esp, 96
  228.         pop     ebp
  229.         mov     eax, -1
  230.         int     0x40
  231. ;---------------------------------------------
  232. align   32
  233.         half    dd      0x7fffffff, 0
  234.         e       dd      0xffffffff, 0x3fdfffff
  235.         rtt     dd      0xffffffff, 0x3fefffff
  236.