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 tree-optimization/61139] New: missed fma optimization


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)


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