From 5285c21c6eb79ea45cde5e3d83d5cc127629d20d Mon Sep 17 00:00:00 2001
From: Andrew Pinski <apinski@cavium.com>
Date: Wed, 5 Sep 2012 20:23:22 +0000
Subject: [PATCH] optabs.c (emit_conditional_add): Correct comment about the
 arguments.

2012-09-05  Andrew Pinski  <apinski@cavium.com>

 	* optabs.c (emit_conditional_add): Correct comment about the arguments.
	Remove code which might swap op2 and op3 since they cannot be swapped.
	* doc/md.texi (add@var{mode}cc): Fix document about how the arguments
	are used.

From-SVN: r190994
---
 gcc/ChangeLog   |  7 +++++++
 gcc/doc/md.texi |  2 +-
 gcc/optabs.c    | 13 +------------
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 384d9fe7ec8c..84c4f0903431 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2012-09-05  Andrew Pinski  <apinski@cavium.com>
+
+ 	* optabs.c (emit_conditional_add): Correct comment about the arguments.
+	Remove code which might swap op2 and op3 since they cannot be swapped.
+	* doc/md.texi (add@var{mode}cc): Fix document about how the arguments
+	are used.
+
 2012-09-05  Oleg Endo  <olegendo@gcc.gnu.org>
 
 	* hooks.c (hook_int_rtx_mode_as_bool_0): New function.
diff --git a/gcc/doc/md.texi b/gcc/doc/md.texi
index bcc9bb62b44f..9f2012f148ac 100644
--- a/gcc/doc/md.texi
+++ b/gcc/doc/md.texi
@@ -5250,7 +5250,7 @@ define these patterns.
 @item @samp{add@var{mode}cc}
 Similar to @samp{mov@var{mode}cc} but for conditional addition.  Conditionally
 move operand 2 or (operands 2 + operand 3) into operand 0 according to the
-comparison in operand 1.  If the comparison is true, operand 2 is moved into
+comparison in operand 1.  If the comparison is false, operand 2 is moved into
 operand 0, otherwise (operand 2 + operand 3) is moved.
 
 @cindex @code{cstore@var{mode}4} instruction pattern
diff --git a/gcc/optabs.c b/gcc/optabs.c
index ebb2af5b1457..02c2fd5dd0f4 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -4584,7 +4584,7 @@ can_conditionally_move_p (enum machine_mode mode)
    the mode to use should they be constants.  If it is VOIDmode, they cannot
    both be constants.
 
-   OP2 should be stored in TARGET if the comparison is true, otherwise OP2+OP3
+   OP2 should be stored in TARGET if the comparison is false, otherwise OP2+OP3
    should be stored there.  MODE is the mode to use should they be constants.
    If it is VOIDmode, they cannot both be constants.
 
@@ -4598,7 +4598,6 @@ emit_conditional_add (rtx target, enum rtx_code code, rtx op0, rtx op1,
 {
   rtx tem, comparison, last;
   enum insn_code icode;
-  enum rtx_code reversed;
 
   /* If one operand is constant, make it the second one.  Only do this
      if the other operand is not constant as well.  */
@@ -4622,16 +4621,6 @@ emit_conditional_add (rtx target, enum rtx_code code, rtx op0, rtx op1,
   if (cmode == VOIDmode)
     cmode = GET_MODE (op0);
 
-  if (swap_commutative_operands_p (op2, op3)
-      && ((reversed = reversed_comparison_code_parts (code, op0, op1, NULL))
-          != UNKNOWN))
-    {
-      tem = op2;
-      op2 = op3;
-      op3 = tem;
-      code = reversed;
-    }
-
   if (mode == VOIDmode)
     mode = GET_MODE (op2);
 
-- 
GitLab