From: Uros Bizjak Date: Fri, 1 Oct 2010 21:34:02 +0000 (+0200) Subject: i386.md (*ashl3_mask): New insn_and_split pattern. X-Git-Tag: upstream/12.2.0~89798 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c44d6c4790222ee50f897e680fdc1b4cc5f45437;p=platform%2Fupstream%2Fgcc.git i386.md (*ashl3_mask): New insn_and_split pattern. * config/i386/i386.md (*ashl3_mask): New insn_and_split pattern. (*3_mask): Ditto. (*3_mask): Ditto. testsuite/ChangeLog: * gcc.target/i386/shift_mask.c: New test. From-SVN: r164895 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f579ba3..b7c2e64 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-10-01 Uros Bizjak + + * config/i386/i386.md (*ashl3_mask): New insn_and_split pattern. + (*3_mask): Ditto. + (*3_mask): Ditto. + 2010-10-01 Steve Ellcey PR tree-optimization/44716 @@ -7,8 +13,7 @@ 2010-10-01 Nick Clifton * common.opt: Add -fcombine-stack-adjustments. - * opts.c (decode_options): Enable -fcombine-stack-adjustments at - -O1. + * opts.c (decode_options): Enable -fcombine-stack-adjustments at -O1. * combine-stack-adj.c (gate_handle_stack_adjustments): Check flag_combine_stack_adjustments. * doc/invoke.texi: Document the new option. @@ -286,8 +291,9 @@ 2010-09-30 Sebastian Pop - * graphite-clast-to-gimple.c (max_signed_precision_type): Remove the call - to lang_hooks.types.type_for_size. Call build_nonstandard_integer_type. + * graphite-clast-to-gimple.c (max_signed_precision_type): Remove + the call to lang_hooks.types.type_for_size. Call + build_nonstandard_integer_type. 2010-09-30 Riyadh Baghdadi @@ -304,8 +310,8 @@ (print_pdr_access_layout): Updated to support OpenScop format. (print_pdr): Same. (openscop_print_pbb_domain): New. - (print_pbb_body): Added a parameter to allow indicating that pbb_body is - not provided. + (print_pbb_body): Added a parameter to allow indicating that pbb_body + is not provided. (print_pbb): Updated to call the new print_pbb_body. (openscop_print_scop_context): New. (print_scop_header): New. @@ -351,8 +357,7 @@ * Makefile.in (build/gen%$(build_exeext)): Move rule after all special-casing for generators and turn into ... ((genprog:%=build/gen%$(build_exeext))): ... this static pattern - rule, for better error messages in case of toplevel dependency - errors. + rule, for better error messages in case of toplevel dependency errors. (genprog): Add hooks, rename to ... (genprogerr): ... this, and let genprog also contain check, checksum, condmd. @@ -361,7 +366,7 @@ (build/genhooks$(build_exeext)): Remove now-unneeded dependency. 2010-09-30 Jonathan Wakely - Ralf Wildenhues + Ralf Wildenhues * doc/install.texi: Suggest using LD_LIBRARY_PATH to find libs for GMP, MPFR and MPC. @@ -369,8 +374,7 @@ 2010-09-30 Rainer Orth * config/sparc/sparc.opt (mimpure-text): Move ... - * config/sol2.opt: ... here. - Correct description. + * config/sol2.opt: ... here. Correct description. * config.gcc (*-*-solaris2*): Add sol2.opt to extra_options. * doc/invoke.texi (Option Summary, SPARC Options): Move -mimpure-text, -mno-impure-text, -threads, -pthreads, -pthread ... @@ -460,8 +464,7 @@ * opts.c (common_handle_option, lang_handle_option, target_handle_option): Take gcc_options parameter. Assert that it is &global_options. - (read_cmdline_options): Pass &global_options to - read_cmdline_option. + (read_cmdline_options): Pass &global_options to read_cmdline_option. (print_filtered_help): Use option_flag_var. Pass &global_options to option_enabled. (common_handle_option): Use option_flag_var. @@ -494,8 +497,7 @@ * c-parser.c (c_lex_one_token): When finding a CPP_AT_NAME Objective-C token, map RID_CLASS to RID_AT_CLASS and similar. - (c_parser_external_declaration): Use RID_AT_CLASS - instead of RID_CLASS. + (c_parser_external_declaration): Use RID_AT_CLASS instead of RID_CLASS. (c_parser_objc_class_declaration): Same change. (c_parser_objc_try_catch_statement): Use RID_AT_TRY instead of RID_TRY and RID_AT_CATCH instead of RID_CATCH. @@ -531,8 +533,7 @@ 2010-09-29 Bernd Schmidt PR target/40457 - * postreload.c (move2add_use_add2_insn): Use full_costs for - comparison. + * postreload.c (move2add_use_add2_insn): Use full_costs for comparison. (move2add_use_add3_insn): Likewise. (reload_cse_move2add): Likewise. * rtlanal.c (get_full_rtx_cost): New function. @@ -553,8 +554,7 @@ 2010-09-29 Jack Howarth - * varasm.c (assemble_alias): Add error message for - unsupported ifunc. + * varasm.c (assemble_alias): Add error message for unsupported ifunc. 2010-09-29 Mike Stump @@ -589,8 +589,7 @@ 2010-09-29 Joseph Myers * optc-gen.awk: Generate global_options initializer instead of - individual variables. Add x_ prefix to names of structure - members. + individual variables. Add x_ prefix to names of structure members. * opth-gen.awk: Generate gcc_options structure. Add x_ prefix to names of structure members. * doc/tm.texi.in (HARD_FRAME_POINTER_IS_FRAME_POINTER, @@ -599,8 +598,7 @@ * alias.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER * builtins.c: Use HARD_FRAME_POINTER_IS_ARG_POINTER. * c-parser.c (disable_extension_diagnostics, - restore_extension_diagnostics): Update names of cpp_options - members. + restore_extension_diagnostics): Update names of cpp_options members. * combine.c: Use HARD_FRAME_POINTER_IS_FRAME_POINTER * common.opt (fcompare-debug-second): Don't use Var. * config/alpha/alpha.h (target_flags): Remove. @@ -658,8 +656,8 @@ 2010-09-29 Hariharan Sandanagobalane * config/picochip/picochip.c (picochip_output_internal_label): - This function can now be called for debug CFI labels, which can come in - the middle of a vliw instruction. Postpone until end of vliw. + This function can now be called for debug CFI labels, which can come + in the middle of a vliw instruction. Postpone until end of vliw. 2010-09-29 Richard Guenther @@ -771,7 +769,7 @@ (TARGET_UNWIND_INFO): Remove. * config/pa/pa.c (pa_option_override): Use targetm.except_unwind_info. - + 2010-09-28 Iain Sandoe * c-parser.c (c_parser_objc_class_definition): Adjust prototype. @@ -788,13 +786,12 @@ * toplev.h (save_decoded_options, save_decoded_options_count): New global variables. * toplev.c (save_decoded_options, save_decoded_options_count): - export variables. + Export variables. 2010-09-28 Ian Lance Taylor * config/i386/i386.c (ix86_supports_split_stack): Test - HAVE_GAS_CFI_PERSONALITY_DIRECTIVE rather than - dwarf2out_do_cfi_asm. + HAVE_GAS_CFI_PERSONALITY_DIRECTIVE rather than dwarf2out_do_cfi_asm. 2010-09-28 Ian Lance Taylor @@ -987,7 +984,7 @@ Radar 4229905 * c-typeck.c (build_conditional_expr): Call objc_have_common_type when looking for objective-c common pointer types. - + 2005-06-22 Ziemowit Laski Radar 4154928 diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index dfbe1604..87bcd27 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -9151,6 +9151,29 @@ DONE; }) +;; Avoid useless masking of count operand. + +(define_insn_and_split "*ashl3_mask" + [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm") + (ashift:SWI48 + (match_operand:SWI48 1 "nonimmediate_operand" "0") + (subreg:QI + (and:SI + (match_operand:SI 2 "register_operand" "c") + (match_operand:SI 3 "const_int_operand" "n")) 0))) + (clobber (reg:CC FLAGS_REG))] + "ix86_binary_operator_ok (ASHIFT, mode, operands) + && (INTVAL (operands[3]) & (GET_MODE_BITSIZE (mode)-1)) + == GET_MODE_BITSIZE (mode)-1" + "#" + "&& 1" + [(parallel [(set (match_dup 0) + (ashift:SWI48 (match_dup 1) (match_dup 2))) + (clobber (reg:CC FLAGS_REG))])] + "operands[2] = simplify_gen_subreg (QImode, operands[2], SImode, 0);" + [(set_attr "type" "ishift") + (set_attr "mode" "")]) + (define_insn "*ashl3_1" [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r") (ashift:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "0,l") @@ -9690,6 +9713,29 @@ "" "ix86_expand_binary_operator (, mode, operands); DONE;") +;; Avoid useless masking of count operand. + +(define_insn_and_split "*3_mask" + [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm") + (any_shiftrt:SWI48 + (match_operand:SWI48 1 "nonimmediate_operand" "0") + (subreg:QI + (and:SI + (match_operand:SI 2 "register_operand" "c") + (match_operand:SI 3 "const_int_operand" "n")) 0))) + (clobber (reg:CC FLAGS_REG))] + "ix86_binary_operator_ok (, mode, operands) + && (INTVAL (operands[3]) & (GET_MODE_BITSIZE (mode)-1)) + == GET_MODE_BITSIZE (mode)-1" + "#" + "&& 1" + [(parallel [(set (match_dup 0) + (any_shiftrt:SWI48 (match_dup 1) (match_dup 2))) + (clobber (reg:CC FLAGS_REG))])] + "operands[2] = simplify_gen_subreg (QImode, operands[2], SImode, 0);" + [(set_attr "type" "ishift") + (set_attr "mode" "")]) + (define_insn_and_split "*3_doubleword" [(set (match_operand:DWI 0 "register_operand" "=r") (any_shiftrt:DWI (match_operand:DWI 1 "register_operand" "0") @@ -10042,6 +10088,29 @@ "" "ix86_expand_binary_operator (, mode, operands); DONE;") +;; Avoid useless masking of count operand. + +(define_insn_and_split "*3_mask" + [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm") + (any_rotate:SWI48 + (match_operand:SWI48 1 "nonimmediate_operand" "0") + (subreg:QI + (and:SI + (match_operand:SI 2 "register_operand" "c") + (match_operand:SI 3 "const_int_operand" "n")) 0))) + (clobber (reg:CC FLAGS_REG))] + "ix86_binary_operator_ok (, mode, operands) + && (INTVAL (operands[3]) & (GET_MODE_BITSIZE (mode)-1)) + == GET_MODE_BITSIZE (mode)-1" + "#" + "&& 1" + [(parallel [(set (match_dup 0) + (any_rotate:SWI48 (match_dup 1) (match_dup 2))) + (clobber (reg:CC FLAGS_REG))])] + "operands[2] = simplify_gen_subreg (QImode, operands[2], SImode, 0);" + [(set_attr "type" "rotate") + (set_attr "mode" "")]) + ;; Implement rotation using two double-precision ;; shift instructions and a scratch register. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5af0697..1abe409 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-10-01 Uros Bizjak + + * gcc.target/i386/shift_mask.c: New test. + 2010-10-01 Richard Guenther PR tree-optimization/45854 @@ -7,7 +11,7 @@ * gcc.c-torture/execute/cmpsf-1.c: Rename FLOAT_{MIN,MAX} to __FLT_{MIN,MAX}__. - + 2010-09-30 Sebastian Pop PR middle-end/45758 @@ -206,8 +210,8 @@ Merge from 'apple/trunk' branch on FSF servers (test method-20.m from the branch renamed to method-20b.m to avoid clashes). - 2005-08-23 Stuart Hastings - Ziemowit Laski + 2005-08-23 Stuart Hastings + Ziemowit Laski Radar 4209854 * obj-c++.dg/method-23.mm: New. @@ -263,8 +267,7 @@ 2010-09-27 Nicola Pero PR objc/45763 - * objc.dg/encode-1.m: Execute the test with the GNU runtime as - well. + * objc.dg/encode-1.m: Execute the test with the GNU runtime as well. 2010-09-27 Nicola Pero @@ -279,28 +282,25 @@ Changelogs are below. * objc.dg/encode-6.m: Execute the test only with the GNU runtime. - * objc.dg/encode-6-next.m: New file (from encode-6.m in the - branch). - * objc.dg/encode-7-next.m: New file (from encode-7.m in the - branch). + * objc.dg/encode-6-next.m: New file (from encode-6.m in the branch). + * objc.dg/encode-7-next.m: New file (from encode-7.m in the branch). * objc.dg/encode-7-next-64bit.m: New file (from encode-7-64bit.m - in the branch). + in the branch). * objc.dg/proto-qual-1.m: Test the 3.3 ABI on NeXT (from proto-qual-1.m in the branch) and the normal ABI on GNU. * objc.dg/threedotthree-abi-1.m: New file (from the branch). Run the test only with the NeXT runtime. * obj-c++/encode-1.mm: Execute the test only with the GNU runtime. - * obj-c++/encode-1-next.mm: New file (from encode-1.mm in the - branch). + * obj-c++/encode-1-next.mm: New file (from encode-1.mm in the branch). * obj-c++.dg/threedotthree-abi-1.mm: New file (from the branch). Run the test only with the NeXT runtime. - + 2006-03-30 Fariborz Jahanian Radar 4492973 * objc.dg/encode-7-64bit.m: New. * objc.dg/encode-7.m: Skip if -m64. - + 2005-10-19 Fariborz Jahanian Radar 4301047 @@ -319,12 +319,12 @@ Merge from 'apple/trunk' branch on FSF servers. Renamed const-str-12.m to constr-str-12b.m to avoid conflicts. - + 2005-12-15 Fariborz Jahanian Radar 4229905 * obj-c++.dg/warn5.mm: New - + 2005-06-22 Ziemowit Laski Radar 4154928 @@ -363,7 +363,7 @@ 2010-09-24 Steven G. Kargl < kargl@gcc.gnu.org> - * testsuite/gfortran.dg/operator_c1202.f90: New test. + * gfortran.dg/operator_c1202.f90: New test. 2010-09-24 Jan Hubicka @@ -427,7 +427,6 @@ PR fortran/45744 * gfortran.dg/dependency_36.f90: New test. ->>>>>>> .r164755 2010-09-23 Uros Bizjak * gcc.target/i386/pad-1.c: Remove -S from dg-options. @@ -514,7 +513,7 @@ 2010-09-22 Marcus Shawcroft * lib/scanasm.exp(dg-function-on-line): Permit .fnstart to appear in - the regexp pattern between the expected label and location string. + the regexp pattern between the expected label and location string. 2010-09-22 Marcus Shawcroft @@ -901,8 +900,8 @@ 2010-09-10 Jack Howarth PR target/42070 - * gcc/testsuite/lib/profopt.exp: Prune warnings on execname2 compile. - * gcc/testsuite/lib/prune.exp: Prune "can't add line info" warnings. + * lib/profopt.exp: Prune warnings on execname2 compile. + * lib/prune.exp: Prune "can't add line info" warnings. 2010-09-14 Jerry DeLisle @@ -1026,10 +1025,10 @@ * gcc.dg/attr-ifunc-3.c: New. * gcc.dg/attr-ifunc-4.c: New. * gcc.dg/attr-ifunc-5.c: New. - * testsuite/g++.dg/ext/attr-ifunc-1.C: New. - * testsuite/g++.dg/ext/attr-ifunc-2.C: New. - * testsuite/g++.dg/ext/attr-ifunc-3.C: New. - * testsuite/g++.dg/ext/attr-ifunc-4.C: New. + * g++.dg/ext/attr-ifunc-1.C: New. + * g++.dg/ext/attr-ifunc-2.C: New. + * g++.dg/ext/attr-ifunc-3.C: New. + * g++.dg/ext/attr-ifunc-4.C: New. 2010-09-09 Vladimir Makarov @@ -1129,7 +1128,7 @@ PR target/42313 PR target/44651 * gcc.target/i386/builtin-unreachable.c: Don't skip on darwin. - * gcc/testsuite/gcc.dg/stack-usage-1.c: Use default on i386/Darwin. + * gcc.dg/stack-usage-1.c: Use default on i386/Darwin. 2010-09-07 Mikael Morin @@ -1580,13 +1579,13 @@ 2010-08-27 Tobias Burnus PR fortran/33197 - * gcc/testsuite/gfortran.dg/norm2_1.f90: New. - * gcc/testsuite/gfortran.dg/norm2_2.f90: New. - * gcc/testsuite/gfortran.dg/norm2_3.f90: New. - * gcc/testsuite/gfortran.dg/norm2_4.f90: New. - * gcc/testsuite/gfortran.dg/parity_1.f90: New. - * gcc/testsuite/gfortran.dg/parity_2.f90: New. - * gcc/testsuite/gfortran.dg/parity_3.f90: New. + * gfortran.dg/norm2_1.f90: New. + * gfortran.dg/norm2_2.f90: New. + * gfortran.dg/norm2_3.f90: New. + * gfortran.dg/norm2_4.f90: New. + * gfortran.dg/parity_1.f90: New. + * gfortran.dg/parity_2.f90: New. + * gfortran.dg/parity_3.f90: New. 2010-08-27 Janus Weil @@ -2387,7 +2386,7 @@ 2010-07-30 Ulrich Weigand PR c++/45112 - * testsuite/g++.dg/pr45112.C: New test. + * g++.dg/pr45112.C: New test. 2010-07-30 Jakub Jelinek @@ -2881,7 +2880,7 @@ 2010-07-22 Martin Jambor PR tree-optimization/44891 - * testsuite/gcc.c-torture/compile/pr44891.c: New test. + * gcc.c-torture/compile/pr44891.c: New test. 2010-07-22 Richard Guenther @@ -4222,7 +4221,7 @@ 2010-06-28 Martin Jambor - * testsuite/gcc.dg/ipa/ipa-sra-6.c: New test. + * gcc.dg/ipa/ipa-sra-6.c: New test. 2010-06-28 Jan Hubicka @@ -4340,7 +4339,7 @@ 2010-06-25 Jan Hubicka - * testsuite/gcc.dg/tree-ssa/ipa-split-1.c + * gcc.dg/tree-ssa/ipa-split-1.c 2010-06-25 Martin Jambor @@ -4775,11 +4774,11 @@ 2010-06-09 Steven G. Kargl - * testsuite/gfortran.dg/mvbits_9.f90: New test. - * testsuite/gfortran.dg/ibset_1.f90: Ditto. - * testsuite/gfortran.dg/ibits_1.f90: Ditto. - * testsuite/gfortran.dg/btest_1.f90: Ditto. - * testsuite/gfortran.dg/ibclr_1.f90: Ditto. + * gfortran.dg/mvbits_9.f90: New test. + * gfortran.dg/ibset_1.f90: Ditto. + * gfortran.dg/ibits_1.f90: Ditto. + * gfortran.dg/btest_1.f90: Ditto. + * gfortran.dg/ibclr_1.f90: Ditto. 2010-06-09 Jason Merrill diff --git a/gcc/testsuite/gcc.target/i386/shift_mask.c b/gcc/testsuite/gcc.target/i386/shift_mask.c new file mode 100644 index 0000000..29c84bd --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/shift_mask.c @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int test_sal (int a, int c) +{ + return a << (c & 0x1f); +} + +int test_sar (int a, int c) +{ + return a >> (c & 0x1f); +} + +unsigned int test_shr (unsigned int a, int c) +{ + return a >> (c & 0x1f); +} + +unsigned int test_rol (unsigned int a, int c) +{ + int z = c & 0x1f; + return (a << z) | (a >> (32 - z)); +} + +unsigned int test_ror (unsigned int a, int c) +{ + int z = c & 0x1f; + return (a >> z) | (a << (32 - z)); +} + +/* { dg-final { scan-assembler-not "and" } } */