| 1 |
/** |
| 2 |
* This file has no copyright assigned and is placed in the Public Domain. |
| 3 |
* This file is part of the mingw-w64 runtime package. |
| 4 |
* No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 |
*/ |
| 6 |
#include <_mingw_mac.h> |
| 7 |
|
| 8 |
.file "truncf.S" |
| 9 |
.text |
| 10 |
.p2align 4,,15 |
| 11 |
.globl __MINGW_USYMBOL(truncf) |
| 12 |
.def __MINGW_USYMBOL(truncf); .scl 2; .type 32; .endef |
| 13 |
|
| 14 |
#ifdef __x86_64__ |
| 15 |
.seh_proc __MINGW_USYMBOL(truncf) |
| 16 |
#endif |
| 17 |
__MINGW_USYMBOL(truncf): |
| 18 |
#if defined(_AMD64_) || defined(__x86_64__) |
| 19 |
subq $24, %rsp |
| 20 |
.seh_stackalloc 24 |
| 21 |
.seh_endprologue |
| 22 |
movd %xmm0, 12(%rsp) |
| 23 |
movl 12(%rsp), %edx |
| 24 |
movl %edx, %ecx |
| 25 |
sarl $23, %ecx |
| 26 |
andl $255, %ecx |
| 27 |
subl $127, %ecx |
| 28 |
cmpl $22, %ecx |
| 29 |
jg .l1 |
| 30 |
movl %edx, %r8d |
| 31 |
andl $-2147483648, %r8d |
| 32 |
testl %ecx, %ecx |
| 33 |
js .l2 |
| 34 |
movl $8388607, %eax |
| 35 |
sarl %cl, %eax |
| 36 |
notl %eax |
| 37 |
andl %edx, %eax |
| 38 |
orl %r8d, %eax |
| 39 |
movl %eax, 8(%rsp) |
| 40 |
movss 8(%rsp), %xmm0 |
| 41 |
addq $24, %rsp |
| 42 |
ret |
| 43 |
.p2align 4,,10 |
| 44 |
.l1: |
| 45 |
addl $-128, %ecx |
| 46 |
jne .noinfnan |
| 47 |
addss %xmm0, %xmm0 |
| 48 |
.noinfnan: |
| 49 |
addq $24, %rsp |
| 50 |
ret |
| 51 |
.p2align 4,,10 |
| 52 |
.l2: |
| 53 |
movl %r8d, 8(%rsp) |
| 54 |
movss 8(%rsp), %xmm0 |
| 55 |
addq $24, %rsp |
| 56 |
ret |
| 57 |
.seh_endproc |
| 58 |
#elif defined(_X86_) || defined(__i386__) |
| 59 |
flds 4(%esp) |
| 60 |
subl $8, %esp |
| 61 |
fstcw (%esp) |
| 62 |
/* FE_TOWARDZERO */ |
| 63 |
movzwl (%esp), %eax |
| 64 |
orb $0xc, %ah |
| 65 |
movw %ax, 4(%esp) |
| 66 |
fldcw 4(%esp) |
| 67 |
frndint |
| 68 |
fldcw (%esp) |
| 69 |
addl $8, %esp |
| 70 |
ret |
| 71 |
#endif |