This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fix middle-end/10475


The analysis in the PR is correct.  It's not hard to handle
CONST_INT properly here, so that's what I did.


r~


        PR middle-end/10475
        * expmed.c (emit_store_flag): Use simplify_gen_subreg directly
        for extracting sub-words.

Index: expmed.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expmed.c,v
retrieving revision 1.133
diff -c -p -d -r1.133 expmed.c
*** expmed.c	21 Apr 2003 21:32:00 -0000	1.133
--- expmed.c	12 Jun 2003 22:22:43 -0000
*************** emit_store_flag (target, code, op0, op1,
*** 4354,4372 ****
      {
        if (code == EQ || code == NE)
  	{
  	  /* Do a logical OR of the two words and compare the result.  */
! 	  rtx op0h = gen_highpart (word_mode, op0);
! 	  rtx op0l = gen_lowpart (word_mode, op0);
! 	  rtx op0both = expand_binop (word_mode, ior_optab, op0h, op0l,
! 				      NULL_RTX, unsignedp, OPTAB_DIRECT);
  	  if (op0both != 0)
  	    return emit_store_flag (target, code, op0both, op1, word_mode,
  				    unsignedp, normalizep);
  	}
        else if (code == LT || code == GE)
! 	/* If testing the sign bit, can just test on high word.  */
! 	return emit_store_flag (target, code, gen_highpart (word_mode, op0),
! 				op1, word_mode, unsignedp, normalizep);
      }
  
    /* From now on, we won't change CODE, so set ICODE now.  */
--- 4354,4380 ----
      {
        if (code == EQ || code == NE)
  	{
+ 	  rtx op00, op01, op0both;
+ 
  	  /* Do a logical OR of the two words and compare the result.  */
! 	  op00 = simplify_gen_subreg (word_mode, op0, mode, 0);
! 	  op01 = simplify_gen_subreg (word_mode, op0, mode, UNITS_PER_WORD);
! 	  op0both = expand_binop (word_mode, ior_optab, op00, op01,
! 				  NULL_RTX, unsignedp, OPTAB_DIRECT);
  	  if (op0both != 0)
  	    return emit_store_flag (target, code, op0both, op1, word_mode,
  				    unsignedp, normalizep);
  	}
        else if (code == LT || code == GE)
! 	{
! 	  rtx op0h;
! 
! 	  /* If testing the sign bit, can just test on high word.  */
! 	  op0h = simplify_gen_subreg (word_mode, op0, mode,
! 				      subreg_highpart_offset (word_mode, mode));
! 	  return emit_store_flag (target, code, op0h, op1, word_mode,
! 				  unsignedp, normalizep);
! 	}
      }
  
    /* From now on, we won't change CODE, so set ICODE now.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]