rs6000: Fix branch_comparison_operator
diff mbox series

Message ID 5129594a6241832d4b87d8b5b6f76bbff0d358bc.1573224246.git.segher@kernel.crashing.org
State New
Headers show
Series
  • rs6000: Fix branch_comparison_operator
Related show

Commit Message

Segher Boessenkool Nov. 8, 2019, 2:50 p.m. UTC
Another part I forgot yesterday.  With this, everything is back to
normal.

Committing.


Segher


2019-11-08  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/rs6000/predicates.md (branch_comparison_operator): Allow only
	the comparison codes that make sense for the mode used, and only the
	codes that can be done with a single branch instruction.

---
 gcc/config/rs6000/predicates.md | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/gcc/config/rs6000/predicates.md b/gcc/config/rs6000/predicates.md
index 5ef505b..5c5aad9 100644
--- a/gcc/config/rs6000/predicates.md
+++ b/gcc/config/rs6000/predicates.md
@@ -1135,10 +1135,14 @@  (define_special_predicate "equality_operator"
 ;; validate_condition_mode is an assertion.
 (define_predicate "branch_comparison_operator"
    (and (match_operand 0 "comparison_operator")
-	(and (match_test "GET_MODE_CLASS (GET_MODE (XEXP (op, 0))) == MODE_CC")
-	     (match_test "validate_condition_mode (GET_CODE (op),
-						   GET_MODE (XEXP (op, 0))),
-			  1"))))
+	(match_test "GET_MODE_CLASS (GET_MODE (XEXP (op, 0))) == MODE_CC")
+	(if_then_else (match_test "GET_MODE (XEXP (op, 0)) == CCFPmode
+				   && !flag_finite_math_only")
+		      (match_code "lt,gt,eq,unordered,unge,unle,ne,ordered")
+		      (match_code "lt,ltu,le,leu,gt,gtu,ge,geu,eq,ne"))
+	(match_test "validate_condition_mode (GET_CODE (op),
+					      GET_MODE (XEXP (op, 0))),
+		     1")))
 
 ;; Return 1 if OP is an unsigned comparison operator.
 (define_predicate "unsigned_comparison_operator"