Commit a72d8780 by Jakub Jelinek

re PR middle-end/56548 (ICE in emit_move_insn, at expr.c:3486 with -march=pentium{pro,2,3} -O3)

	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.

From-SVN: r196498
parent 28937f11
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> 2013-03-06 Richard Biener <rguenther@suse.de>
PR middle-end/56294 PR middle-end/56294
......
...@@ -7884,6 +7884,7 @@ expand_cond_expr_using_cmove (tree treeop0 ATTRIBUTE_UNUSED, ...@@ -7884,6 +7884,7 @@ expand_cond_expr_using_cmove (tree treeop0 ATTRIBUTE_UNUSED,
tree type = TREE_TYPE (treeop1); tree type = TREE_TYPE (treeop1);
int unsignedp = TYPE_UNSIGNED (type); int unsignedp = TYPE_UNSIGNED (type);
enum machine_mode mode = TYPE_MODE (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 /* If we cannot do a conditional move on the mode, try doing it
with the promoted mode. */ with the promoted mode. */
...@@ -7949,7 +7950,7 @@ expand_cond_expr_using_cmove (tree treeop0 ATTRIBUTE_UNUSED, ...@@ -7949,7 +7950,7 @@ expand_cond_expr_using_cmove (tree treeop0 ATTRIBUTE_UNUSED,
rtx seq = get_insns (); rtx seq = get_insns ();
end_sequence (); end_sequence ();
emit_insn (seq); emit_insn (seq);
return temp; return convert_modes (orig_mode, mode, temp, 0);
} }
/* Otherwise discard the sequence and fall back to code with /* Otherwise discard the sequence and fall back to code with
......
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> 2013-03-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR debug/53363 PR debug/53363
......
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment