summaryrefslogtreecommitdiffstats
path: root/libgcc/longlong.h
diff options
context:
space:
mode:
authorhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-16 01:43:14 +0000
committerhp <hp@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-16 01:43:14 +0000
commitb4294f67ad52bdda33acf2c24ee0ff09307359a8 (patch)
treec5d3a341da560ba98e56324e917e4ecf6c089531 /libgcc/longlong.h
parentddf223b839dd75a56dd5b4d4af1f876c6afc214c (diff)
downloadppe42-gcc-b4294f67ad52bdda33acf2c24ee0ff09307359a8.tar.gz
ppe42-gcc-b4294f67ad52bdda33acf2c24ee0ff09307359a8.zip
For CRIS ports, switch to soft-fp. Improve arit.c and longlong.h.
* config.host (cpu_type) <Setting default>: Add entry for crisv32-*-*. (tmake_file) <crisv32-*-elf, cris-*-elf, cris-*-linux*> <crisv32-*-linux*>: Adjust. * longlong.h: Wrap the whole CRIS section in a single defined(__CRIS__) conditional. Add comment about add_ssaaaa and sub_ddmmss. (COUNT_LEADING_ZEROS_0): Define when count_leading_zeros is defined. [__CRIS__] (__umulsidi3): Define. [__CRIS__] (umul_ppmm): Define in terms of __umulsidi3. * config/cris/sfp-machine.h: New file. * config/cris/umulsidi3.S: New file. * config/cris/t-elfmulti (LIB2ADD_ST): Add umulsidi3.S. * config/cris/arit.c (SIGNMULT): New macro. (__Div, __Mod): Use SIGNMULT instead of naked multiplication. * config/cris/mulsi3.S: Tweak to avoid redundant register-copying; saving 3 out of originally 33 cycles from the fastest path, 3 out of 54 from the medium path and one from the longest path. Improve comments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203640 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc/longlong.h')
-rw-r--r--libgcc/longlong.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/libgcc/longlong.h b/libgcc/longlong.h
index 4fbfbaeca41..5f00e548a70 100644
--- a/libgcc/longlong.h
+++ b/libgcc/longlong.h
@@ -289,12 +289,39 @@ extern UDItype __udiv_qrnnd (UDItype *, UDItype, UDItype, UDItype);
#endif /* defined (__AVR__) */
-#if defined (__CRIS__) && __CRIS_arch_version >= 3
+#if defined (__CRIS__)
+
+#if __CRIS_arch_version >= 3
#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
+#define COUNT_LEADING_ZEROS_0 32
+#endif /* __CRIS_arch_version >= 3 */
+
#if __CRIS_arch_version >= 8
#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X))
-#endif
-#endif /* __CRIS__ */
+#endif /* __CRIS_arch_version >= 8 */
+
+#if __CRIS_arch_version >= 10
+#define __umulsidi3(u,v) ((UDItype)(USItype) (u) * (UDItype)(USItype) (v))
+#else
+#define __umulsidi3 __umulsidi3
+extern UDItype __umulsidi3 (USItype, USItype);
+#endif /* __CRIS_arch_version >= 10 */
+
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UDItype __x = __umulsidi3 (u, v); \
+ (w0) = (USItype) (__x); \
+ (w1) = (USItype) (__x >> 32); \
+ } while (0)
+
+/* FIXME: defining add_ssaaaa and sub_ddmmss should be advantageous for
+ DFmode ("double" intrinsics, avoiding two of the three insns handling
+ carry), but defining them as open-code C composing and doing the
+ operation in DImode (UDImode) shows that the DImode needs work:
+ register pressure from requiring neighboring registers and the
+ traffic to and from them come to dominate, in the 4.7 series. */
+
+#endif /* defined (__CRIS__) */
#if defined (__hppa) && W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
OpenPOWER on IntegriCloud