From: Jeffrey A Law Date: Tue, 2 Feb 1999 19:06:58 +0000 (+0000) Subject: i386.md (ashlsi3): Turn into a define_expand an anonymous pattern. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47f59fd4d5e519288bb76e02f4a2a0f7d2d62572;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5837037eb8f..4382b7cde96 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -6,6 +6,10 @@ Tue Feb 2 20:29:34 1999 Catherine Moore 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 diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 9781d7aeb02..48833170834 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]))