This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/44382] Slow integer multiply



------- Comment #2 from hjl dot tools at gmail dot com  2010-06-04 13:08 -------
(In reply to comment #1)
> Because our tree reassoc doesn't re-associate them.
> 

The tree reassoc pass makes it slower:

[hjl@gnu-6 44382]$ cat x.i
extern int a, b, c, d, e, f;
void
foo ()
{
  a = (b * c) * (d * e);
}
[hjl@gnu-6 44382]$ gcc -S -O2 x.i
[hjl@gnu-6 44382]$ cat x.s
        .file   "x.i"
        .text
        .p2align 4,,15
.globl foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        movl    c(%rip), %eax
        imull   b(%rip), %eax
        imull   d(%rip), %eax
        imull   e(%rip), %eax
        movl    %eax, a(%rip)
        ret
[hjl@gnu-6 44382]$ gcc -S -O2 x.i -fno-tree-reassoc
[hjl@gnu-6 44382]$ cat x.s
        .file   "x.i"
        .text
        .p2align 4,,15
.globl foo
        .type   foo, @function
foo:
.LFB0:
        .cfi_startproc
        movl    b(%rip), %eax
        movl    d(%rip), %edx
        imull   c(%rip), %eax
        imull   e(%rip), %edx
        imull   %edx, %eax
        movl    %eax, a(%rip)
        ret
[hjl@gnu-6 44382]$ 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44382


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]