Defined to describe availability and behavior of CLZ.
* config/cris/cris.md (clzsi2): Implement using lz instruction.
* config/cris/cris.opt: Tweak comment for "-metrax4".
* config/cris/arit.c (LZ): When defined, define as __builtin_clz.
* longlong.h [__CRIS__ && __CRIS_arch_version >= 3]
(count_leading_zeros): Define.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128034
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-09-03 Jesper Nilsson <jesper.nilsson@axis.com>
+ Hans-Peter Nilsson <hp@axis.com>
+
+ * config/cris/cris.h (TARGET_HAS_LZ, CLZ_DEFINED_VALUE_AT_ZERO):
+ Defined to describe availability and behavior of CLZ.
+ * config/cris/cris.md (clzsi2): Implement using lz instruction.
+ * config/cris/cris.opt: Tweak comment for "-metrax4".
+ * config/cris/arit.c (LZ): When defined, define as __builtin_clz.
+ * longlong.h [__CRIS__ && __CRIS_arch_version >= 3]
+ (count_leading_zeros): Define.
+
2007-09-01 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* ggc-page.c (ggc_pch_read): Call validate_free_objects.
#include "config.h"
#if defined (__CRIS_arch_version) && __CRIS_arch_version >= 3
-#define LZ(v) __extension__ \
- ({ int tmp_; __asm__ ("lz %1,%0" : "=r" (tmp_) : "r" (v)); tmp_; })
+#define LZ(v) __builtin_clz (v)
#endif
#define CRIS_DEFAULT_CPU_VERSION CRIS_CPU_BASE
#define TARGET_HAS_MUL_INSNS (cris_cpu_version >= CRIS_CPU_NG)
+#define TARGET_HAS_LZ (cris_cpu_version >= CRIS_CPU_ETRAX4)
#define CRIS_SUBTARGET_HANDLE_OPTION(x, y, z)
#define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1
+#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) ((VALUE) = 32, 1)
+
#define Pmode SImode
#define FUNCTION_MODE QImode
(subreg:BW (match_dup 3) 0))]
""
"operands[2] = gen_reg_rtx (SImode); operands[3] = gen_reg_rtx (SImode);")
-\f
+
+(define_insn "clzsi2"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (clz:SI (match_operand:SI 1 "register_operand" "r")))]
+ "TARGET_HAS_LZ"
+ "lz %1,%0"
+ [(set_attr "slottable" "yes")])
+
;; Bound-insn. Defined to be the same as an unsigned minimum, which is an
;; operation supported by gcc. Used in casesi, but used now and then in
;; normal code too.
Work around bug in multiplication instruction
; TARGET_ETRAX4_ADD: Instruction-set additions from Etrax 4 and up.
-; (Just "lz", which we don't really generate from GCC -- yet).
+; (Just "lz".)
metrax4
Target Report Mask(ETRAX4_ADD)
Compile for ETRAX 4 (CRIS v3)
#define UDIV_TIME 100
#endif /* __arm__ */
+#if defined (__CRIS__) && __CRIS_arch_version >= 3
+#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
+#endif /* __CRIS__ */
+
#if defined (__hppa) && W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("add %4,%5,%1\n\taddc %2,%3,%0" \