public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: gcc-gnats@gcc.gnu.org
Subject: optimization/6585: useless memory store instructions on x86
Date: Mon, 06 May 2002 13:06:00 -0000	[thread overview]
Message-ID: <15574.57285.539469.467595@honolulu.ilog.fr> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3135 bytes --]


>Number:         6585
>Category:       optimization
>Synopsis:       useless memory store instructions on x86
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Mon May 06 13:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Bruno Haible
>Release:        3.1 20020423 (prerelease)
>Organization:
GNU hackers
>Environment:
System: Linux linuix 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/packages/gnu-snapshot --enable-shared --enable-version-specific-runtime-libs --enable-nls
>Description:

A case of a useless memory store and of a useless register spill.

=========================== mul.c ===============================
long long mul (long long a, long long b) {
  return a * b;
}
=================================================================

$ gcc -v
Lecture des spécification à partir de /packages/gnu-snapshot/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configuré avec: ../configure --prefix=/packages/gnu-snapshot --enable-shared --enable-version-specific-runtime-libs --enable-nls
Modèle de thread: single
version gcc 3.1 20020423 (prerelease)

$ gcc -O6 -fomit-frame-pointer -S mul.c
$ cat mul.s
        .file   "mul.c"
        .text
        .align 2
        .p2align 4,,15
.globl mul
        .type   mul,@function
mul:
        subl    $28, %esp
        movl    40(%esp), %ecx      b0
        movl    %ebx, 12(%esp)                        save %ebx
        movl    32(%esp), %ebx      a0
        movl    %ebp, 24(%esp)                        save %ebp
        movl    44(%esp), %ebp      b1
        movl    %ebx, %eax          a0
        mull    %ecx                %edx:%eax := a0*b0
        movl    %edi, 20(%esp)                        save %edi
        movl    36(%esp), %edi      a1
        movl    %esi, 16(%esp)                        save %esi USELESS!
        movl    16(%esp), %esi                        restore %esi USELESS!
        imull   %edi, %ecx          a1*b0
        movl    %eax, (%esp)
        movl    20(%esp), %edi                        restore %edi
        movl    %ebx, %eax          a0
        movl    %edx, 4(%esp)                         USELESS!
        imull   %ebp, %eax          a0*b1
        movl    12(%esp), %ebx                        restore %ebx
        movl    24(%esp), %ebp                        restore %ebp
        addl    %eax, %edx          hi+a0*b1
        movl    (%esp), %eax        lo
        movl    %edx, 4(%esp)       hi+a0*b1          ! Could be simplified
        addl    %ecx, 4(%esp)       hi+a0*b1+a1*b0    ! to a single insn:
        movl    4(%esp), %edx                         ! addl %ecx, $edx
        addl    $28, %esp
        ret
.Lfe1:
        .size   mul,.Lfe1-mul
        .ident  "GCC: (GNU) 3.1 20020423 (prerelease)"

>How-To-Repeat:

gcc -O6 -fomit-frame-pointer -S mul.c

>Fix:

more optimizations
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-05-06 20:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-06 13:06 Bruno Haible [this message]
2003-03-15  4:58 bangerth
2003-04-23 12:56 Bruno Haible
2003-04-23 14:05 bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15574.57285.539469.467595@honolulu.ilog.fr \
    --to=bruno@clisp.org \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).