aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorKazu Kirata <kazu@gcc.gnu.org>2015-12-13 06:06:12 -0700
committerJeff Law <law@gcc.gnu.org>2015-12-13 06:06:12 -0700
commitdcca1b0510693e6e8c1fac3fef2cde2362772720 (patch)
tree9fe989bae6ce5fb7f6edba2a3b9efe5708b71518 /gcc/config
parentd686d8067a3d4ff451a6e55959feb56984f3d8be (diff)
downloadgcc-dcca1b0510693e6e8c1fac3fef2cde2362772720.zip
gcc-dcca1b0510693e6e8c1fac3fef2cde2362772720.tar.gz
gcc-dcca1b0510693e6e8c1fac3fef2cde2362772720.tar.bz2
[PATCH][PR target/19201] Peephole to improve clearing items in structure for m68k
[PATCH][PR target/19201] Peephole to improve clearing items in structure for m68k * config/m68k/m68k.md (load feeding clear byte): New peephole2. * gcc.target/m68k/pr19201.c: New test. From-SVN: r231597
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/m68k/m68k.md33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md
index 1eaf58f..444515a 100644
--- a/gcc/config/m68k/m68k.md
+++ b/gcc/config/m68k/m68k.md
@@ -7601,3 +7601,36 @@
(include "cf.md")
(include "sync.md")
+
+;; Convert
+;;
+;; move.l 4(%a0),%a0
+;; clr.b (%a0,%a1.l)
+;;
+;; into
+;;
+;; add.l 4(%a0),%a1
+;; clr.b (%a1)
+;;
+;; The latter is smaller. It is faster on all models except m68060.
+
+(define_peephole2
+ [(set (match_operand:SI 0 "register_operand" "")
+ (mem:SI (plus:SI (match_operand:SI 1 "register_operand" "")
+ (match_operand:SI 2 "const_int_operand" ""))))
+ (set (mem:QI (plus:SI (match_operand:SI 3 "register_operand" "")
+ (match_operand:SI 4 "register_operand" "")))
+ (const_int 0))]
+ "(optimize_size || !TUNE_68060)
+ && (operands[0] == operands[3] || operands[0] == operands[4])
+ && ADDRESS_REG_P (operands[1])
+ && ADDRESS_REG_P ((operands[0] == operands[3]) ? operands[4] : operands[3])
+ && peep2_reg_dead_p (2, operands[3])
+ && peep2_reg_dead_p (2, operands[4])"
+ [(set (match_dup 5)
+ (plus:SI (match_dup 5)
+ (mem:SI (plus:SI (match_dup 1)
+ (match_dup 2)))))
+ (set (mem:QI (match_dup 5))
+ (const_int 0))]
+ "operands[5] = (operands[0] == operands[3]) ? operands[4] : operands[3];")