aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Stubbs <ams@codesourcery.com>2015-10-27 13:36:47 +0000
committerMike Frysinger <vapier@gentoo.org>2016-01-07 17:27:32 -0500
commit5d29eefd6151e1475aeb4d89041313451c02fa41 (patch)
tree209261232168156af2594a09d1697c23212e4e95
parent7f49b7c0200e745c5f0d3e9245a6e4590bd57b1d (diff)
downloadglibc-5d29eefd6151e1475aeb4d89041313451c02fa41.zip
glibc-5d29eefd6151e1475aeb4d89041313451c02fa41.tar.gz
glibc-5d29eefd6151e1475aeb4d89041313451c02fa41.tar.bz2
longlong: add SH FDPIC support
-rw-r--r--ChangeLog8
-rw-r--r--stdlib/longlong.h28
2 files changed, 36 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ce42df8..bb445a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2016-01-07 Daniel Jacobowitz <dan@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+ Mark Shinwell <shinwell@codesourcery.com>
+ Andrew Stubbs <ams@codesourcery.com>
+ Rich Felker <dalias@libc.org>
+
+ * longlong.h (udiv_qrnnd): Add FDPIC compatible version for SH.
+
2016-01-07 Richard Henderson <rth@redhat.com>
* longlong.h [__alpha] (umul_ppmm): Disable for c++.
diff --git a/stdlib/longlong.h b/stdlib/longlong.h
index 1bc3e65..4c8d131 100644
--- a/stdlib/longlong.h
+++ b/stdlib/longlong.h
@@ -1102,6 +1102,33 @@ extern UDItype __umulsidi3 (USItype, USItype);
/* This is the same algorithm as __udiv_qrnnd_c. */
#define UDIV_NEEDS_NORMALIZATION 1
+#ifdef __FDPIC__
+/* FDPIC needs a special version of the asm fragment to extract the
+ code address from the function descriptor. __udiv_qrnnd_16 is
+ assumed to be local and not to use the GOT, so loading r12 is
+ not needed. */
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { \
+ extern UWtype __udiv_qrnnd_16 (UWtype, UWtype) \
+ __attribute__ ((visibility ("hidden"))); \
+ /* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m */ \
+ __asm__ ( \
+ "mov%M4 %4,r5\n" \
+" swap.w %3,r4\n" \
+" swap.w r5,r6\n" \
+" mov.l @%5,r2\n" \
+" jsr @r2\n" \
+" shll16 r6\n" \
+" swap.w r4,r4\n" \
+" mov.l @%5,r2\n" \
+" jsr @r2\n" \
+" swap.w r1,%0\n" \
+" or r1,%0" \
+ : "=r" (q), "=&z" (r) \
+ : "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \
+ : "r1", "r2", "r4", "r5", "r6", "pr", "t"); \
+ } while (0)
+#else
#define udiv_qrnnd(q, r, n1, n0, d) \
do { \
extern UWtype __udiv_qrnnd_16 (UWtype, UWtype) \
@@ -1121,6 +1148,7 @@ extern UDItype __umulsidi3 (USItype, USItype);
: "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \
: "r1", "r2", "r4", "r5", "r6", "pr", "t"); \
} while (0)
+#endif /* __FDPIC__ */
#define UDIV_TIME 80