aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/spu
diff options
context:
space:
mode:
authorUlrich Weigand <Ulrich.Weigand@de.ibm.com>2011-07-13 19:19:35 +0000
committerUlrich Weigand <Ulrich.Weigand@de.ibm.com>2011-07-13 19:19:35 +0000
commitc7ca9bbddbba236a5f06f900d730302e6f96229c (patch)
tree0721be8077e2a408794af4290c038b455ca94b7b /gcc/config/spu
parent025ef3b635230dc5f73e6abc4e0ea310dc161742 (diff)
* config/spu/spu.c (spu_init_libfuncs): Install __clrsbdi2.
* config/spu/spu.md ("clrsb<mode>2"): New expander. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@176249 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/spu')
-rw-r--r--gcc/config/spu/spu.c1
-rw-r--r--gcc/config/spu/spu.md15
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 6d168faff35..7d9be5e3236 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -5630,6 +5630,7 @@ spu_init_libfuncs (void)
set_optab_libfunc (ffs_optab, DImode, "__ffsdi2");
set_optab_libfunc (clz_optab, DImode, "__clzdi2");
set_optab_libfunc (ctz_optab, DImode, "__ctzdi2");
+ set_optab_libfunc (clrsb_optab, DImode, "__clrsbdi2");
set_optab_libfunc (popcount_optab, DImode, "__popcountdi2");
set_optab_libfunc (parity_optab, DImode, "__paritydi2");
diff --git a/gcc/config/spu/spu.md b/gcc/config/spu/spu.md
index 79d0757ed17..426437ac873 100644
--- a/gcc/config/spu/spu.md
+++ b/gcc/config/spu/spu.md
@@ -2232,6 +2232,21 @@
operands[5] = spu_const(<MODE>mode, 31);
})
+(define_expand "clrsb<mode>2"
+ [(set (match_dup 2)
+ (gt:VSI (match_operand:VSI 1 "spu_reg_operand" "") (match_dup 5)))
+ (set (match_dup 3) (not:VSI (xor:VSI (match_dup 1) (match_dup 2))))
+ (set (match_dup 4) (clz:VSI (match_dup 3)))
+ (set (match_operand:VSI 0 "spu_reg_operand")
+ (plus:VSI (match_dup 4) (match_dup 5)))]
+ ""
+ {
+ operands[2] = gen_reg_rtx (<MODE>mode);
+ operands[3] = gen_reg_rtx (<MODE>mode);
+ operands[4] = gen_reg_rtx (<MODE>mode);
+ operands[5] = spu_const(<MODE>mode, -1);
+ })
+
(define_expand "ffs<mode>2"
[(set (match_dup 2)
(neg:VSI (match_operand:VSI 1 "spu_reg_operand" "")))