OSDN Git Service

* config/i386/i386.md (*ashl<mode>3_mask): New insn_and_split pattern.
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Oct 2010 21:34:02 +0000 (21:34 +0000)
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 1 Oct 2010 21:34:02 +0000 (21:34 +0000)
(*<shiftrt_insn><mode>3_mask): Ditto.
(*<rotate_insn><mode>3_mask): Ditto.

testsuite/ChangeLog:

* gcc.target/i386/shift_mask.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164895 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/shift_mask.c [new file with mode: 0644]

index f579ba3..b7c2e64 100644 (file)
@@ -1,3 +1,9 @@
+2010-10-01  Uros Bizjak  <ubizjak@gmail.com>
+
+       * config/i386/i386.md (*ashl<mode>3_mask): New insn_and_split pattern.
+       (*<shiftrt_insn><mode>3_mask): Ditto.
+       (*<rotate_insn><mode>3_mask): Ditto.
+
 2010-10-01  Steve Ellcey  <sje@cup.hp.com>
 
        PR tree-optimization/44716
@@ -7,8 +13,7 @@
 2010-10-01  Nick Clifton  <nickc@redhat.com>
 
        * 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.
 
 2010-09-30  Sebastian Pop  <sebastian.pop@amd.com>
 
-       * 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 <baghdadi.mr@gmail.com>
 
        (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.
        * 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.
        (build/genhooks$(build_exeext)): Remove now-unneeded dependency.
 
 2010-09-30  Jonathan Wakely  <jwakely.gcc@gmail.com>
-            Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * doc/install.texi: Suggest using LD_LIBRARY_PATH to find libs
        for GMP, MPFR and MPC.
 2010-09-30  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * 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 ...
        * 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.
 
        * 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.
 2010-09-29  Bernd Schmidt  <bernds@codesourcery.com>
 
        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.
 
 2010-09-29  Jack Howarth <howarth@bromo.med.uc.edu>
 
-       * 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  <mikestump@comcast.net>
 
 2010-09-29  Joseph Myers  <joseph@codesourcery.com>
 
        * 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,
        * 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.
 2010-09-29  Hariharan Sandanagobalane <hariharan@picochip.com>
 
        * 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  <rguenther@suse.de>
 
        (TARGET_UNWIND_INFO): Remove.
 
        * config/pa/pa.c (pa_option_override): Use targetm.except_unwind_info.
-       
+
 2010-09-28  Iain Sandoe  <iains@gcc.gnu.org>
 
        * c-parser.c (c_parser_objc_class_definition): Adjust prototype.
        * 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  <iant@google.com>
 
        * 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  <iant@google.com>
 
        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  <zlaski@apple.com>
 
        Radar 4154928
index dfbe160..87bcd27 100644 (file)
   DONE;
 })
 
+;; Avoid useless masking of count operand.
+
+(define_insn_and_split "*ashl<mode>3_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>mode, operands)
+   && (INTVAL (operands[3]) & (GET_MODE_BITSIZE (<MODE>mode)-1))
+      == GET_MODE_BITSIZE (<MODE>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" "<MODE>")])
+
 (define_insn "*ashl<mode>3_1"
   [(set (match_operand:SWI48 0 "nonimmediate_operand" "=rm,r")
        (ashift:SWI48 (match_operand:SWI48 1 "nonimmediate_operand" "0,l")
   ""
   "ix86_expand_binary_operator (<CODE>, <MODE>mode, operands); DONE;")
 
+;; Avoid useless masking of count operand.
+
+(define_insn_and_split "*<shiftrt_insn><mode>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 (<CODE>, <MODE>mode, operands)
+   && (INTVAL (operands[3]) & (GET_MODE_BITSIZE (<MODE>mode)-1))
+      == GET_MODE_BITSIZE (<MODE>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" "<MODE>")])
+
 (define_insn_and_split "*<shiftrt_insn><mode>3_doubleword"
   [(set (match_operand:DWI 0 "register_operand" "=r")
        (any_shiftrt:DWI (match_operand:DWI 1 "register_operand" "0")
   ""
   "ix86_expand_binary_operator (<CODE>, <MODE>mode, operands); DONE;")
 
+;; Avoid useless masking of count operand.
+
+(define_insn_and_split "*<rotate_insn><mode>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 (<CODE>, <MODE>mode, operands)
+   && (INTVAL (operands[3]) & (GET_MODE_BITSIZE (<MODE>mode)-1))
+      == GET_MODE_BITSIZE (<MODE>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" "<MODE>")])
+
 ;; Implement rotation using two double-precision
 ;; shift instructions and a scratch register.
 
index 5af0697..1abe409 100644 (file)
@@ -1,3 +1,7 @@
+2010-10-01  Uros Bizjak  <ubizjak@gmail.com>
+
+       * gcc.target/i386/shift_mask.c: New test.
+
 2010-10-01  Richard Guenther  <rguenther@suse.de>
 
        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  <sebastian.pop@amd.com>
 
        PR middle-end/45758
        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 <stuart@apple.com>
-                   Ziemowit Laski  <zlaski@apple.com>
+       2005-08-23  Stuart Hastings  <stuart@apple.com>
+                   Ziemowit Laski  <zlaski@apple.com>
 
        Radar 4209854
        * obj-c++.dg/method-23.mm: New.
 2010-09-27  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        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  <nicola.pero@meta-innovation.com>
 
        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 <fjahanian@apple.com>
 
        Radar 4492973
        * objc.dg/encode-7-64bit.m: New.
        * objc.dg/encode-7.m: Skip if -m64.
-       
+
        2005-10-19  Fariborz Jahanian <fjahanian@apple.com>
 
        Radar 4301047
 
        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 <fjahanian@apple.com>
 
        Radar 4229905
        * obj-c++.dg/warn5.mm: New
-       
+
        2005-06-22  Ziemowit Laski  <zlaski@apple.com>
 
        Radar 4154928
 
 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  <jh@suse.cz>
 
        PR fortran/45744
        * gfortran.dg/dependency_36.f90:  New test.
 
->>>>>>> .r164755
 2010-09-23  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/pad-1.c: Remove -S from dg-options.
 2010-09-22  Marcus Shawcroft  <marcus.shawcroft@arm.com>
 
        * 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  <marcus.shawcroft@arm.com>
 
 2010-09-10  Jack Howarth <howarth@bromo.med.uc.edu>
 
        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  <jvdelisle@gcc.gnu.org>
 
        * 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  <vmakarov@redhat.com>
 
        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  <mikael@gcc.gnu.org>
 
 2010-08-27  Tobias Burnus  <burnus@net-b.de>
 
        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  <janus@gcc.gnu.org>
 
 2010-07-30  Ulrich Weigand  <Ulrich.Weigand@de.ibm.com>
 
        PR c++/45112
-       * testsuite/g++.dg/pr45112.C: New test.
+       * g++.dg/pr45112.C: New test.
 
 2010-07-30  Jakub Jelinek  <jakub@redhat.com>
 
 2010-07-22  Martin Jambor  <mjambor@suse.cz>
 
        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  <rguenther@suse.de>
 
 
 2010-06-28  Martin Jambor  <mjambor@suse.cz>
 
-       * testsuite/gcc.dg/ipa/ipa-sra-6.c: New test.
+       * gcc.dg/ipa/ipa-sra-6.c: New test.
 
 2010-06-28  Jan Hubicka  <jh@suse.cz>
 
 
 2010-06-25  Jan Hubicka  <jh@suse.cz>
 
-       * testsuite/gcc.dg/tree-ssa/ipa-split-1.c
+       * gcc.dg/tree-ssa/ipa-split-1.c
 
 2010-06-25  Martin Jambor  <mjambor@suse.cz>
 
 
 2010-06-09  Steven G. Kargl  <kargl@gcc.gnu.org>
 
-       * 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  <jason@redhat.com>
 
diff --git a/gcc/testsuite/gcc.target/i386/shift_mask.c b/gcc/testsuite/gcc.target/i386/shift_mask.c
new file mode 100644 (file)
index 0000000..29c84bd
--- /dev/null
@@ -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" } } */