OSDN Git Service

PR middle-end/56548
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Mar 2013 17:18:46 +0000 (17:18 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Mar 2013 17:18:46 +0000 (17:18 +0000)
* expr.c (expand_cond_expr_using_cmove): When expanding cmove in
promoted mode, convert the result back to the original mode.

* gcc.dg/pr56548.c: New test.

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

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr56548.c [new file with mode: 0644]

index 3eaab4c..1f428c5 100644 (file)
@@ -1,3 +1,9 @@
+2013-03-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/56548
+       * expr.c (expand_cond_expr_using_cmove): When expanding cmove in
+       promoted mode, convert the result back to the original mode.
+
 2013-03-06  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/56294
@@ -84,7 +90,7 @@
        * sdbout.c (sdbout_one_type): Switch to current function's section
        supporting cold/hot.
 
-2013-03-05  David Holsgrove <david.holsgrove@xilinx.com>
+2013-03-05  David Holsgrove  <david.holsgrove@xilinx.com>
 
        * doc/invoke.texi (MicroBlaze): Add -mbig-endian, -mlittle-endian,
        -mxl-reorder.
        * ipa-split.c (split_function): Do not set the RSO flag if result is
        not by reference and its type is a register type.
 
-2013-03-04  David Holsgrove <david.holsgrove@xilinx.com>
+2013-03-04  David Holsgrove  <david.holsgrove@xilinx.com>
 
        * config/microblaze/microblaze.c (microblaze_valid_pic_const): New 
        (microblaze_legitimate_pic_operand): Likewise
        * config/microblaze/microblaze-protos.h
        (microblaze_legitimate_pic_operand): Declare.
 
-2013-03-04  Edgar E. Iglesias <edgar.iglesias@gmail.com>
+2013-03-04  Edgar E. Iglesias  <edgar.iglesias@gmail.com>
 
-       *  config/microblaze/predicates.md (call_insn_simple_operand):
+       * config/microblaze/predicates.md (call_insn_simple_operand):
        New predicate for supported rtx code types.
-       *  config/microblaze/microblaze.md (call_internal1): Use
+       * config/microblaze/microblaze.md (call_internal1): Use
        call_insn_simple_operand predicate.
 
 2013-03-04  Jakub Jelinek  <jakub@redhat.com>
        2013-02-24  Catherine Moore  <clm@codesourcery.com>
            Maciej W. Rozycki  <macro@codesourcery.com>
            Tom de Vries  <tom@codesourcery.com>
-           Nathan Sidwell <nathan@codesourcery.com>
+           Nathan Sidwell  <nathan@codesourcery.com>
            Iain Sandoe  <iain@codesourcery.com>
            Nathan Froyd  <froydnj@codesourcery.com>
-           Chao-ying Fu <fu@mips.com>
+           Chao-ying Fu  <fu@mips.com>
        * doc/extend.texi: (micromips, nomicromips, nocompression):
        Document new function attributes. 
        * doc/invoke.texi (minterlink-compressed, mmicromips,
 2013-02-24  Catherine Moore  <clm@codesourcery.com>
            Maciej W. Rozycki  <macro@codesourcery.com>
            Tom de Vries  <tom@codesourcery.com>
-           Nathan Sidwell <nathan@codesourcery.com>
+           Nathan Sidwell  <nathan@codesourcery.com>
            Iain Sandoe  <iain@codesourcery.com>
            Nathan Froyd  <froydnj@codesourcery.com>
-           Chao-ying Fu <fu@mips.com>
+           Chao-ying Fu  <fu@mips.com>
 
        * doc/extend.texi: (micromips, nomicromips, nocompression):
        Document new function attributes. 
        * config/i386/i386.c (initial_ix86_tune_features): Turn on fp
        reassociation for avx2 targets.
 
-2012-02-19  Edgar E. Iglesias <edgar.iglesias@gmail.com>
+2012-02-19  Edgar E. Iglesias  <edgar.iglesias@gmail.com>
 
        * config/microblaze/microblaze.c: microblaze_has_clz = 0
        Add version check for v8.10.a to enable microblaze_has_clz
        version and TARGET_PATTERN_COMPARE check
        * config/microblaze/microblaze.md: New clzsi2 instruction
 
-2012-02-19  Edgar E. Iglesias <edgar.iglesias@gmail.com>
+2012-02-19  Edgar E. Iglesias  <edgar.iglesias@gmail.com>
 
-       *  config/microblaze/microblaze.md (call_value_intern): Check symbol is 
+       * config/microblaze/microblaze.md (call_value_intern): Check symbol is
        function before branching.
 
 2012-02-19  Andrey Belevantsev  <abel@ispras.ru>
        * config/avr/avr-dimode.md (umulsidi3, mulsidi3): New expanders.
        (umulsidi3_insn, mulsidi3_insn): New insns.
 
-2013-02-12  Christophe Lyon <christophe.lyon@linaro.org>
+2013-02-12  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * config/arm/arm-protos.h (struct cpu_vec_costs): New struct type.
        (struct tune_params): Add vec_costs field.
        define ENDFILE_SPEC as TM_DESTRUCTOR.
        * config/i386/darwin.h (ENDFILE_SPEC): Use TM_DESTRUCTOR.
 
-2013-02-11  Alexander Potapenko <glider@google.com>
+2013-02-11  Alexander Potapenko  <glider@google.com>
            Jack Howarth  <howarth@bromo.med.uc.edu>
            Jakub Jelinek  <jakub@redhat.com>
 
index d225479..e3fb0b6 100644 (file)
@@ -7884,6 +7884,7 @@ expand_cond_expr_using_cmove (tree treeop0 ATTRIBUTE_UNUSED,
   tree type = TREE_TYPE (treeop1);
   int unsignedp = TYPE_UNSIGNED (type);
   enum machine_mode mode = TYPE_MODE (type);
+  enum machine_mode orig_mode = mode;
 
   /* If we cannot do a conditional move on the mode, try doing it
      with the promoted mode. */
@@ -7949,7 +7950,7 @@ expand_cond_expr_using_cmove (tree treeop0 ATTRIBUTE_UNUSED,
       rtx seq = get_insns ();
       end_sequence ();
       emit_insn (seq);
-      return temp;
+      return convert_modes (orig_mode, mode, temp, 0);
     }
 
   /* Otherwise discard the sequence and fall back to code with
index c8853c4..df583d6 100644 (file)
@@ -1,3 +1,8 @@
+2013-03-06  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/56548
+       * gcc.dg/pr56548.c: New test.
+
 2013-03-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR debug/53363
 
        Revert:
        2013-02-24  Catherine Moore  <clm@codesourcery.com>
-       Richard Sandiford <rdsandiford@googlemail.com>
+       Richard Sandiford  <rdsandiford@googlemail.com>
 
        * gcc.target/mips/mips.exp: Add microMIPS support.
        * gcc.target/mips/umips-movep-2.c: New test.
        * gcc.target/mips/umips-swp-4.c: New test.
 
 2013-02-24  Catherine Moore  <clm@codesourcery.com>
-           Richard Sandiford <rdsandiford@googlemail.com>
+           Richard Sandiford  <rdsandiford@googlemail.com>
 
        * gcc.target/mips/mips.exp: Add microMIPS support.
        * gcc.target/mips/umips-movep-2.c: New test.
        * gcc.target/powerpc/ppc-stackalign-1.c: Likewise.
        * gcc.target/powerpc/ppc-ldstruct.c: Likewise.
 
-2013-02-11  Alexander Potapenko <glider@google.com>
+2013-02-11  Alexander Potapenko  <glider@google.com>
            Jack Howarth  <howarth@bromo.med.uc.edu>
            Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/47517
        * gfortran.dg/realloc_on _assign_17.f90 : New test.
 
-2013-02-04  Alexander Potapenko <glider@google.com>
+2013-02-04  Alexander Potapenko  <glider@google.com>
            Jack Howarth  <howarth@bromo.med.uc.edu>
            Jakub Jelinek  <jakub@redhat.com>
 
        * gfortran.dg/allocatable_function_6.f90: New.
 
 2013-01-29  Janus Weil  <janus@gcc.gnu.org>
-           Mikael Morin <mikael@gcc.gnu.org>
+           Mikael Morin  <mikael@gcc.gnu.org>
 
        PR fortran/54107
        * gfortran.dg/proc_ptr_comp_36.f90: New.
diff --git a/gcc/testsuite/gcc.dg/pr56548.c b/gcc/testsuite/gcc.dg/pr56548.c
new file mode 100644 (file)
index 0000000..2aa61d9
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR middle-end/56548 */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+/* { dg-additional-options "-march=pentium3" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
+
+short
+foo (short x)
+{
+  int i;
+
+  for (i = 0; i < 3; i++)
+    if (x > 0)
+      x--;
+
+  return x;
+}