1 | ; $Id: ftol2-vcc.asm 96371 2022-08-20 02:29:40Z vboxsync $
|
---|
2 | ;; @file
|
---|
3 | ; IPRT - Floating Point to Integer related Visual C++ support routines.
|
---|
4 | ;
|
---|
5 |
|
---|
6 | ;
|
---|
7 | ; Copyright (C) 2022 Oracle Corporation
|
---|
8 | ;
|
---|
9 | ; This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | ; available from http://www.215389.xyz. This file is free software;
|
---|
11 | ; you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | ; General Public License (GPL) as published by the Free Software
|
---|
13 | ; Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | ; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | ; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | ;
|
---|
17 | ; The contents of this file may alternatively be used under the terms
|
---|
18 | ; of the Common Development and Distribution License Version 1.0
|
---|
19 | ; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | ; VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | ; CDDL are applicable instead of those of the GPL.
|
---|
22 | ;
|
---|
23 | ; You may elect to license modified versions of this file under the
|
---|
24 | ; terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | ;
|
---|
26 |
|
---|
27 |
|
---|
28 | %include "iprt/asmdefs.mac"
|
---|
29 | %include "iprt/x86.mac"
|
---|
30 |
|
---|
31 |
|
---|
32 | ;;
|
---|
33 | ; Convert st0 to integer returning it in eax, popping st0.
|
---|
34 | ;
|
---|
35 | ; @returns value in eax
|
---|
36 | ; @param st0 The value to convet. Will be popped.
|
---|
37 | ; @uses eax, st0, FSW.TOP
|
---|
38 | ;
|
---|
39 | GLOBALNAME_RAW __ftol2_sse_excpt, function, RT_NOTHING
|
---|
40 | GLOBALNAME_RAW __ftol2_sse, function, RT_NOTHING ;; @todo kind of expect __ftol2_sse to take input in xmm0 and return in edx:eax.
|
---|
41 | BEGINPROC_RAW __ftoi2
|
---|
42 | push ebp
|
---|
43 | mov ebp, esp
|
---|
44 | sub esp, 8h
|
---|
45 | fisttp dword [esp]
|
---|
46 | mov eax, [esp]
|
---|
47 | leave
|
---|
48 | ret
|
---|
49 | ENDPROC_RAW __ftoi2
|
---|
50 |
|
---|
51 |
|
---|
52 | ;;
|
---|
53 | ; Convert st0 to integer returning it in edx:eax, popping st0.
|
---|
54 | ;
|
---|
55 | ; @returns value in edx:eax
|
---|
56 | ; @param st0 The value to convet. Will be popped.
|
---|
57 | ; @uses eax, edx, st0, FSW.TOP
|
---|
58 | ;
|
---|
59 | BEGINPROC_RAW __ftol2
|
---|
60 | push ebp
|
---|
61 | mov ebp, esp
|
---|
62 | sub esp, 8h
|
---|
63 | and esp, 0fffffff8h ; proper alignment.
|
---|
64 | fisttp qword [esp]
|
---|
65 | mov eax, [esp]
|
---|
66 | mov edx, [esp + 8]
|
---|
67 | leave
|
---|
68 | ret
|
---|
69 | ENDPROC_RAW __ftol2
|
---|
70 |
|
---|