public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/51890] New: vectorizer does not recognize intrinsic functions like sqrt
@ 2012-01-18  9:53 Heiko.Klein at gmx dot net
  2012-01-18 10:09 ` [Bug tree-optimization/51890] " rguenth at gcc dot gnu.org
  2012-01-18 13:28 ` Heiko.Klein at gmx dot net
  0 siblings, 2 replies; 3+ messages in thread
From: Heiko.Klein at gmx dot net @ 2012-01-18  9:53 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51890
           Summary: vectorizer does not recognize intrinsic functions like
                    sqrt
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: Heiko.Klein@gmx.net


Created attachment 26360
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26360
test code which does not vectorize properly

Compiling attached program with
gcc4.6.2/bin/gcc -std=c99 -O2 -mfpmath=sse -msse2 -lm -o test_novector 
test_novector.c -ftree-vectorize -ftree-vectorizer-verbose=2

results in the comment:
test_novector.c:8: note: not vectorized: loop contains function calls or data
references that cannot be analyzed

(older compilers, i.e. gcc4.4.3 just complain about data reference)


The only function call is sqrt(), but sqrt is an intrinsic vectorized function
(_mm_sqrt_pd) and can be easily vectorized. 


Due to missing vectorization, this code is 2x (4x with AVX) slower than
compiled with other compilers (tested against icc12).


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/51890] vectorizer does not recognize intrinsic functions like sqrt
  2012-01-18  9:53 [Bug tree-optimization/51890] New: vectorizer does not recognize intrinsic functions like sqrt Heiko.Klein at gmx dot net
@ 2012-01-18 10:09 ` rguenth at gcc dot gnu.org
  2012-01-18 13:28 ` Heiko.Klein at gmx dot net
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-18 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-18 10:06:07 UTC ---
You need to enable -fno-math-errno as sqrt may set errno which we cannot
vectorize.  Then the loop is vectorized (-ffast-math conveniently also
enables -fno-math-errno).


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/51890] vectorizer does not recognize intrinsic functions like sqrt
  2012-01-18  9:53 [Bug tree-optimization/51890] New: vectorizer does not recognize intrinsic functions like sqrt Heiko.Klein at gmx dot net
  2012-01-18 10:09 ` [Bug tree-optimization/51890] " rguenth at gcc dot gnu.org
@ 2012-01-18 13:28 ` Heiko.Klein at gmx dot net
  1 sibling, 0 replies; 3+ messages in thread
From: Heiko.Klein at gmx dot net @ 2012-01-18 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Heiko Klein <Heiko.Klein at gmx dot net> 2012-01-18 12:26:18 UTC ---
Thanks,

adding -fno-math-errno vectorizes the code and gives exactly the speedup as
with icc.

Heiko


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-18 12:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-18  9:53 [Bug tree-optimization/51890] New: vectorizer does not recognize intrinsic functions like sqrt Heiko.Klein at gmx dot net
2012-01-18 10:09 ` [Bug tree-optimization/51890] " rguenth at gcc dot gnu.org
2012-01-18 13:28 ` Heiko.Klein at gmx dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).