This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/61139] New: missed fma optimization
- From: "vincenzo.innocente at cern dot ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 10 May 2014 09:23:57 +0000
- Subject: [Bug tree-optimization/61139] New: missed fma optimization
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61139
Bug ID: 61139
Summary: missed fma optimization
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: vincenzo.innocente at cern dot ch
given the following code
void mirror( float & x, float w) {
x = w - (x-w);
}
void mirror2( float & x, float w) {
x = 2.f*w - x;
}
c++ -Ofast -Wall -S mirror.cc -mavx2; cat mirror.s
produces
__Z6mirrorRff:
LFB0:
vaddss %xmm0, %xmm0, %xmm0
vsubss (%rdi), %xmm0, %xmm0
vmovss %xmm0, (%rdi)
ret
__Z7mirror2Rff:
LFB1:
vaddss %xmm0, %xmm0, %xmm0
vsubss (%rdi), %xmm0, %xmm0
vmovss %xmm0, (%rdi)
ret
which is ok
while
c++ -std=c++11 -Ofast -Wall -S mirror.cc -mavx2 -mfma; cat mirror.s
__Z6mirrorRff:
LFB0:
vaddss %xmm0, %xmm0, %xmm0
vsubss (%rdi), %xmm0, %xmm0
vmovss %xmm0, (%rdi)
ret
__Z7mirror2Rff:
LFB1:
vmovss (%rdi), %xmm1
vfmsub132ss LC1(%rip), %xmm1, %xmm0
vmovss %xmm0, (%rdi)
ret
while I was expecting with Ofast to get the same code for both functions
(either fmsub or add,sub whatever best)