Bug 21465 - autovectorisation conflicts with -ffast-math
Summary: autovectorisation conflicts with -ffast-math
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.1.0
: P2 enhancement
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
: 28524 (view as bug list)
Depends on:
Blocks: vectorizer
  Show dependency treegraph
 
Reported: 2005-05-09 10:27 UTC by Michael Cieslinski
Modified: 2016-08-27 22:45 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-02-05 21:36:44


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Cieslinski 2005-05-09 10:27:22 UTC
Consider the following short function:

    void Tst1(float* __restrict__ SrcP, float* __restrict__ DstP, int Len)
    {
        for (int x=0; x<Len; x++)
        {
            DstP[x] = SrcP[x] * SrcP[x];
        }
    }

If this function is compiled with:
    g++41 -O -S TstPow.cpp -ftree-vectorizer-verbose=5  -ftree-vectorize
it is vectorized, but if you compile with:
    g++41 -O -ffast-math -S TstPow.cpp -ftree-vectorizer-verbose=5
    -ftree-vectorize
it is not with the following output:

note: Vectorizing an unaligned access.
note: Alignment of access forced using peeling.
note: not vectorized: stmt not supported: D.2052_15 = __builtin_powf 
(D.2051_14, 2.0e+0)
note: vectorized 0 loops in function.


Michael Cieslinski
Comment 1 Andrew Pinski 2005-05-09 12:21:51 UTC
Confirmed.
Comment 2 Andrew Pinski 2006-07-28 10:51:30 UTC
*** Bug 28524 has been marked as a duplicate of this bug. ***
Comment 3 Richard Biener 2006-07-28 11:45:40 UTC
the vectorizer should recognize this particular case or we might want to
expand pow() again at the tree level before the vectorizer.
Comment 4 Paolo Bonzini 2008-07-22 15:48:25 UTC
i had a patch to expand pow at the tree level, but it conflicted with fold (which consistently tried to rebuild pow function calls).  the outcome might be better now that we have PAREN_EXPR, though.
Comment 5 Andrew Pinski 2016-08-27 22:45:41 UTC
Fixed for a while now.