diff mbox series

[committed] Consolidate movsd and movmd patterns/splitters for H8

Message ID a5a6ec83-a8ae-7ebf-f786-82d4a3ae2df8@redhat.com
State New
Headers show
Series [committed] Consolidate movsd and movmd patterns/splitters for H8 | expand

Commit Message

Jeff Law July 4, 2018, 12:28 a.m. UTC
So the H8 port has movmd and movsd instructions which are used to
implement block moves and stpcpy.  Those expanders and patters are
necessarily fairly ugly, but not enough to warrant trying to simplify.

What is worth simplifying is the fact that we have two copies of each
pattern and splitter because Pmode varies.  This patch uses the P mode
iterator to consolidate the patterns & splitters that only differed in
the modes they used for the pointer operands.

The resulting code for libgcc & newlib is unchanged.

Installed on the trunk.

Jeff
* config/h8300/h8300.md (movmd_internal_normal): Consolidated with
	(movmd_internal) into a single pattern using the P mode iterator.
	(movmd splitters): Similarly.
	(stpcpy_internal_normal, stpcpy_internal): Similarly for thes patterns.
	(movsd splitters): Similarly.
diff mbox series

Patch

diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index 5014fd5..e654784 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -512,33 +512,16 @@ 
 ;; This is a difficult instruction to reload since operand 0 must be the
 ;; frame pointer.  See h8300_reg_class_from_letter for an explanation.
 
-(define_insn "movmd_internal_normal"
-  [(set (mem:BLK (match_operand:HI 3 "register_operand" "0,r"))
-	(mem:BLK (match_operand:HI 4 "register_operand" "1,1")))
+(define_insn "movmd_internal_<mode>"
+  [(set (mem:BLK (match_operand:P 3 "register_operand" "0,r"))
+	(mem:BLK (match_operand:P 4 "register_operand" "1,1")))
    (unspec [(match_operand:HI 5 "register_operand" "2,2")
 	    (match_operand:HI 6 "const_int_operand" "n,n")] UNSPEC_MOVMD)
-   (clobber (match_operand:HI 0 "register_operand" "=d,??D"))
-   (clobber (match_operand:HI 1 "register_operand" "=f,f"))
+   (clobber (match_operand:P 0 "register_operand" "=d,??D"))
+   (clobber (match_operand:P 1 "register_operand" "=f,f"))
    (set (match_operand:HI 2 "register_operand" "=c,c")
 	(const_int 0))]
-  "TARGET_H8300SX && TARGET_NORMAL_MODE"
-  "@
-    movmd%m6
-    #"
-  [(set_attr "length" "2,14")
-   (set_attr "can_delay" "no")
-   (set_attr "cc" "none,clobber")])
-
-(define_insn "movmd_internal"
-  [(set (mem:BLK (match_operand:SI 3 "register_operand" "0,r"))
-	(mem:BLK (match_operand:SI 4 "register_operand" "1,1")))
-   (unspec [(match_operand:HI 5 "register_operand" "2,2")
-	    (match_operand:HI 6 "const_int_operand" "n,n")] UNSPEC_MOVMD)
-   (clobber (match_operand:SI 0 "register_operand" "=d,??D"))
-   (clobber (match_operand:SI 1 "register_operand" "=f,f"))
-   (set (match_operand:HI 2 "register_operand" "=c,c")
-	(const_int 0))]
-  "TARGET_H8300SX && !TARGET_NORMAL_MODE"
+  "TARGET_H8300SX"
   "@
     movmd%m6
     #"
@@ -563,33 +546,11 @@ 
 	(match_operand:BLK 1 "memory_operand" ""))
    (unspec [(match_operand:HI 2 "register_operand" "")
 	    (match_operand:HI 3 "const_int_operand" "")] UNSPEC_MOVMD)
-   (clobber (match_operand:HI 4 "register_operand" ""))
-   (clobber (match_operand:HI 5 "register_operand" ""))
-   (set (match_dup 2)
-	(const_int 0))]
-  "TARGET_H8300SX && TARGET_NORMAL_MODE && reload_completed
-   && REGNO (operands[4]) != DESTINATION_REG"
-  [(const_int 0)]
-  {
-    rtx dest;
-
-    h8300_swap_into_er6 (XEXP (operands[0], 0));
-    dest = replace_equiv_address (operands[0], hard_frame_pointer_rtx);
-    emit_insn (gen_movmd (dest, operands[1], operands[2], operands[3]));
-    h8300_swap_out_of_er6 (operands[4]);
-    DONE;
-  })
-
-(define_split
-  [(set (match_operand:BLK 0 "memory_operand" "")
-	(match_operand:BLK 1 "memory_operand" ""))
-   (unspec [(match_operand:HI 2 "register_operand" "")
-	    (match_operand:HI 3 "const_int_operand" "")] UNSPEC_MOVMD)
-   (clobber (match_operand:SI 4 "register_operand" ""))
-   (clobber (match_operand:SI 5 "register_operand" ""))
+   (clobber (match_operand:P 4 "register_operand" ""))
+   (clobber (match_operand:P 5 "register_operand" ""))
    (set (match_dup 2)
 	(const_int 0))]
-  "TARGET_H8300SX && !TARGET_NORMAL_MODE && reload_completed
+  "TARGET_H8300SX && reload_completed
    && REGNO (operands[4]) != DESTINATION_REG"
   [(const_int 0)]
   {
@@ -641,28 +602,14 @@ 
 
 ;; See comments above memcpy_internal().
 
-(define_insn "stpcpy_internal_normal"
-  [(set (mem:BLK (match_operand:HI 3 "register_operand" "0,r"))
-	(unspec:BLK [(mem:BLK (match_operand:HI 4 "register_operand" "1,1"))]
-	UNSPEC_STPCPY))
-   (clobber (match_operand:HI 0 "register_operand" "=d,??D"))
-   (clobber (match_operand:HI 1 "register_operand" "=f,f"))
-   (clobber (match_operand:HI 2 "register_operand" "=c,c"))]
-  "TARGET_H8300SX && TARGET_NORMAL_MODE"
-  "@
-    \n1:\tmovsd\t2f\;bra\t1b\n2:
-    #"
-  [(set_attr "length" "6,18")
-   (set_attr "cc" "none,clobber")])
-
-(define_insn "stpcpy_internal"
-  [(set (mem:BLK (match_operand:SI 3 "register_operand" "0,r"))
-	(unspec:BLK [(mem:BLK (match_operand:SI 4 "register_operand" "1,1"))]
+(define_insn "stpcpy_internal_<mode>"
+  [(set (mem:BLK (match_operand:P 3 "register_operand" "0,r"))
+	(unspec:BLK [(mem:BLK (match_operand:P 4 "register_operand" "1,1"))]
 	UNSPEC_STPCPY))
-   (clobber (match_operand:SI 0 "register_operand" "=d,??D"))
-   (clobber (match_operand:SI 1 "register_operand" "=f,f"))
-   (clobber (match_operand:SI 2 "register_operand" "=c,c"))]
-  "TARGET_H8300SX && !TARGET_NORMAL_MODE"
+   (clobber (match_operand:P 0 "register_operand" "=d,??D"))
+   (clobber (match_operand:P 1 "register_operand" "=f,f"))
+   (clobber (match_operand:P 2 "register_operand" "=c,c"))]
+  "TARGET_H8300SX"
   "@
     \n1:\tmovsd\t2f\;bra\t1b\n2:
     #"
@@ -675,29 +622,10 @@ 
 (define_split
   [(set (match_operand:BLK 0 "memory_operand" "")
 	(unspec:BLK [(match_operand:BLK 1 "memory_operand" "")] UNSPEC_STPCPY))
-   (clobber (match_operand:HI 2 "register_operand" ""))
-   (clobber (match_operand:HI 3 "register_operand" ""))
-   (clobber (match_operand:HI 4 "register_operand" ""))]
-  "TARGET_H8300SX && TARGET_NORMAL_MODE && reload_completed
-   && REGNO (operands[2]) != DESTINATION_REG"
-  [(const_int 0)]
-  {
-    rtx dest;
-
-    h8300_swap_into_er6 (XEXP (operands[0], 0));
-    dest = replace_equiv_address (operands[0], hard_frame_pointer_rtx);
-    emit_insn (gen_movsd (dest, operands[1], operands[4]));
-    h8300_swap_out_of_er6 (operands[2]);
-    DONE;
-  })
-
-(define_split
-  [(set (match_operand:BLK 0 "memory_operand" "")
-	(unspec:BLK [(match_operand:BLK 1 "memory_operand" "")] UNSPEC_STPCPY))
-   (clobber (match_operand:SI 2 "register_operand" ""))
-   (clobber (match_operand:SI 3 "register_operand" ""))
-   (clobber (match_operand:SI 4 "register_operand" ""))]
-  "TARGET_H8300SX && !TARGET_NORMAL_MODE && reload_completed
+   (clobber (match_operand:P 2 "register_operand" ""))
+   (clobber (match_operand:P 3 "register_operand" ""))
+   (clobber (match_operand:P 4 "register_operand" ""))]
+  "TARGET_H8300SX &&  reload_completed
    && REGNO (operands[2]) != DESTINATION_REG"
   [(const_int 0)]
   {