delete superfluous assembly libc floor implementations

This commit is contained in:
David Senoner 2025-07-04 13:13:30 +02:00
parent 3124f700c7
commit b78751051f
No known key found for this signature in database
GPG key ID: 92BABE6B7E63C6CA
7 changed files with 1 additions and 136 deletions

View file

@ -1,51 +0,0 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <_mingw_mac.h>
.file "floorf.S"
.text
.p2align 4,,15
.globl __MINGW_USYMBOL(floorf)
.def __MINGW_USYMBOL(floorf); .scl 2; .type 32; .endef
#ifdef __x86_64__
.seh_proc __MINGW_USYMBOL(floorf)
#endif
__MINGW_USYMBOL(floorf):
#if defined(_AMD64_) || defined(__x86_64__)
subq $40, %rsp
.seh_stackalloc 40
.seh_endprologue
unpcklps %xmm0, %xmm0
cvtps2pd %xmm0, %xmm0
call floor
unpcklpd %xmm0, %xmm0
cvtpd2ps %xmm0, %xmm0
addq $40, %rsp
ret
.seh_endproc
.def __MINGW_USYMBOL(floor); .scl 2; .type 32; .endef
#elif defined(_X86_) || defined(__i386__)
flds 4(%esp)
subl $8,%esp
fstcw 4(%esp) /* store fpu control word */
/* We use here %edx although only the low 1 bits are defined.
But none of the operations should care and they are faster
than the 16 bit operations. */
movl $0x400,%edx /* round towards -oo */
orl 4(%esp),%edx
andl $0xf7ff,%edx
movl %edx,(%esp)
fldcw (%esp) /* load modified control word */
frndint /* round */
fldcw 4(%esp) /* restore original control word */
addl $8,%esp
ret
#endif

View file

@ -1,63 +0,0 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <_mingw_mac.h>
.file "floorl.S"
.text
#ifdef __x86_64__
.align 8
#else
.align 4
#endif
.globl __MINGW_USYMBOL(floorl)
.def __MINGW_USYMBOL(floorl); .scl 2; .type 32; .endef
__MINGW_USYMBOL(floorl):
#if defined(_AMD64_) || defined(__x86_64__)
fldt (%rdx)
subq $24,%rsp
fstcw 8(%rsp) /* store fpu control word */
/* We use here %edx although only the low 1 bits are defined.
But none of the operations should care and they are faster
than the 16 bit operations. */
movl $0x400,%edx /* round towards -oo */
orl 8(%rsp),%edx
andl $0xf7ff,%edx
movl %edx,(%rsp)
fldcw (%rsp) /* load modified control word */
frndint /* round */
fldcw 8(%rsp) /* restore original control word */
addq $24,%rsp
movq %rcx,%rax
movq $0,8(%rcx)
fstpt (%rcx)
ret
#elif defined(_X86_) || defined(__i386__)
fldt 4(%esp)
subl $8,%esp
fstcw 4(%esp) /* store fpu control word */
/* We use here %edx although only the low 1 bits are defined.
But none of the operations should care and they are faster
than the 16 bit operations. */
movl $0x400,%edx /* round towards -oo */
orl 4(%esp),%edx
andl $0xf7ff,%edx
movl %edx,(%esp)
fldcw (%esp) /* load modified control word */
frndint /* round */
fldcw 4(%esp) /* restore original control word */
addl $8,%esp
ret
#endif

View file

@ -1,20 +1,5 @@
.global floorf
.type floorf,@function
floorf:
flds 4(%esp)
jmp 1f
/* zig patch: removed `floorl` and `floorf` in favor of using zig compiler_rt's implementations */
.global floorl
.type floorl,@function
floorl:
fldt 4(%esp)
jmp 1f
.global floor
.type floor,@function
floor:
fldl 4(%esp)
1: mov $0x7,%al
1: fstcw 4(%esp)
mov 5(%esp),%ah
mov %al,5(%esp)

View file

@ -1 +0,0 @@
# see floor.s

View file

@ -1 +0,0 @@
# see floor.s

View file

@ -931,7 +931,6 @@ const mingw32_x86_src = [_][]const u8{
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "exp2l.S",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expl.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expm1l.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "floorl.S",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fmodl.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fucom.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "ilogbl.S",
@ -975,7 +974,6 @@ const mingw32_x86_32_src = [_][]const u8{
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atan2f.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atanf.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "ceilf.S",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "floorf.S",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fmodf.c",
};

View file

@ -953,8 +953,6 @@ const src_files = [_][]const u8{
"musl/src/math/i386/exp_ld.s",
"musl/src/math/i386/expl.s",
"musl/src/math/i386/expm1l.s",
"musl/src/math/i386/floorf.s",
"musl/src/math/i386/floorl.s",
"musl/src/math/i386/floor.s",
"musl/src/math/i386/fmod.c",
"musl/src/math/i386/fmodf.c",