From: Kazu Hirata Date: Wed, 2 Apr 2003 18:36:01 +0000 (+0000) Subject: * config/h8300/h8300.md (a peephole2): New. X-Git-Tag: releases/gcc-3.4.0~7515 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d98cd543cab5e5ddf45fcc3fb1332632aa83b21e;p=thirdparty%2Fgcc.git * config/h8300/h8300.md (a peephole2): New. From-SVN: r65172 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 152dde6d89e2..5642785312f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2003-04-02 Kazu Hirata + + * config/h8300/h8300.md (a peephole2): New. + 2003-04-02 Richard Henderson * except.c (sjlj_find_directly_reachable_regions): Recognize when diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index 3b72379cf405..4b545431b458 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -4101,6 +4101,9 @@ ;; dead 0xffffff?? except -1 and -2 eq/ne xor.b and not.l ;; dead 0xffff??ff eq/ne xor.b and not.l ;; +;; live 1 geu/ltu copy and shlr.l +;; live 3 (H8S) geu/ltu copy and shlr.l +;; ;; dead 1 geu/ltu shlr.l ;; dead 3 (H8S) geu/ltu shlr.l ;; @@ -4225,6 +4228,48 @@ (pc)))] "operands[4] = GEN_INT (INTVAL (operands[1]) ^ -1);") +;; Transform +;; +;; cmp.l #1,er0 +;; bhi .L1 +;; +;; into +;; +;; mov.l er0,er1 +;; shlr.l er1 +;; bne .L1 + +(define_peephole2 + [(match_scratch:SI 4 "r") + (set (cc0) + (compare (match_operand:SI 0 "register_operand" "") + (match_operand:SI 1 "const_int_operand" ""))) + (set (pc) + (if_then_else (match_operator 2 "gtuleu_operator" + [(cc0) (const_int 0)]) + (label_ref (match_operand 3 "" "")) + (pc)))] + "(TARGET_H8300H || TARGET_H8300S) + && !peep2_reg_dead_p (1, operands[0]) + && (INTVAL (operands[1]) == 1 + || (TARGET_H8300S && INTVAL (operands[1]) == 3))" + [(set (match_dup 4) + (match_dup 0)) + (parallel [(set (match_dup 4) + (lshiftrt:SI (match_dup 4) + (match_dup 6))) + (clobber (scratch:QI))]) + (set (cc0) + (match_dup 4)) + (set (pc) + (if_then_else (match_dup 5) + (label_ref (match_dup 3)) + (pc)))] + "operands[5] = ((GET_CODE (operands[2]) == GTU) ? + gen_rtx_NE (VOIDmode, cc0_rtx, const0_rtx) : + gen_rtx_EQ (VOIDmode, cc0_rtx, const0_rtx)); + operands[6] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1));") + ;; Transform ;; ;; cmp.l #1,er0