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>
;; 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]))