In preparation for using naked functions.
---
 mingw-w64-crt/Makefile.am                     |  4 ++--
 mingw-w64-crt/include/internal.h              |  8 ++++++++
 mingw-w64-crt/math/arm64/{trunc.S => trunc.c} | 14 +++++---------
 mingw-w64-crt/math/arm64/truncf.S             | 16 ----------------
 mingw-w64-crt/math/arm64/truncf.c             | 12 ++++++++++++
 5 files changed, 27 insertions(+), 27 deletions(-)
 rename mingw-w64-crt/math/arm64/{trunc.S => trunc.c} (50%)
 delete mode 100644 mingw-w64-crt/math/arm64/truncf.S
 create mode 100644 mingw-w64-crt/math/arm64/truncf.c

diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index ba6c6b7d5..745016079 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -705,8 +705,8 @@ src_msvcrtarm64=\
   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 84d52c991..b30ae0e5f 100644
--- a/mingw-w64-crt/include/internal.h
+++ b/mingw-w64-crt/include/internal.h
@@ -287,6 +287,14 @@ static inline unsigned int __mingw_statusfp(void)
     return flags;
 }
 
+#define __ASM_FUNC_CODE(name,code)  \
+    asm(".text\n\t" \
+        ".p2align 2\n\t" \
+        ".globl " __MINGW64_STRINGIFY(__MINGW_USYMBOL(trunc)) "\n\t"    \
+        ".def " __MINGW64_STRINGIFY(__MINGW_USYMBOL(trunc)) "; .scl 2; .type 
32; .endef\n\t" \
+        __MINGW64_STRINGIFY(__MINGW_USYMBOL(trunc)) ":\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.c
similarity index 50%
rename from mingw-w64-crt/math/arm64/trunc.S
rename to mingw-w64-crt/math/arm64/trunc.c
index d784bf016..672f3aa05 100644
--- a/mingw-w64-crt/math/arm64/trunc.S
+++ b/mingw-w64-crt/math/arm64/trunc.c
@@ -3,14 +3,10 @@
  * 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
+#include <math.h>
+#include <internal.h>
 
-__MINGW_USYMBOL(trunc):
-       frintz  d0, d0
-       ret
+__ASM_FUNC_CODE(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 22b9ff88c..000000000
--- 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 000000000..cdffb95f5
--- /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_FUNC_CODE(truncf,
+                "frintz s0, s0\n\t"
+                "ret")
-- 
2.48.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to