diff options
author | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-06 00:16:43 +0000 |
---|---|---|
committer | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-06 00:16:43 +0000 |
commit | eab0bba7fa085f8d371466a058532e0341f32864 (patch) | |
tree | b471f48ac8fe10b8d1c9562b6086669ae666de75 /gcc/config/cris/cris.md | |
parent | f9612ead203999c4cb0e461ac31d5b6dbd1cd65a (diff) | |
download | gcc-eab0bba7fa085f8d371466a058532e0341f32864.tar.gz |
* longlong.h [__CRIS_arch_version >= 8] (count_trailing_zeros):
Defined.
* config/cris/cris.md (ctzsi2, cris_swap_bits): Implemented.
* config/cris/cris.h (CTZ_DEFINED_VALUE_AT_ZERO): Defined.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128165 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/cris/cris.md')
-rw-r--r-- | gcc/config/cris/cris.md | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md index 765bd8602c4..e248d4307ed 100644 --- a/gcc/config/cris/cris.md +++ b/gcc/config/cris/cris.md @@ -69,7 +69,8 @@ (CRIS_UNSPEC_GOT 2) (CRIS_UNSPEC_GOTREL 3) (CRIS_UNSPEC_GOTREAD 4) - (CRIS_UNSPEC_PLTGOTREAD 5)]) + (CRIS_UNSPEC_PLTGOTREAD 5) + (CRIS_UNSPEC_SWAP_BITS 6)]) ;; Register numbers. (define_constants @@ -2678,6 +2679,31 @@ "swapwb %0" [(set_attr "slottable" "yes")]) +;; This instruction swaps all bits in a register. +;; That means that the most significant bit is put in the place +;; of the least significant bit, and so on. + +(define_insn "cris_swap_bits" + [(set (match_operand:SI 0 "register_operand" "=r") + (unspec:SI [(match_operand:SI 1 "register_operand" "0")] + CRIS_UNSPEC_SWAP_BITS))] + "TARGET_HAS_SWAP" + "swapwbr %0" + [(set_attr "slottable" "yes")]) + +;; Implement ctz using two instructions, one for bit swap and one for clz. +;; Defines a scratch register to avoid clobbering input. + +(define_expand "ctzsi2" + [(set (match_dup 2) + (match_operand:SI 1 "register_operand")) + (set (match_dup 2) + (unspec:SI [(match_dup 2)] CRIS_UNSPEC_SWAP_BITS)) + (set (match_operand:SI 0 "register_operand") + (clz:SI (match_dup 2)))] + "TARGET_HAS_LZ && TARGET_HAS_SWAP" + "operands[2] = gen_reg_rtx (SImode);") + ;; 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. |