crt: Move ARM64 trunc implementation to C files. In preparation for using naked functions. Signed-off-by: Jacek Caban <jacek@codeweavers.com>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index ba6c6b7..7450160 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am
@@ -705,8 +705,8 @@ math/arm64/nearbyint.S \ math/arm64/nearbyintf.S \ math/arm64/nearbyintl.S \ - math/arm64/trunc.S \ - math/arm64/truncf.S \ + math/arm64/trunc.c \ + math/arm64/truncf.c \ misc/__p___argc.c \ misc/__p___argv.c \ misc/__p___wargv.c \
diff --git a/mingw-w64-crt/include/internal.h b/mingw-w64-crt/include/internal.h index 84d52c9..0d75d63 100644 --- a/mingw-w64-crt/include/internal.h +++ b/mingw-w64-crt/include/internal.h
@@ -287,6 +287,14 @@ return flags; } +#define __ASM_NAKED_FUNC(name,code) \ + asm(".text\n\t" \ + ".p2align 2\n\t" \ + ".globl " __MINGW64_STRINGIFY(__MINGW_USYMBOL(name)) "\n\t" \ + ".def " __MINGW64_STRINGIFY(__MINGW_USYMBOL(name)) "; .scl 2; .type 32; .endef\n\t" \ + __MINGW64_STRINGIFY(__MINGW_USYMBOL(name)) ":\n\t" \ + code "\n\t"); + #ifdef __cplusplus } #endif
diff --git a/mingw-w64-crt/math/arm64/trunc.S b/mingw-w64-crt/math/arm64/trunc.S deleted file mode 100644 index d784bf0..0000000 --- a/mingw-w64-crt/math/arm64/trunc.S +++ /dev/null
@@ -1,16 +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 "trunc.S" - .text - .p2align 2 - .globl __MINGW_USYMBOL(trunc) - .def __MINGW_USYMBOL(trunc); .scl 2; .type 32; .endef - -__MINGW_USYMBOL(trunc): - frintz d0, d0 - ret
diff --git a/mingw-w64-crt/math/arm64/trunc.c b/mingw-w64-crt/math/arm64/trunc.c new file mode 100644 index 0000000..0054b87 --- /dev/null +++ b/mingw-w64-crt/math/arm64/trunc.c
@@ -0,0 +1,12 @@ +/** + * 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 <math.h> +#include <internal.h> + +__ASM_NAKED_FUNC(trunc, + "frintz d0, d0\n\t" + "ret")
diff --git a/mingw-w64-crt/math/arm64/truncf.S b/mingw-w64-crt/math/arm64/truncf.S deleted file mode 100644 index 22b9ff8..0000000 --- a/mingw-w64-crt/math/arm64/truncf.S +++ /dev/null
@@ -1,16 +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 "truncf.S" - .text - .p2align 2 - .globl __MINGW_USYMBOL(truncf) - .def __MINGW_USYMBOL(truncf); .scl 2; .type 32; .endef - -__MINGW_USYMBOL(truncf): - frintz s0, s0 - ret
diff --git a/mingw-w64-crt/math/arm64/truncf.c b/mingw-w64-crt/math/arm64/truncf.c new file mode 100644 index 0000000..f322150 --- /dev/null +++ b/mingw-w64-crt/math/arm64/truncf.c
@@ -0,0 +1,12 @@ +/** + * 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 <math.h> +#include <internal.h> + +__ASM_NAKED_FUNC(truncf, + "frintz s0, s0\n\t" + "ret")