------- 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: [...@gnu-6 44382]$ cat x.i extern int a, b, c, d, e, f; void foo () { a = (b * c) * (d * e); } [...@gnu-6 44382]$ gcc -S -O2 x.i [...@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 [...@gnu-6 44382]$ gcc -S -O2 x.i -fno-tree-reassoc [...@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 [...@gnu-6 44382]$ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44382