summaryrefslogtreecommitdiff
path: root/gcc/longlong.h
diff options
context:
space:
mode:
authorbwilson <bwilson@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-06 18:50:37 +0000
committerbwilson <bwilson@138bc75d-0d04-0410-961f-82ee72b054a4>2006-11-06 18:50:37 +0000
commit8e8c0c04a82c8f2966db7ce57b17431e4bdbe673 (patch)
tree268c5b13ed6895e2d3676f31c09e3e720f0c0bec /gcc/longlong.h
parentc24099f82007f9c17e03be2191dd2356b35f851d (diff)
downloadgcc-8e8c0c04a82c8f2966db7ce57b17431e4bdbe673.tar.gz
* longlong.h (__xtensa__): Add definitions for umul_ppmm, __umulsidi3,
count_leading_zeros, and count_trailing_zeros. * config/xtensa/xtensa.c (TARGET_INIT_BUILTINS): Define. (TARGET_FOLD_BUILTIN): Define. (TARGET_EXPAND_BUILTIN): Define. (xtensa_init_builtins): New. (xtensa_fold_builtin): New. (xtensa_expand_builtin): New. (xtensa_rtx_costs): Add CTZ and CLZ. Adjust costs for MULT. * config/xtensa/xtensa.h (TARGET_MUL32_HIGH): Define. (CLZ_DEFINED_VALUE_AT_ZERO): Define. (CTZ_DEFINED_VALUE_AT_ZERO): Define. * config/xtensa/xtensa.md (UNSPEC_NSAU): Remove. (any_extend): New code macro. (u, su): New code attributes. (<u>mulsidi3, <u>mulsi3_highpart, clzsi2, ctzsi2): New. (nsau): Remove; replaced by clzsi2. (ffssi2): Use clzsi2. * config/xtensa/t-xtensa (LIB1ASMFUNCS): Add _umulsidi3, _clzsi2, _ctzsi2, and _ffssi2. Rename _nsau to _clz. * config/xtensa/lib1funcs.asm (__mulsi3): Support Mul32 option. (__umulsidi3, __clzsi2, __ctzsi2, __ffssi2): New. (__nsau_data): Guard with ifdef L_clz instead of L_nsau. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@118524 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/longlong.h')
-rw-r--r--gcc/longlong.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/longlong.h b/gcc/longlong.h
index c4131c67b21..1325b31f0c9 100644
--- a/gcc/longlong.h
+++ b/gcc/longlong.h
@@ -1189,6 +1189,23 @@ UDItype __umulsidi3 (USItype, USItype);
} while (0)
#endif /* __vax__ */
+#if defined (__xtensa__) && W_TYPE_SIZE == 32
+/* This code is not Xtensa-configuration-specific, so rely on the compiler
+ to expand builtin functions depending on what configuration features
+ are available. This avoids library calls when the operation can be
+ performed in-line. */
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ DWunion __w; \
+ __w.ll = __builtin_umulsidi3 (u, v); \
+ w1 = __w.s.high; \
+ w0 = __w.s.low; \
+ } while (0)
+#define __umulsidi3(u, v) __builtin_umulsidi3 (u, v)
+#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
+#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X))
+#endif /* __xtensa__ */
+
#if defined (__z8000__) && W_TYPE_SIZE == 16
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("add %H1,%H5\n\tadc %H0,%H3" \