diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-03-06 17:18:46 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-03-06 17:18:46 +0000 |
commit | 31c66114cfd895f05efe8c1a5e344c1ea051b8d9 (patch) | |
tree | ed41f33979c0edc53fadd53f349690eabb055f20 | |
parent | 914db4b784e45909e13d0c229baf49234e4310bb (diff) | |
download | gcc-31c66114cfd895f05efe8c1a5e344c1ea051b8d9.tar.gz |
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.
* gcc.dg/pr56548.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196498 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 34 | ||||
-rw-r--r-- | gcc/expr.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr56548.c | 16 |
4 files changed, 48 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3eaab4c40a5..1f428c5bc18 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. @@ -213,7 +219,7 @@ * 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 @@ -222,11 +228,11 @@ * 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> @@ -598,10 +604,10 @@ 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, @@ -747,10 +753,10 @@ 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. @@ -1053,7 +1059,7 @@ * 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 @@ -1061,9 +1067,9 @@ 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> @@ -1343,7 +1349,7 @@ * 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. @@ -1397,7 +1403,7 @@ 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> diff --git a/gcc/expr.c b/gcc/expr.c index d225479e84e..e3fb0b63bff 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c8853c4d1f4..df583d6a03b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 @@ -147,7 +152,7 @@ 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. @@ -175,7 +180,7 @@ * 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. @@ -495,7 +500,7 @@ * 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> @@ -720,7 +725,7 @@ 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> @@ -843,7 +848,7 @@ * 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 index 00000000000..2aa61d9cc60 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr56548.c @@ -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; +} |