aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1992-12-31 12:55:33 -0800
committerJim Wilson <wilson@gcc.gnu.org>1992-12-31 12:55:33 -0800
commited359ebc317acbf7e2d948232f11e98a701277d0 (patch)
tree71421c82d0fcd1dd514dc6ce697dc377073d8c93
parent483404b6dc558ee5c38657e06c66ba059d7b25aa (diff)
downloadgcc-ed359ebc317acbf7e2d948232f11e98a701277d0.zip
gcc-ed359ebc317acbf7e2d948232f11e98a701277d0.tar.gz
gcc-ed359ebc317acbf7e2d948232f11e98a701277d0.tar.bz2
Add peephole to eliminate unecessary clear instructions
in strict_low_part insn sequences. From-SVN: r3015
-rw-r--r--gcc/config/m68k/m68k.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 4713213..09fb81b 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -4884,6 +4884,29 @@
return \"\";
}")
+(define_peephole
+ [(set (match_operand:SI 0 "register_operand" "=d")
+ (const_int 0))
+ (set (strict_low_part (subreg:HI (match_dup 0) 0))
+ (match_operand:HI 1 "general_operand" "rmn"))]
+ "strict_low_part_peephole_ok (HImode, prev_nonnote_insn (insn), operands[0])"
+ "*
+{
+ if (GET_CODE (operands[1]) == CONST_INT)
+ {
+ if (operands[1] == const0_rtx
+ && (DATA_REG_P (operands[0])
+ || GET_CODE (operands[0]) == MEM)
+ /* clr insns on 68000 read before writing.
+ This isn't so on the 68010, but we have no alternative for it. */
+ && (TARGET_68020
+ || !(GET_CODE (operands[0]) == MEM
+ && MEM_VOLATILE_P (operands[0]))))
+ return \"clr%.w %0\";
+ }
+ return \"move%.w %1,%0\";
+}")
+
;; dbCC peepholes
;;
;; Turns