Patchwork [20/28] mn10300: Emit clr.

login
register
mail settings
Submitter Richard Henderson
Date Jan. 10, 2011, 8:31 p.m.
Message ID <1294691517-19580-21-git-send-email-rth@redhat.com>
Download mbox | patch
Permalink /patch/78211/
State New
Headers show

Comments

Richard Henderson - Jan. 10, 2011, 8:31 p.m.
From: Richard Henderson <rth@twiddle.net>

---
 gcc/config/mn10300/mn10300.md |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
Jeff Law - Jan. 12, 2011, 2:04 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/10/11 13:31, Richard Henderson wrote:
> From: Richard Henderson <rth@twiddle.net>
> 
> ---
>  gcc/config/mn10300/mn10300.md |   25 +++++++++++++++++++++++++
>  1 files changed, 25 insertions(+), 0 deletions(-)
OK.
jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNLbTTAAoJEBRtltQi2kC7v98IAJTsY7x9kuA+6N37Of9VLwVg
qsQoRFJVEM/OHWFlo6+xUltfpRPcLAeiH7erkgWYKFZggMJcglqwSi3rBDrRkFyL
M9a1g1Hh0XUfsjQCIL/lA3/Qdlco/i1mFo8nBY0thpuFBxLitAUzVrVgVLWX+qQD
8S9ISL3kcVxDrbEdTtPDTjNrJXLZjxrqfw8XwbmdqKPhexZCzHtPwJ0mKn2ykecW
4iigmCjUZoshvrNM3Zr4gsKX9eEZXMXCxnDBHvoPaWQt+MTC/ZpcI0xngOo7ihQ+
QC8Mevn7yrZXYyxEacpIb4if146QamH4IkK8jHipAghmbPh3uCmC9vGBB+UY0zU=
=hx8G
-----END PGP SIGNATURE-----

Patch

diff --git a/gcc/config/mn10300/mn10300.md b/gcc/config/mn10300/mn10300.md
index 24c8d11..4f4fdfe 100644
--- a/gcc/config/mn10300/mn10300.md
+++ b/gcc/config/mn10300/mn10300.md
@@ -70,8 +70,13 @@ 
 	]
 	(const_int 0))
 )
+
+(define_mode_iterator INT [QI HI SI])
+
 
+;; ----------------------------------------------------------------------
 ;; Pipeline description.
+;; ----------------------------------------------------------------------
 
 ;; The AM33 only has a single pipeline.  It has five stages (fetch,
 ;; decode, execute, memory access, writeback) each of which normally
@@ -480,6 +485,26 @@ 
 				(const_int 13) (const_int 24))
 		 ])]
 )
+
+;; If the flags register is not live, generate CLR instead of MOV 0.
+;; For MN103, this is only legal for DATA_REGS; for AM33 this is legal
+;; but not a win for ADDRESS_REGS.
+(define_peephole2
+  [(set (match_operand:INT 0 "register_operand" "") (const_int 0))]
+  "peep2_regno_dead_p (0, CC_REG)
+   && (REGNO_DATA_P (REGNO (operands[0]), 1)
+       || REGNO_EXTENDED_P (REGNO (operands[0]), 1))"
+  [(parallel [(set (match_dup 0) (const_int 0))
+	      (clobber (reg:CC CC_REG))])]
+)
+
+(define_insn "*mov<mode>_clr"
+  [(set (match_operand:INT 0 "register_operand" "=D")
+	(const_int 0))
+   (clobber (reg:CC CC_REG))]
+  ""
+  "clr %0"
+)
 
 ;; ----------------------------------------------------------------------
 ;; ADD INSTRUCTIONS