summaryrefslogtreecommitdiff
path: root/gcc/config/bfin/bfin.md
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@codesourcery.com>2011-06-21 14:16:39 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2011-06-21 14:16:39 +0000
commit3801c801f35ca5e0c52b437161141c251aa33daf (patch)
treeee32816cbc97cc6b5823412e083d7944b01b96a7 /gcc/config/bfin/bfin.md
parent95f5c7757f027c4c9afbb97a7a24be0cc9ad7841 (diff)
downloadgcc-3801c801f35ca5e0c52b437161141c251aa33daf.tar.gz
Makefile.in (lib2funcs): Add _clrsbsi2 and _clrsbdi2.
libgcc/ * Makefile.in (lib2funcs): Add _clrsbsi2 and _clrsbdi2. * libgcc-std.ver.in (GCC_4.7.0): New section. gcc/ * doc/extend.texi (__builtin_clrsb, __builtin_clrsbl, __builtin_clrsbll): Document. * doc/rtl.texi (clrsb): New entry. * optabs.c (widen_leading): Renamed from widen_clz. New argument UNOPTAB. All callers changed. Use UNOPTAB instead of clz_optab. (expand_unop): Handle clrsb_optab. (init_optabs): Initialize it. * optabs.h (enum optab_index): New entry OTI_clrsb. (clrsb_optab): Define. * genopinit.c (optabs): Add an entry for it. * builtins.c (expand_builtin): Handle clrsb builtin functions. * builtins.def (BUILT_IN_CLRSB, BUILT_IN_CLRSBIMAX, BUILT_IN_CLRSBL, BUILT_IN_CLRSBLL): New. * rtl.def (CLRSB): New code. * dwarf2out.c (mem_loc_descriptor): Handle it. * simplify-rtx.c (simplify_const_unary_operation): Likewise. Use op_mode rather than mode when optimizing ffs, clz, ctz, parity and popcount. * libgcc2.c (__clrsbSI2, __clrsbDI2): New functions. * libgcc2.h (__clrsbSI2, __clrsbDI2): Define and declare. (__ctzDI2): Move declaration. * config/bfin/bfin.md (clrsbsi2): New expander. (signbitssi2): Use the CLRSB rtx. (clrsbhi2): Renamed from signbitshi2. Use the CLRSB rtx. * config/bfin/bfin.c (bdesc_1arg): Changed accordingly. gcc/testsuite/ * gcc.c-torture/excute/builtin-bitops-1.c (MAKE_FUNS): Make my_clrsb test functions. (main): Test clrsb. * gcc.dg/builtin-protos-1.c (test_s, test_u, test_sl, test_ul, test_sll, test_ull): Add clrsb tests. * gcc.dg/torture/builtin-attr-1.c: Add tests for clrsb, clrsbl, clrsbll. From-SVN: r175261
Diffstat (limited to 'gcc/config/bfin/bfin.md')
-rw-r--r--gcc/config/bfin/bfin.md22
1 files changed, 13 insertions, 9 deletions
diff --git a/gcc/config/bfin/bfin.md b/gcc/config/bfin/bfin.md
index 903c8bb076f..a96d1a7bda6 100644
--- a/gcc/config/bfin/bfin.md
+++ b/gcc/config/bfin/bfin.md
@@ -1461,12 +1461,19 @@
"%0 = ~%1;"
[(set_attr "type" "alu0")])
+(define_expand "clrsbsi2"
+ [(set (match_dup 2)
+ (clrsb:HI (match_operand:SI 1 "register_operand" "d")))
+ (set (match_operand:SI 0 "register_operand")
+ (zero_extend:SI (match_dup 2)))]
+ ""
+{
+ operands[2] = gen_reg_rtx (HImode);
+})
+
(define_insn "signbitssi2"
[(set (match_operand:HI 0 "register_operand" "=d")
- (if_then_else:HI
- (lt (match_operand:SI 1 "register_operand" "d") (const_int 0))
- (clz:HI (not:SI (match_dup 1)))
- (clz:HI (match_dup 1))))]
+ (clrsb:HI (match_operand:SI 1 "register_operand" "d")))]
""
"%h0 = signbits %1%!"
[(set_attr "type" "dsp32")])
@@ -1518,12 +1525,9 @@
"%0 = -%1 (V)%!"
[(set_attr "type" "dsp32")])
-(define_insn "signbitshi2"
+(define_insn "clrsbhi2"
[(set (match_operand:HI 0 "register_operand" "=d")
- (if_then_else:HI
- (lt (match_operand:HI 1 "register_operand" "d") (const_int 0))
- (clz:HI (not:HI (match_dup 1)))
- (clz:HI (match_dup 1))))]
+ (clrsb:HI (match_operand:HI 1 "register_operand" "d")))]
""
"%h0 = signbits %h1%!"
[(set_attr "type" "dsp32")])