From 4d3aeb29071fb6873c7067042baf2523a49e8bf7 Mon Sep 17 00:00:00 2001 From: uweigand Date: Wed, 13 Jul 2011 19:19:35 +0000 Subject: [PATCH] * config/spu/spu.c (spu_init_libfuncs): Install __clrsbdi2. * config/spu/spu.md ("clrsb2"): New expander. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176249 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/spu/spu.c | 1 + gcc/config/spu/spu.md | 15 +++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 67e7cc9bf0a..46df27b6502 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-07-13 Ulrich Weigand + + * config/spu/spu.c (spu_init_libfuncs): Install __clrsbdi2. + * config/spu/spu.md ("clrsb2"): New expander. + 2011-07-13 Thomas Schwinge * acinclude.m4 (gcc_GAS_CHECK_FEATURE): Use AS_ECHO instead of echo. 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, 31); }) +(define_expand "clrsb2" + [(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); + operands[3] = gen_reg_rtx (mode); + operands[4] = gen_reg_rtx (mode); + operands[5] = spu_const(mode, -1); + }) + (define_expand "ffs2" [(set (match_dup 2) (neg:VSI (match_operand:VSI 1 "spu_reg_operand" ""))) -- 2.11.4.GIT