cr logical insn implementation for rs6000

David Edelsohn dje@watson.ibm.com
Mon Oct 15 15:50:00 GMT 2001


Geoff,

	The splitter in your September 2000 patch appears to have some
parameters to gen_rtx() a little confused.  You seem to be calling
gen_rtx() with the CODE and MODE parameters reversed, and missing the
second comparison parameter.

	This especially seems to get tickled in 64-bit mode where the
comparison operator initially is DImode and the splitter re-writes it to
SImode.  For 32-bit targets, the comparisons already are SImode and never
call gen_rtx with the confused parameters.

	Does the following patch create what you originally intended?
With the change, my testcase no longer causes an ICE.

Thanks, David


	rs6000.md (cr_logical): Swap order of CODE and MODE arguments to
	gen_rtx and compare operand with const0_rtx.

Index: rs6000.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.108.4.10
diff -c -p -r1.108.4.10 rs6000.md
*** rs6000.md	2001/09/10 18:06:29	1.108.4.10
--- rs6000.md	2001/10/15 22:34:17
*************** operands[2] = GEN_INT (INTVAL (operands[
*** 12532,12555 ****
    positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
  
    if (! positive_1)
!     operands[1] = gen_rtx (SImode,
! 			   rs6000_reverse_condition (GET_MODE (operands[2]),
  						     GET_CODE (operands[1])),
! 			   operands[2]);
    else if (GET_MODE (operands[1]) != SImode)
!     operands[1] = gen_rtx (SImode,
! 			   GET_CODE (operands[1]),
! 			   operands[2]);
  
    if (! positive_2)
!     operands[3] = gen_rtx (SImode,
! 			   rs6000_reverse_condition (GET_MODE (operands[4]),
  						     GET_CODE (operands[3])),
! 			   operands[4]);
    else if (GET_MODE (operands[3]) != SImode)
!     operands[3] = gen_rtx (SImode,
! 			   GET_CODE (operands[3]),
! 			   operands[4]);
  
    if (positive_1 == positive_2)
      {
--- 12532,12555 ----
    positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
  
    if (! positive_1)
!     operands[1] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[2]),
  						     GET_CODE (operands[1])),
! 			   SImode,
! 			   operands[2], const0_rtx);
    else if (GET_MODE (operands[1]) != SImode)
!     operands[1] = gen_rtx (GET_CODE (operands[1]),
! 			   SImode,
! 			   operands[2], const0_rtx);
  
    if (! positive_2)
!     operands[3] = gen_rtx (rs6000_reverse_condition (GET_MODE (operands[4]),
  						     GET_CODE (operands[3])),
! 			   SImode,
! 			   operands[4], const0_rtx);
    else if (GET_MODE (operands[3]) != SImode)
!     operands[3] = gen_rtx (GET_CODE (operands[3]),
! 			   SImode,
! 			   operands[4], const0_rtx);
  
    if (positive_1 == positive_2)
      {



More information about the Gcc-patches mailing list