VirtualBox

Ignore:
Timestamp:
Aug 15, 2022 1:03:25 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
153031
Message:

IPRT/nocrt: log[f] tests and brushed up the code with SEH64 stuff. bugref:10261

Location:
trunk/src/VBox/Runtime/common/math
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/math/log.asm

    r96060 r96220  
    2525;
    2626
     27
     28%define RT_ASM_WITH_SEH64
    2729%include "iprt/asmdefs.mac"
     30%include "iprt/x86.mac"
     31
    2832
    2933BEGINCODE
     
    3438; @param    rd      [rbp + xCB*2] / xmm0
    3539RT_NOCRT_BEGINPROC log
    36     push    xBP
    37     mov     xBP, xSP
     40        push    xBP
     41        SEH64_PUSH_xBP
     42        mov     xBP, xSP
     43        SEH64_SET_FRAME_xBP 0
    3844%ifdef RT_ARCH_AMD64
    39     sub     xSP, 10h
     45        sub     xSP, 10h
     46        SEH64_ALLOCATE_STACK 10h
    4047%endif
     48        SEH64_END_PROLOGUE
    4149
    42     fldln2                              ; st0=log(2)
     50        fldln2                              ; st0=log(2)
    4351%ifdef RT_ARCH_AMD64
    44     movsd   [xSP], xmm0
    45     fld     qword [xSP]
     52        movsd   [xBP - 10h], xmm0
     53        fld     qword [xBP - 10h]
    4654%else
    47     fld     qword [xBP + xCB*2]         ; st1=log(2) st0=lrd
     55        fld     qword [xBP + xCB*2]         ; st1=log(2) st0=lrd
    4856%endif
    49     fld     st0                         ; st1=log(2) st0=lrd st0=lrd
    50     fsub    qword [.one xWrtRIP]        ; st2=log(2) st1=lrd st0=lrd-1.0
    51     fld     st0                         ; st3=log(2) st2=lrd st1=lrd-1.0 st0=lrd-1.0
    52     fabs                                ; st3=log(2) st2=lrd st1=lrd-1.0 st0=abs(lrd-1.0)
    53     fcomp   qword [.limit xWrtRIP]      ; st2=log(2) st1=lrd st0=lrd-1.0
    54     fnstsw  ax
    55     and     eax, 04500h
    56     jnz     .use_st1
     57        fld     st0                         ; st1=log(2) st0=lrd st0=lrd
     58        fsub    qword [.one xWrtRIP]        ; st2=log(2) st1=lrd st0=lrd-1.0
     59        fld     st0                         ; st3=log(2) st2=lrd st1=lrd-1.0 st0=lrd-1.0
    5760
    58     fstp    st0                         ; st1=log(2) st0=lrd
    59     fyl2x                               ; log(lrd)
    60     jmp     .done
     61        fabs                                ; st3=log(2) st2=lrd st1=lrd-1.0 st0=abs(lrd-1.0)
     62        fcomp   qword [.limit xWrtRIP]      ; st2=log(2) st1=lrd st0=lrd-1.0
     63        fnstsw  ax
     64        and     eax, X86_FSW_C3 | X86_FSW_C2 | X86_FSW_C0
     65        jnz    .use_st1
     66
     67        fstp    st0                         ; st1=log(2) st0=lrd
     68        fyl2x                               ; log(lrd)
     69        jmp     .done
    6170
    6271.use_st1:
    63     fstp    st1                         ; st1=log(2) st0=lrd-1.0
    64     fyl2xp1                             ; log(lrd)
     72        fstp    st1                         ; st1=log(2) st0=lrd-1.0
     73        fyl2xp1                             ; log(lrd)
    6574
    6675.done:
    6776%ifdef RT_ARCH_AMD64
    68     fstp    qword [xSP]
    69     movsd   xmm0, [xSP]
     77        fstp    qword [xBP - 10h]
     78        movsd   xmm0, [xBP - 10h]
    7079%endif
    71     leave
    72     ret
     80        leave
     81        ret
     82
     83ALIGNCODE(8)
    7384.one:   dq  1.0
    7485.limit: dq  0.29
  • trunk/src/VBox/Runtime/common/math/logf.asm

    r96060 r96220  
    2525;
    2626
     27
     28%define RT_ASM_WITH_SEH64
    2729%include "iprt/asmdefs.mac"
     30%include "iprt/x86.mac"
     31
    2832
    2933BEGINCODE
     
    3438; @param    r32     [rbp + xCB*2] / xmm0
    3539RT_NOCRT_BEGINPROC logf
    36     push    xBP
    37     mov     xBP, xSP
     40        push    xBP
     41        SEH64_PUSH_xBP
     42        mov     xBP, xSP
     43        SEH64_SET_FRAME_xBP 0
    3844%ifdef RT_ARCH_AMD64
    39     sub     xSP, 10h
     45        sub     xSP, 10h
     46        SEH64_ALLOCATE_STACK 10h
    4047%endif
     48        SEH64_END_PROLOGUE
    4149
    42     fldln2                              ; st0=log(2)
     50        fldln2                              ; st0=log(2)
    4351%ifdef RT_ARCH_AMD64
    44     movss   [xSP], xmm0
    45     fld     dword [xSP]
     52        movss   [xBP - 10h], xmm0
     53        fld     dword [xBP - 10h]
    4654%else
    47     fld     dword [xBP + xCB*2]         ; st1=log(2) st0=lrd
     55        fld     dword [xBP + xCB*2]         ; st1=log(2) st0=lrd
    4856%endif
    49     fld     st0                         ; st1=log(2) st0=lrd st0=lrd
    50     fsub    qword [.one xWrtRIP]        ; st2=log(2) st1=lrd st0=lrd-1.0
    51     fld     st0                         ; st3=log(2) st2=lrd st1=lrd-1.0 st0=lrd-1.0
    52     fabs                                ; st3=log(2) st2=lrd st1=lrd-1.0 st0=abs(lrd-1.0)
    53     fcomp   qword [.limit xWrtRIP]      ; st2=log(2) st1=lrd st0=lrd-1.0
    54     fnstsw  ax
    55     and     eax, 04500h
    56     jnz     .use_st1
     57        fld     st0                         ; st1=log(2) st0=lrd st0=lrd
     58        fsub    qword [.one xWrtRIP]        ; st2=log(2) st1=lrd st0=lrd-1.0
     59        fld     st0                         ; st3=log(2) st2=lrd st1=lrd-1.0 st0=lrd-1.0
    5760
    58     fstp    st0                         ; st1=log(2) st0=lrd
    59     fyl2x                               ; log(lrd)
    60     jmp     .done
     61        fabs                                ; st3=log(2) st2=lrd st1=lrd-1.0 st0=abs(lrd-1.0)
     62        fcomp   qword [.limit xWrtRIP]      ; st2=log(2) st1=lrd st0=lrd-1.0
     63        fnstsw  ax
     64        and     eax, X86_FSW_C3 | X86_FSW_C2 | X86_FSW_C0
     65        jnz     .use_st1
     66
     67        fstp    st0                         ; st1=log(2) st0=lrd
     68        fyl2x                               ; log(lrd)
     69        jmp     .done
    6170
    6271.use_st1:
    63     fstp    st1                         ; st1=log(2) st0=lrd-1.0
    64     fyl2xp1                             ; log(lrd)
     72        fstp    st1                         ; st1=log(2) st0=lrd-1.0
     73        fyl2xp1                             ; log(lrd)
    6574
    6675.done:
    6776%ifdef RT_ARCH_AMD64
    68     fstp    dword [xSP]
    69     movss   xmm0, [xSP]
     77        fstp    dword [xBP - 10h]
     78        movss   xmm0, [xBP - 10h]
    7079%endif
    71     leave
    72     ret
     80        leave
     81        ret
     82
     83ALIGNCODE(8)
    7384.one:   dq  1.0
    7485.limit: dq  0.29
  • trunk/src/VBox/Runtime/common/math/logl.asm

    r96014 r96220  
    2525;
    2626
     27
     28%define RT_ASM_WITH_SEH64
    2729%include "iprt/asmdefs.mac"
     30%include "iprt/x86.mac"
     31
    2832
    2933BEGINCODE
     
    3438; @param    lrd     [rbp + xCB*2]
    3539RT_NOCRT_BEGINPROC logl
    36     push    xBP
    37     mov     xBP, xSP
    38     sub     xSP, 10h
     40        push    xBP
     41        SEH64_PUSH_xBP
     42        mov     xBP, xSP
     43        SEH64_SET_FRAME_xBP 0
     44        SEH64_END_PROLOGUE
    3945
    40     fldln2                              ; st0=log(2)
    41     fld     tword [xBP + xCB*2]         ; st1=log(2) st0=lrd
    42     fld     st0                         ; st1=log(2) st0=lrd st0=lrd
    43     fsub    qword [.one xWrtRIP]        ; st2=log(2) st1=lrd st0=lrd-1.0
    44     fld     st0                         ; st3=log(2) st2=lrd st1=lrd-1.0 st0=lrd-1.0
    45     fabs                                ; st3=log(2) st2=lrd st1=lrd-1.0 st0=abs(lrd-1.0)
    46     fcomp   qword [.limit xWrtRIP]      ; st2=log(2) st1=lrd st0=lrd-1.0
    47     fnstsw  ax
    48     and     eax, 04500h
    49     jnz     .use_st1
     46        fldln2                              ; st0=log(2)
     47        fld     tword [xBP + xCB*2]         ; st1=log(2) st0=lrd
     48        fld     st0                         ; st1=log(2) st0=lrd st0=lrd
     49        fsub    qword [.one xWrtRIP]        ; st2=log(2) st1=lrd st0=lrd-1.0
     50        fld     st0                         ; st3=log(2) st2=lrd st1=lrd-1.0 st0=lrd-1.0
    5051
    51     fstp    st0                         ; st1=log(2) st0=lrd
    52     fyl2x                               ; log(lrd)
    53     jmp     .done
     52        fabs                                ; st3=log(2) st2=lrd st1=lrd-1.0 st0=abs(lrd-1.0)
     53        fcomp   qword [.limit xWrtRIP]      ; st2=log(2) st1=lrd st0=lrd-1.0
     54        fnstsw  ax
     55        and     eax, X86_FSW_C3 | X86_FSW_C2 | X86_FSW_C0
     56        jnz     .use_st1
     57
     58        fstp    st0                         ; st1=log(2) st0=lrd
     59        fyl2x                               ; log(lrd)
     60        jmp     .done
    5461
    5562.use_st1:
    56     fstp    st1                         ; st1=log(2) st0=lrd-1.0
    57     fyl2xp1                             ; log(lrd)
     63        fstp    st1                         ; st1=log(2) st0=lrd-1.0
     64        fyl2xp1                             ; log(lrd)
    5865
    5966.done:
    60     leave
    61     ret
     67        leave
     68        ret
     69
     70ALIGNCODE(8)
    6271.one:   dq  1.0
    6372.limit: dq  0.29
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette