This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3.4-BIB] ifcvt and RTX sharing
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com
- Date: Thu, 28 Nov 2002 23:47:08 +0100
- Subject: [3.4-BIB] ifcvt and RTX sharing
Hi,
my patch to improve conditional jump generation made even worse the
problem of RTX sharing produced by expanders used by ifcvt so it broke
bootstrap. Since these problems are time consuming to analyze, I will
install the attached patch as obvious, even when I am not sure polutting
compiler with copy_rtx calls is good idea.
Better ideas?
Thu Nov 28 23:38:43 CET 2002 Jan Hubicka <jh@suse.cz>
* i386.c (ix86_expand_int_movcc): Add copy_rtx to avoid invalid RTX
sharing when operand is SUBREG.
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.447.2.34
diff -c -3 -p -r1.447.2.34 i386.c
*** i386.c 27 Nov 2002 19:35:34 -0000 1.447.2.34
--- i386.c 28 Nov 2002 22:38:37 -0000
*************** ix86_expand_int_movcc (operands)
*** 9343,9349 ****
if (ct)
tmp = expand_simple_binop (mode, PLUS,
tmp, GEN_INT (ct),
! tmp, 1, OPTAB_DIRECT);
}
else if (cf == -1)
{
--- 9343,9349 ----
if (ct)
tmp = expand_simple_binop (mode, PLUS,
tmp, GEN_INT (ct),
! copy_rtx (tmp), 1, OPTAB_DIRECT);
}
else if (cf == -1)
{
*************** ix86_expand_int_movcc (operands)
*** 9356,9362 ****
*/
tmp = expand_simple_binop (mode, IOR,
tmp, GEN_INT (ct),
! tmp, 1, OPTAB_DIRECT);
}
else if (diff == -1 && ct)
{
--- 9356,9362 ----
*/
tmp = expand_simple_binop (mode, IOR,
tmp, GEN_INT (ct),
! copy_rtx (tmp), 1, OPTAB_DIRECT);
}
else if (diff == -1 && ct)
{
*************** ix86_expand_int_movcc (operands)
*** 9368,9378 ****
*
* Size 8 - 11.
*/
! tmp = expand_simple_unop (mode, NOT, tmp, tmp, 1);
if (cf)
tmp = expand_simple_binop (mode, PLUS,
! tmp, GEN_INT (cf),
! tmp, 1, OPTAB_DIRECT);
}
else
{
--- 9368,9378 ----
*
* Size 8 - 11.
*/
! tmp = expand_simple_unop (mode, NOT, tmp, copy_rtx (tmp), 1);
if (cf)
tmp = expand_simple_binop (mode, PLUS,
! copy_rtx (tmp), GEN_INT (cf),
! copy_rtx (tmp), 1, OPTAB_DIRECT);
}
else
{
*************** ix86_expand_int_movcc (operands)
*** 9390,9410 ****
{
cf = ct;
ct = 0;
! tmp = expand_simple_unop (mode, NOT, tmp, tmp, 1);
}
tmp = expand_simple_binop (mode, AND,
! tmp,
gen_int_mode (cf - ct, mode),
! tmp, 1, OPTAB_DIRECT);
if (ct)
tmp = expand_simple_binop (mode, PLUS,
! tmp, GEN_INT (ct),
! tmp, 1, OPTAB_DIRECT);
}
! if (tmp != out)
! emit_move_insn (out, tmp);
return 1; /* DONE */
}
--- 9390,9410 ----
{
cf = ct;
ct = 0;
! tmp = expand_simple_unop (mode, NOT, tmp, copy_rtx (tmp), 1);
}
tmp = expand_simple_binop (mode, AND,
! copy_rtx (tmp),
gen_int_mode (cf - ct, mode),
! copy_rtx (tmp), 1, OPTAB_DIRECT);
if (ct)
tmp = expand_simple_binop (mode, PLUS,
! copy_rtx (tmp), GEN_INT (ct),
! copy_rtx (tmp), 1, OPTAB_DIRECT);
}
! if (!rtx_equal_p (tmp, out))
! emit_move_insn (copy_rtx (out), copy_rtx (tmp));
return 1; /* DONE */
}
*************** ix86_expand_int_movcc (operands)
*** 9529,9536 ****
tmp = gen_rtx_PLUS (mode, tmp, GEN_INT (cf));
nops++;
}
! if (tmp != out
! && (GET_CODE (tmp) != SUBREG || SUBREG_REG (tmp) != out))
{
if (nops == 1)
{
--- 9529,9535 ----
tmp = gen_rtx_PLUS (mode, tmp, GEN_INT (cf));
nops++;
}
! if (!rtx_equal_p (tmp, out))
{
if (nops == 1)
{
*************** ix86_expand_int_movcc (operands)
*** 9544,9552 ****
emit_insn (tmp);
}
else
! emit_insn (gen_rtx_SET (VOIDmode, out, tmp));
}
! if (out != operands[0])
emit_move_insn (operands[0], copy_rtx (out));
return 1; /* DONE */
--- 9543,9551 ----
emit_insn (tmp);
}
else
! emit_insn (gen_rtx_SET (VOIDmode, copy_rtx (out), copy_rtx (tmp)));
}
! if (!rtx_equal_p (out, operands[0]))
emit_move_insn (operands[0], copy_rtx (out));
return 1; /* DONE */
*************** ix86_expand_int_movcc (operands)
*** 9623,9640 ****
out = emit_store_flag (out, code, ix86_compare_op0,
ix86_compare_op1, VOIDmode, 0, 1);
! out = expand_simple_binop (mode, PLUS, out, constm1_rtx,
! out, 1, OPTAB_DIRECT);
}
! out = expand_simple_binop (mode, AND, out,
gen_int_mode (cf - ct, mode),
! out, 1, OPTAB_DIRECT);
if (ct)
! out = expand_simple_binop (mode, PLUS, out, GEN_INT (ct),
! out, 1, OPTAB_DIRECT);
! if (out != operands[0])
! emit_move_insn (operands[0], out);
return 1; /* DONE */
}
--- 9622,9639 ----
out = emit_store_flag (out, code, ix86_compare_op0,
ix86_compare_op1, VOIDmode, 0, 1);
! out = expand_simple_binop (mode, PLUS, copy_rtx (out), constm1_rtx,
! copy_rtx (out), 1, OPTAB_DIRECT);
}
! out = expand_simple_binop (mode, AND, copy_rtx (out),
gen_int_mode (cf - ct, mode),
! copy_rtx (out), 1, OPTAB_DIRECT);
if (ct)
! out = expand_simple_binop (mode, PLUS, copy_rtx (out), GEN_INT (ct),
! copy_rtx (out), 1, OPTAB_DIRECT);
! if (!rtx_equal_p (out, operands[0]))
! emit_move_insn (operands[0], copy_rtx (out));
return 1; /* DONE */
}
*************** ix86_expand_int_movcc (operands)
*** 9687,9694 ****
/* Mask in the interesting variable. */
out = expand_binop (mode, op, var, tmp, orig_out, 0,
OPTAB_WIDEN);
! if (out != orig_out)
! emit_move_insn (orig_out, out);
return 1; /* DONE */
}
--- 9686,9693 ----
/* Mask in the interesting variable. */
out = expand_binop (mode, op, var, tmp, orig_out, 0,
OPTAB_WIDEN);
! if (!rtx_equal_p (out, orig_out))
! emit_move_insn (copy_rtx (orig_out), copy_rtx (out));
return 1; /* DONE */
}
*************** ix86_expand_int_movcc (operands)
*** 9731,9747 ****
compare_op, operands[2],
operands[3])));
if (bypass_test)
! emit_insn (gen_rtx_SET (VOIDmode, operands[0],
gen_rtx_IF_THEN_ELSE (mode,
bypass_test,
! operands[3],
! operands[0])));
if (second_test)
! emit_insn (gen_rtx_SET (VOIDmode, operands[0],
gen_rtx_IF_THEN_ELSE (mode,
second_test,
! operands[2],
! operands[0])));
return 1; /* DONE */
}
--- 9730,9746 ----
compare_op, operands[2],
operands[3])));
if (bypass_test)
! emit_insn (gen_rtx_SET (VOIDmode, copy_rtx (operands[0]),
gen_rtx_IF_THEN_ELSE (mode,
bypass_test,
! copy_rtx (operands[3]),
! copy_rtx (operands[0]))));
if (second_test)
! emit_insn (gen_rtx_SET (VOIDmode, copy_rtx (operands[0]),
gen_rtx_IF_THEN_ELSE (mode,
second_test,
! copy_rtx (operands[2]),
! copy_rtx (operands[0]))));
return 1; /* DONE */
}