This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] h8300.md: Add a new pattern.
- From: Kazu Hirata <kazu at cs dot umass dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 24 Jan 2003 11:03:30 -0500 (EST)
- Subject: [patch] h8300.md: Add a new pattern.
Hi,
Attached is a patch to add a new pattern.
The pattern transforms
unsinged long A;
(A << CST) & 0xffff;
into
unsinged long A;
(unsigned long) ((unsigned short) A << CST)
Tested on h8300 port. Committed.
Kazu Hirata
2003-01-24 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.md (*andsi3_ashift_n_lower): New.
Index: h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.154
diff -u -r1.154 h8300.md
--- h8300.md 21 Jan 2003 20:34:01 -0000 1.154
+++ h8300.md 24 Jan 2003 15:56:06 -0000
@@ -2597,6 +2597,27 @@
(clobber (scratch:QI))])]
"")
+;; Transform (SImode << B) & 0xffff into (SImode) (HImode << B).
+
+(define_insn_and_split "*andsi3_ashift_n_lower"
+ [(set (match_operand:SI 0 "register_operand" "=r,r")
+ (and:SI (ashift:SI (match_operand:SI 1 "register_operand" "0,0")
+ (match_operand:QI 2 "const_int_operand" "S,n"))
+ (match_operand:SI 3 "const_int_operand" "n,n")))
+ (clobber (match_scratch:QI 4 "=X,&r"))]
+ "(TARGET_H8300H || TARGET_H8300S)
+ && INTVAL (operands[2]) <= 15
+ && INTVAL (operands[3]) == ((-1 << INTVAL (operands[2])) & 0xffff)"
+ "#"
+ "&& reload_completed"
+ [(parallel [(set (match_dup 5)
+ (ashift:HI (match_dup 5)
+ (match_dup 2)))
+ (clobber (match_dup 4))])
+ (set (match_dup 0)
+ (zero_extend:SI (match_dup 5)))]
+ "operands[5] = gen_rtx_REG (HImode, REGNO (operands[0]));")
+
;; Accept (A >> 30) & 2 and the like.
(define_insn "*andsi3_lshiftrt_n_sb"