summaryrefslogtreecommitdiff
path: root/gcc/longlong.h
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-29 07:52:26 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-29 07:52:26 +0000
commitbbf31a61339462f34dd27e21634be31def7d9878 (patch)
treef08d81eea8a5d69bcef8e82015e7cf308d5b8a7e /gcc/longlong.h
parent630307c88c8750470a712aad7c0f3ac7460f577f (diff)
downloadgcc-bbf31a61339462f34dd27e21634be31def7d9878.tar.gz
* longlong.h [__alpha] (count_leading_zeros): New.
(count_trailing_zeros): New. (COUNT_LEADING_ZEROS_0): New. * config/alpha/alpha.c (alpha_zero_comparison_operator): New. (alpha_split_conditional_move): New. * config/alpha/alpha-protos.h: Prototype them. * config/alpha/alpha.h (PREDICATE_CODES): Update. (CPP_CPU_DEFAULT_SPEC): Fix typo for EV67. * config/alpha/alpha.md: Update ffs cix commentary. (*ze_and_ne): New. (*nabssf2, *nabsdf2): New. (*mov[qhsd]icc_internal): Use add_operand. (if_then_else constant splitters): New. (*cmp_sadd_di, *cmp_sadd_si, *cmp_sadd_sidi): New. (*cmp_ssub_di, *cmp_ssub_si, *cmp_ssub_sidi): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34250 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/longlong.h')
-rw-r--r--gcc/longlong.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/longlong.h b/gcc/longlong.h
index aa9aea585e4..1c1456974cb 100644
--- a/gcc/longlong.h
+++ b/gcc/longlong.h
@@ -169,6 +169,39 @@
extern UDItype __udiv_qrnnd PARAMS ((UDItype *, UDItype, UDItype, UDItype));
#define UDIV_TIME 220
#endif /* LONGLONG_STANDALONE */
+#ifdef __alpha_cix__
+#define count_leading_zeros(COUNT,X) \
+ __asm__("ctlz %1,%0" : "=r"(COUNT) : "r"(X))
+#define count_trailing_zeros(COUNT,X) \
+ __asm__("cttz %1,%0" : "=r"(COUNT) : "r"(X))
+#define COUNT_LEADING_ZEROS_0 64
+#else
+extern const UQItype __clz_tab[];
+#define count_leading_zeros(COUNT,X) \
+ do { \
+ UDItype __xr = (X), __t, __a; \
+ __asm__("cmpbge %1,%2,%0" : "=r"(__t) : "r"(~__xr), "r"(-1)); \
+ __a = __clz_tab[__t ^ 0xff] - 1; \
+ __asm__("extbl %1,%2,%0" : "=r"(__t) : "r"(__xr), "r"(__a)); \
+ (COUNT) = 64 - (__clz_tab[__t] + __a*8); \
+ } while (0)
+#define count_trailing_zeros(COUNT,X) \
+ do { \
+ UDItype __xr = (X), __t, __a; \
+ __asm__("cmpbge %1,%2,%0" : "=r"(__t) : "r"(~__xr), "r"(-1)); \
+ __t = ~__t & -~__t; \
+ __a = ((__t & 0xCC) != 0) * 2; \
+ __a += ((__t & 0xF0) != 0) * 4; \
+ __a += ((__t & 0xAA) != 0); \
+ __asm__("extbl %1,%2,%0" : "=r"(__t) : "r"(__xr), "r"(__a)); \
+ __a <<= 3; \
+ __t &= -__t; \
+ __a += ((__t & 0xCC) != 0) * 2; \
+ __a += ((__t & 0xF0) != 0) * 4; \
+ __a += ((__t & 0xAA) != 0); \
+ (COUNT) = __a; \
+ } while (0)
+#endif /* __alpha_cix__ */
#endif /* __alpha */
#if defined (__arc__) && W_TYPE_SIZE == 32