VirtualBox

Ignore:
Timestamp:
Aug 22, 2014 7:12:23 AM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95666
Message:

ASMMultU32ByU32DivByU32: Cleaned up mess. Tested on x86 and amd64-msc.

File:
1 edited

Legend:

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

    r52444 r52454  
    4141BEGINPROC_EXPORTED ASMMultU32ByU32DivByU32
    4242%ifdef RT_ARCH_AMD64
     43 %ifdef ASM_CALL64_MSC
     44        mov     eax, ecx
     45        mul     edx
     46        div     r8d
     47 %else
     48        mov     eax, edi
     49        mov     ecx, edx
     50        mul     esi
     51        div     ecx
     52 %endif
    4353
    44  %ifdef ASM_CALL64_MSC
    45     mov     eax, ecx                    ; rax = u32A
    46     mov     r9d, edx                    ; should check the specs wrt to the high bits one day...
    47     mov     r8d, r8d                    ; be paranoid for the time being.
    48  %else
    49     mov     eax, edi                    ; rax = u32A
    50     mov     r9d, esi                    ; r9d = u32B
    51     mov     r8d, edx                    ; r8d = u32C
    52  %endif
    53     mul     r9
    54     div     r8
     54%elifdef RT_ARCH_X86
     55        mov     eax, [esp + 04h]
     56        mul     dword [esp + 08h]
     57        div     dword [esp + 0ch]
     58%else
     59 %error "Unsupported arch."
     60 unsupported arch
     61%endif
    5562
    56 %else ; X86
    57     ;
    58     ; This implementation is converted from the GCC inline
    59     ; version of the code. Nothing additional has been done
    60     ; performance wise.
    61     ;
    62 %define u32A        [esp + 04h]
    63 %define u32B        [esp + 08h]
    64 %define u32C        [esp + 0ch]
    65 
    66     ; Load parameters into registers.
    67     mov     eax, u32A
    68     mul     word u32B
    69     div     word u32C
    70 
    71 %endif
    72     ret
     63        ret
    7364ENDPROC ASMMultU32ByU32DivByU32
Note: See TracChangeset for help on using the changeset viewer.

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