summaryrefslogtreecommitdiff
path: root/libm/sh/sh4/s_lroundf.S
diff options
context:
space:
mode:
authorChristian Bruel <christian.bruel@st.com>2010-12-17 09:58:25 +0100
committerCarmelo Amoroso <carmelo.amoroso@st.com>2010-12-17 10:02:44 +0100
commit6ac247452e646c2187f2f559143c8c087b0542e0 (patch)
treee514d6f6aead35f8b6f3a2385443b822c260378b /libm/sh/sh4/s_lroundf.S
parentc61707353e16b8e22cab1a150cc3a6bf9b178e1c (diff)
libm_sh: add optimised assembly implementation of lroundf and lrintf
* libc/sysdeps/linux/sh/sysdep.h: Add LOCAL macro * libm/sh/sh4/Makefile.arch: Include asm source in the build * libm/sh/sh4/s_lrintf.S [NEW]: optimised asm lrintf * libm/sh/sh4/s_lroundf.S [NEW]: optimised asm lroundf Signed-off-by: Christian Bruel <christian.bruel@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libm/sh/sh4/s_lroundf.S')
-rw-r--r--libm/sh/sh4/s_lroundf.S39
1 files changed, 39 insertions, 0 deletions
diff --git a/libm/sh/sh4/s_lroundf.S b/libm/sh/sh4/s_lroundf.S
new file mode 100644
index 000000000..fda3a4b91
--- /dev/null
+++ b/libm/sh/sh4/s_lroundf.S
@@ -0,0 +1,39 @@
+/* Round argument toward 0. SH4 version.
+ * According to ISO/IEC 9899:1999. This version doesn't handle range error.
+ * If arg is not finite or if the result cannot be represented into a long,
+ * return an unspecified value. No exception raised.
+ *
+ * Copyright (C) 2010 STMicroelectronics Ltd.
+ *
+ * Author: Christian Bruel <christian.bruel@st.com>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sysdep.h>
+
+ENTRY(lroundf)
+ mov #0,r0
+ sts fpscr,r3
+ lds r0,fpscr
+ flds fr5,fpul
+ mov.l LOCAL(mask),r1
+ sts fpul,r2
+ and r2,r1
+ mov.l LOCAL(midway),r2
+ or r1,r2
+ lds r2,fpul
+ fsts fpul,fr2
+ fadd fr2,fr5
+ ftrc fr5,fpul
+ sts fpul,r0
+ rts
+ lds r3,fpscr
+
+ .align 2
+LOCAL(mask):
+ .long 0x80000000
+LOCAL(midway):
+ .long 1056964608
+
+END(lroundf)