spu.c (spu_init_libfuncs): Install __clrsbdi2.
authorUlrich Weigand <uweigand@de.ibm.com>
Wed, 13 Jul 2011 19:19:35 +0000 (19:19 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Wed, 13 Jul 2011 19:19:35 +0000 (19:19 +0000)
* config/spu/spu.c (spu_init_libfuncs): Install __clrsbdi2.
* config/spu/spu.md ("clrsb<mode>2"): New expander.

From-SVN: r176249

gcc/ChangeLog
gcc/config/spu/spu.c
gcc/config/spu/spu.md

index 67e7cc9bf0aa4ab96a827a06e895828b15569360..46df27b65027d12abb8cae29500d60ffa49eeb6a 100644 (file)
@@ -1,3 +1,8 @@
+2011-07-13  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
+
+       * config/spu/spu.c (spu_init_libfuncs): Install __clrsbdi2.
+       * config/spu/spu.md ("clrsb<mode>2"): New expander.
+
 2011-07-13  Thomas Schwinge  <thomas@schwinge.name>
 
        * acinclude.m4 (gcc_GAS_CHECK_FEATURE): Use AS_ECHO instead of echo.
index 6d168faff359d29d5608f925ed15d938dcc32220..7d9be5e32369f7d9ce92643ae841581b24b98a02 100644 (file)
@@ -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");
 
index 79d0757ed174ddab3579d19528b5b90482664092..426437ac873a23125e46b160a357b70913553992 100644 (file)
      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" "")))