This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
alpha bootstrap fix
- To: jh at suse dot cz, gcc-patches at gcc dot gnu dot org
- Subject: alpha bootstrap fix
- From: Richard Henderson <rth at redhat dot com>
- Date: Sun, 20 May 2001 18:32:19 -0700
Thu May 17 23:19:46 CEST 2001 Jan Hubicka <jh@suse.cz>
* combine.c (combine_simplify_rtx): Use swap_commutative_operands_p.
(gen_binary): Likewise.
* optabs.c (emit_cmp_and_jump_insns, emit_conditional_move): Likewise.
* simplify-rtx.c (simplify_gen_binary,
simplify_gen_relational): Likewise.
The change to emit_cmp_and_jump_insns, at minimum, is incorrect.
This is used e.g. by compare_from_rtx from emit_store_flag to
generate setcc instructions. We have no way of mentioning this
change of comparison code to upper layers, resulting in bad code.
A reduced test case is
----
static unsigned int expr_hash_table_size = 1;
int
main ()
{
int del = 1;
unsigned int i = 0;
if (i < expr_hash_table_size && del)
exit (0);
abort ();
}
----
Fixed thus.
r~
* optabs.c (emit_cmp_and_jump_insns): Don't swap commutative
operands unless the operation is commutative.
Index: optabs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.c,v
retrieving revision 1.97
diff -c -p -d -r1.97 optabs.c
*** optabs.c 2001/05/17 21:21:21 1.97
--- optabs.c 2001/05/21 01:22:23
*************** emit_cmp_and_jump_insns (x, y, compariso
*** 3289,3301 ****
{
rtx op0;
rtx op1;
!
! if (swap_commutative_operands_p (x, y))
{
/* Swap operands and condition to ensure canonical RTL. */
op0 = y;
op1 = x;
- comparison = swap_condition (comparison);
}
else
{
--- 3289,3304 ----
{
rtx op0;
rtx op1;
!
! /* We may not swap in the general case, since this is called from
! compare_from_rtx, and we have no way of reporting the changed
! comparison code. */
! if (comparison == swap_condition (comparison)
! && swap_commutative_operands_p (x, y))
{
/* Swap operands and condition to ensure canonical RTL. */
op0 = y;
op1 = x;
}
else
{