From: Karl Meakin <[email protected]>

The bodies of `mov<ALLI>cc` and `mov<GPF>cc` are identical, so merge
them by using a new mode iterator that combines `ALLI` and `GPF`.

gcc/ChangeLog:

        * config/aarch64/aarch64.md (mov<ALLI>cc): Merge with ...
        (mov<ALLI>cc): ... this.
        * config/aarch64/iterators.md(ALLI_GPF): New mode iterator.
---
 gcc/config/aarch64/aarch64.md   | 33 ++++-----------------------------
 gcc/config/aarch64/iterators.md |  4 ++++
 2 files changed, 8 insertions(+), 29 deletions(-)

diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index fa32cc613fc..3e5e85183f4 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -4798,10 +4798,10 @@
 )
 
 (define_expand "mov<mode>cc"
-  [(set (match_operand:ALLI 0 "register_operand")
-	(if_then_else:ALLI (match_operand 1 "aarch64_comparison_operator")
-			   (match_operand:ALLI 2 "register_operand")
-			   (match_operand:ALLI 3 "register_operand")))]
+  [(set (match_operand:ALLI_GPF 0 "register_operand")
+	(if_then_else:ALLI_GPF (match_operand 1 "aarch64_comparison_operator")
+			   (match_operand:ALLI_GPF 2 "register_operand")
+			   (match_operand:ALLI_GPF 3 "register_operand")))]
   ""
   {
     enum rtx_code code = GET_CODE (operands[1]);
@@ -4841,31 +4841,6 @@
   }
 )
 
-(define_expand "mov<mode>cc"
-  [(set (match_operand:GPF 0 "register_operand")
-	(if_then_else:GPF (match_operand 1 "aarch64_comparison_operator")
-			  (match_operand:GPF 2 "register_operand")
-			  (match_operand:GPF 3 "register_operand")))]
-  ""
-  {
-    enum rtx_code code = GET_CODE (operands[1]);
-    if (code == UNEQ || code == LTGT)
-      FAIL;
-
-    rtx ccreg = XEXP (operands[1], 0);
-    enum machine_mode ccmode = GET_MODE (ccreg);
-    if (GET_MODE_CLASS (ccmode) == MODE_CC)
-      gcc_assert (XEXP (operands[1], 1) == const0_rtx);
-    else if (ccmode == QImode || ccmode == HImode)
-      FAIL;
-    else
-      {
-	ccreg = aarch64_gen_compare_reg (code, ccreg, XEXP (operands[1], 1));
-	operands[1] = gen_rtx_fmt_ee (code, VOIDmode, ccreg, const0_rtx);
-      }
-  }
-)
-
 (define_expand "<neg_not_op><mode>cc"
   [(set (match_operand:GPI 0 "register_operand")
 	(if_then_else:GPI (match_operand 1 "aarch64_comparison_operator")
diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md
index 332e7ffd2ea..cb21b955285 100644
--- a/gcc/config/aarch64/iterators.md
+++ b/gcc/config/aarch64/iterators.md
@@ -65,6 +65,10 @@
 ;; Iterator for all 16-bit scalar floating point modes (HF, BF)
 (define_mode_iterator HFBF [HF BF])
 
+;; Iterator for all integer modes (up to 64-bit) plus all General Purpose
+;; Floating-point registers (32- and 64-bit modes).
+(define_mode_iterator ALLI_GPF [ALLI GPF])
+
 ;; Iterator for all scalar floating point modes suitable for moving, including
 ;; special BF type and decimal floating point types (HF, SF, DF, TF, BF,
 ;; SD, DD and TD)

Reply via email to