Hello, several builtin-bitops-1.c tests have been failing recently on SPU since the new clrsb builtin is not supported.
This patch fixes this by: - installing the libgcc __clrsbdi2 routine into optabs (which doesn't happen automatically on SPU since word_mode is TImode) - providing an in-line expander for SImode clrsb. Tested on spu-elf, committed to mainline. Bye, Ulrich ChangeLog: * config/spu/spu.c (spu_init_libfuncs): Install __clrsbdi2. * config/spu/spu.md ("clrsb<mode>2"): New expander. Index: gcc/config/spu/spu.c =================================================================== *** gcc/config/spu/spu.c (revision 176247) --- gcc/config/spu/spu.c (working copy) *************** spu_init_libfuncs (void) *** 5630,5635 **** --- 5630,5636 ---- 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: gcc/config/spu/spu.md =================================================================== *** gcc/config/spu/spu.md (revision 176209) --- gcc/config/spu/spu.md (working copy) *************** *** 2232,2237 **** --- 2232,2252 ---- 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" ""))) -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE ulrich.weig...@de.ibm.com