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]

[PATCH] PowerPC CCEQ splitter and branch_positive_comparison_operator


Geoff,

	Why does the CCEQ splitter test the operand of
branch_positive_comparison_operator with CCEQmode?  My bootstrap fix
changed predicates.md to emulate the behavior of the original predicate
written in C that did not test the mode.  The splitter seems to be the
only place testing a comparison operand with mode CCEQ and that is what
lead to the failure.  I think the test is confusing the mode of the
compare with the mode of the comparison operator.  What did you intend?

	The following patch reverts the define_special_predicate change
and uses the mode of the operand for the branch_comparison_operator test.

Thanks, David


	* config/rs6000/rs6000.md (cceq splitter): Use operand mode, not
	CCEQ mode for branch_positive_comparison_operator test.
	* config/rs6000/predicates (branch_comparison_operator): Revert to
	define_predicate.
	(scc_comparison_operator): Same.
	(branch_positive_comparison_operator): Same.

Index: rs6000.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.351
diff -c -p -r1.351 rs6000.md
*** rs6000.md	28 Feb 2005 19:07:36 -0000	1.351
--- rs6000.md	1 Mar 2005 19:16:14 -0000
***************
*** 13955,13962 ****
  {
    int positive_1, positive_2;
  
!   positive_1 = branch_positive_comparison_operator (operands[1], CCEQmode);
!   positive_2 = branch_positive_comparison_operator (operands[3], CCEQmode);
  
    if (! positive_1)
      operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
--- 13955,13964 ----
  {
    int positive_1, positive_2;
  
!   positive_1 = branch_positive_comparison_operator (operands[1],
! 						    GET_MODE (operands[1]));
!   positive_2 = branch_positive_comparison_operator (operands[3],
! 						    GET_MODE (operands[3]));
  
    if (! positive_1)
      operands[1] = gen_rtx_fmt_ee (rs6000_reverse_condition (GET_MODE (operands[2]),
Index: predicates.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/predicates.md,v
retrieving revision 1.2
diff -c -p -r1.2 predicates.md
*** predicates.md	1 Mar 2005 18:22:07 -0000	1.2
--- predicates.md	1 Mar 2005 19:16:14 -0000
***************
*** 678,684 ****
  
  ;; Return 1 if OP is a comparison operation that is valid for a branch
  ;; instruction.  We only check the opcode against the mode of the CC value.
! (define_special_predicate "branch_comparison_operator"
    (match_code "eq,ne,le,lt,ge,gt,leu,ltu,geu,gtu,unordered,ordered,unge,unle")
  {
    enum rtx_code code = GET_CODE (op);
--- 678,684 ----
  
  ;; Return 1 if OP is a comparison operation that is valid for a branch
  ;; instruction.  We only check the opcode against the mode of the CC value.
! (define_predicate "branch_comparison_operator"
    (match_code "eq,ne,le,lt,ge,gt,leu,ltu,geu,gtu,unordered,ordered,unge,unle")
  {
    enum rtx_code code = GET_CODE (op);
***************
*** 698,710 ****
  
  ;; Return 1 if OP is a comparison operation that is valid for an SCC insn --
  ;; it must be a positive comparison.
! (define_special_predicate "scc_comparison_operator"
    (and (match_code "eq,lt,gt,ltu,gtu,unordered")
         (match_operand 0 "branch_comparison_operator")))
  
  ;; Return 1 if OP is a comparison operation that is valid for a branch
  ;; insn, which is true if the corresponding bit in the CC register is set.
! (define_special_predicate "branch_positive_comparison_operator"
    (and (match_code "eq,lt,gt,ltu,gtu,unordered")
         (match_operand 0 "branch_comparison_operator")))
  
--- 698,710 ----
  
  ;; Return 1 if OP is a comparison operation that is valid for an SCC insn --
  ;; it must be a positive comparison.
! (define_predicate "scc_comparison_operator"
    (and (match_code "eq,lt,gt,ltu,gtu,unordered")
         (match_operand 0 "branch_comparison_operator")))
  
  ;; Return 1 if OP is a comparison operation that is valid for a branch
  ;; insn, which is true if the corresponding bit in the CC register is set.
! (define_predicate "branch_positive_comparison_operator"
    (and (match_code "eq,lt,gt,ltu,gtu,unordered")
         (match_operand 0 "branch_comparison_operator")))
  


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