[PATCH] PR19331: Improve RTL bit-field simplification (take 2)

Roger Sayle roger@eyesopen.com
Mon Feb 7 14:12:00 GMT 2005


On Mon, 7 Feb 2005, Alan Modra wrote:
> On Sun, Feb 06, 2005 at 06:53:51AM -0700, Roger Sayle wrote:
> > 	* simplify-rtx.c (simplify_relational_operation_1): Simplify
> > 	(ne:SI (zero_extract:SI FOO (const_int 1) BAR) (const_int 0))
> > 	into just (zero_extract:SI FOO (const_int 1) BAR).
>
> Breaks bootstrap on powerpc64-linux.

Damn.  I'm currently investigating the following fix.  Could you let
me know if it restores bootstrap on powerpc64-linux for you?



2005-02-06  Roger Sayle  <roger@eyesopen.com>

	* simplify_rtx.c (simplify_relational_operaration_1): Explicitly
	call gen_lowpart_common and gen_lowpart_SUBREG instead of calling
	gen_lowpart.


Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.225
diff -c -3 -p -r1.225 simplify-rtx.c
*** simplify-rtx.c	6 Feb 2005 23:33:25 -0000	1.225
--- simplify-rtx.c	7 Feb 2005 01:55:27 -0000
*************** simplify_relational_operation_1 (enum rt
*** 2888,2896 ****
        && cmp_mode != VOIDmode
        && nonzero_bits (op0, cmp_mode) == 1
        && STORE_FLAG_VALUE == 1)
!     return GET_MODE_SIZE (mode) > GET_MODE_SIZE (cmp_mode)
! 	   ? simplify_gen_unary (ZERO_EXTEND, mode, op0, cmp_mode)
! 	   : gen_lowpart (mode, op0);

    return NULL_RTX;
  }
--- 2888,2904 ----
        && cmp_mode != VOIDmode
        && nonzero_bits (op0, cmp_mode) == 1
        && STORE_FLAG_VALUE == 1)
!     {
!       rtx tmp;
!       if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (cmp_mode))
! 	return simplify_gen_unary (ZERO_EXTEND, mode, op0, cmp_mode);
!       tmp = gen_lowpart_common (mode, op0);
!       if (tmp)
! 	return tmp;
!       if (GET_MODE (op0) != mode)
! 	return gen_lowpart_SUBREG (mode, op0);
!       return op0;
!     }

    return NULL_RTX;
  }


Roger
--



More information about the Gcc-patches mailing list