aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1999-02-02 19:06:58 +0000
committerJeff Law <law@gcc.gnu.org>1999-02-02 12:06:58 -0700
commit47f59fd4d5e519288bb76e02f4a2a0f7d2d62572 (patch)
treef397789491b6840579ea7d9f61d3484bfb906e88 /gcc
parentcbca921c15ad8dca7df9ee697ecb70b89cdb1da0 (diff)
downloadgcc-47f59fd4d5e519288bb76e02f4a2a0f7d2d62572.zip
gcc-47f59fd4d5e519288bb76e02f4a2a0f7d2d62572.tar.gz
gcc-47f59fd4d5e519288bb76e02f4a2a0f7d2d62572.tar.bz2
i386.md (ashlsi3): Turn into a define_expand an anonymous pattern.
* i386.md (ashlsi3): Turn into a define_expand an anonymous pattern. Make the anonymous pattern match when ! optimize_size. (ashlsi3 size optimizer): New pattern. From-SVN: r24980
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/i386/i386.md39
2 files changed, 41 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5837037..4382b7c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -6,6 +6,10 @@ Tue Feb 2 20:29:34 1999 Catherine Moore <clm@cygnus.com>
Tue Feb 2 19:43:59 1999 Jeffrey A Law (law@cygnus.com)
+ * i386.md (ashlsi3): Turn into a define_expand an anonymous pattern.
+ Make the anonymous pattern match when ! optimize_size.
+ (ashlsi3 size optimizer): New pattern.
+
* intl/Makefile.in (uninstall): Add missing "; \".
Tue Feb 2 18:21:23 1999 Stan Cox <scox@cygnus.com>
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 9781d7a..4883317 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -4713,11 +4713,46 @@ byte_xor_operation:
;; On i486, movl/sall appears slightly faster than leal, but the leal
;; is smaller - use leal for now unless the shift count is 1.
-(define_insn "ashlsi3"
+(define_expand "ashlsi3"
+ [(set (match_operand:SI 0 "nonimmediate_operand" "")
+ (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "")
+ (match_operand:SI 2 "nonmemory_operand" "")))]
+ ""
+ "")
+
+;; For regsiter destinations:
+;; add == 2 bytes, move == 2 bytes, shift == 3 bytes, lea == 7 bytes
+;;
+;; lea loses when optimizing for size
+;;
+;; Do the math. If the count is 1, using add, else using sal will
+;; produce the smallest possible code, even when the source and
+;; dest do not match. For a memory destination, sal is the only
+;; choice.
+;;
+;; Do not try to handle case where src and dest do not match. Let regmove
+;; and reload handle them. A mov followed by this insn will generate the
+;; desired size optimized results.
+(define_insn ""
+ [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
+ (ashift:SI (match_operand:SI 1 "nonimmediate_operand" "0")
+ (match_operand:SI 2 "nonmemory_operand" "cI")))]
+ "optimize_size"
+ "*
+{
+ if (REG_P (operands[0]) && operands[2] == const1_rtx)
+ return AS2 (add%L0,%0,%0);
+
+ if (REG_P (operands[2]))
+ return AS2 (sal%L0,%b2,%0);
+ return AS2 (sal%L0,%2,%0);
+}")
+
+(define_insn ""
[(set (match_operand:SI 0 "nonimmediate_operand" "=r,rm")
(ashift:SI (match_operand:SI 1 "nonimmediate_operand" "r,0")
(match_operand:SI 2 "nonmemory_operand" "M,cI")))]
- ""
+ "! optimize_size"
"*
{
if (REG_P (operands[0]) && REGNO (operands[0]) != REGNO (operands[1]))