From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26188 invoked by alias); 17 Mar 2004 12:10:33 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26168 invoked by uid 48); 17 Mar 2004 12:10:30 -0000 Date: Wed, 17 Mar 2004 12:10:00 -0000 Message-ID: <20040317121030.26166.qmail@sources.redhat.com> From: "bruno at clisp dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20020506130600.6585.bruno@clisp.org> References: <20020506130600.6585.bruno@clisp.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug optimization/6585] Redundant store/load instruction pairs on ix86 X-Bugzilla-Reason: CC X-SW-Source: 2004-03/txt/msg02086.txt.bz2 List-Id: ------- Additional Comments From bruno at clisp dot org 2004-03-17 12:10 ------- This result is much better, indeed. Still there is room for two more optimizations: 1) The final "movl %ebx, %edx" instruction could be removed if the preceding lea instruction would write its results into %edx, not into %ebx. 2) Storing a0 and a1 in temporary stack locations is useless since a0 and a1 already come from the stack, and data analysis could find out that they are read-only. Commented listing: mul: subl $20, %esp movl %esi, 12(%esp) ; save %esi movl 24(%esp), %eax a0 movl 32(%esp), %esi b0 movl 28(%esp), %ecx a1 movl %edi, 16(%esp) ; save %edi movl 36(%esp), %edi b1 movl %eax, (%esp) USELESS! Use 24(%esp) instead mull %esi %edx:%eax := a0*b0 movl %ecx, 4(%esp) USELESS! Use 28(%esp) instead movl %ebx, 8(%esp) ; save %ebx movl %eax, %ecx movl (%esp), %eax imull %eax, %edi a0*b1 movl 4(%esp), %eax imull %esi, %eax a1*b0 movl 12(%esp), %esi ; restore %esi leal (%edx,%edi), %edi hi+a0*b1 leal (%edi,%eax), %ebx hi+a0*b1+a1*b0 COULD BE SIMPLIFIED movl 16(%esp), %edi ; restore %edi movl %ecx, %eax lo movl %ebx, %edx USELESS! movl 8(%esp), %ebx ; restore %ebx addl $20, %esp ret -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6585