This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] h8300.md: Add new patterns.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 13 Jan 2003 08:16:05 -0500 (EST)
- Subject: [patch] h8300.md: Add new patterns.
Hi,
Attached is a patch to add new patterns.
Tested on h8300 port. Committed.
Kazu Hirata
2003-01-13 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.md (*andsi3_lshift_n_sb): New.
(*iorsi3_and_lshiftrt_n_sb): Likewise.
Index: h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.149
diff -u -r1.149 h8300.md
--- h8300.md 10 Jan 2003 15:02:01 -0000 1.149
+++ h8300.md 13 Jan 2003 13:15:21 -0000
@@ -2598,6 +2598,24 @@
(clobber (scratch:QI))])]
"")
+;; Accept (A >> 30) & 2 and the like.
+
+(define_insn "*andsi3_lshiftrt_n_sb"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "0")
+ (match_operand:SI 2 "const_int_operand" "n"))
+ (match_operand:SI 3 "single_one_operand" "n")))]
+ "(TARGET_H8300H || TARGET_H8300S)
+ && exact_log2 (INTVAL (operands[3])) < 16
+ && INTVAL (operands[2]) + exact_log2 (INTVAL (operands[3])) == 31"
+ "*
+{
+ operands[3] = GEN_INT (exact_log2 (INTVAL (operands[3])));
+ return \"shll.l\\t%S0\;xor.l\\t%S0,%S0\;bst\\t%Z3,%Y0\";
+}"
+ [(set_attr "length" "8")
+ (set_attr "cc" "clobber")])
+
;; plus:SI
(define_insn "*addsi3_upper"
@@ -2710,6 +2728,17 @@
"rotxl.l\\t%S0\;bor\\t#0,%w1\;rotxr.l\\t%S0"
[(set_attr "length" "6")
(set_attr "cc" "set_znv")])
+
+(define_insn "*iorsi3_and_lshiftrt_n_sb"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (ior:SI (and:SI (lshiftrt:SI (match_operand:SI 1 "register_operand" "r")
+ (const_int 30))
+ (const_int 2))
+ (match_operand:SI 2 "register_operand" "0")))]
+ "(TARGET_H8300H || TARGET_H8300S)"
+ "rotl.l\\t%S1\;rotr.l\\t%S1\;bor\\t#1,%w0\;bst\\t#1,%w0"
+ [(set_attr "length" "8")
+ (set_attr "cc" "clobber")])
;; Used to OR the exponent of a float.