public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug rtl-optimization/44214] New: Compiler does not optimize vector divide with -freciprocal-math (or -ffast-math) @ 2010-05-20 17:49 meissner at gcc dot gnu dot org 2010-05-20 18:00 ` [Bug rtl-optimization/44214] " meissner at gcc dot gnu dot org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: meissner at gcc dot gnu dot org @ 2010-05-20 17:49 UTC (permalink / raw) To: gcc-bugs If you have code that does division by a constant that can be auto vectorized by the compiler, the compiler does not convert the division to multiplication by the reciprocal if -freciprocal-math (or -ffast-math), but instead does the division. The bug is in fold-const.c near line 11254, where the code for handling REAL_CST should be cloned to handle VECTOR_CST (and presumably COMPLEX_CST also). -- Summary: Compiler does not optimize vector divide with - freciprocal-math (or -ffast-math) Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: meissner at gcc dot gnu dot org GCC build triplet: powerpc64-unknown-linux-gnu GCC host triplet: powerpc64-unknown-linux-gnu GCC target triplet: powerpc64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44214 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/44214] Compiler does not optimize vector divide with -freciprocal-math (or -ffast-math) 2010-05-20 17:49 [Bug rtl-optimization/44214] New: Compiler does not optimize vector divide with -freciprocal-math (or -ffast-math) meissner at gcc dot gnu dot org @ 2010-05-20 18:00 ` meissner at gcc dot gnu dot org 2010-05-20 18:02 ` meissner at gcc dot gnu dot org 2010-05-21 9:48 ` rguenth at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: meissner at gcc dot gnu dot org @ 2010-05-20 18:00 UTC (permalink / raw) To: gcc-bugs ------- Comment #1 from meissner at gcc dot gnu dot org 2010-05-20 18:00 ------- Actually in looking at it further, I was wrong in the initial claim. Auto vectorization now handles division by a constant. Explicit vectors like PowerPC (and probably SPU) do show the problem. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44214 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/44214] Compiler does not optimize vector divide with -freciprocal-math (or -ffast-math) 2010-05-20 17:49 [Bug rtl-optimization/44214] New: Compiler does not optimize vector divide with -freciprocal-math (or -ffast-math) meissner at gcc dot gnu dot org 2010-05-20 18:00 ` [Bug rtl-optimization/44214] " meissner at gcc dot gnu dot org @ 2010-05-20 18:02 ` meissner at gcc dot gnu dot org 2010-05-21 9:48 ` rguenth at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: meissner at gcc dot gnu dot org @ 2010-05-20 18:02 UTC (permalink / raw) To: gcc-bugs ------- Comment #2 from meissner at gcc dot gnu dot org 2010-05-20 18:02 ------- Created an attachment (id=20712) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20712&action=view) Example program that shows the issue on powerpc. Compile with -mcpu=power7 on powerpc. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44214 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug rtl-optimization/44214] Compiler does not optimize vector divide with -freciprocal-math (or -ffast-math) 2010-05-20 17:49 [Bug rtl-optimization/44214] New: Compiler does not optimize vector divide with -freciprocal-math (or -ffast-math) meissner at gcc dot gnu dot org 2010-05-20 18:00 ` [Bug rtl-optimization/44214] " meissner at gcc dot gnu dot org 2010-05-20 18:02 ` meissner at gcc dot gnu dot org @ 2010-05-21 9:48 ` rguenth at gcc dot gnu dot org 2 siblings, 0 replies; 4+ messages in thread From: rguenth at gcc dot gnu dot org @ 2010-05-21 9:48 UTC (permalink / raw) To: gcc-bugs ------- Comment #3 from rguenth at gcc dot gnu dot org 2010-05-21 09:47 ------- The fold code should probably simply use fold_binary to do the constant folding (which already should handle 1/x for x vector and complex. There is a build_one_cst to build the constant 1 for any type). The exact result check would need to use mpc (and I'm not sure its correct for -frounding-math anyway). -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2010-05-21 09:47:56 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44214 ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-05-21 9:48 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-05-20 17:49 [Bug rtl-optimization/44214] New: Compiler does not optimize vector divide with -freciprocal-math (or -ffast-math) meissner at gcc dot gnu dot org 2010-05-20 18:00 ` [Bug rtl-optimization/44214] " meissner at gcc dot gnu dot org 2010-05-20 18:02 ` meissner at gcc dot gnu dot org 2010-05-21 9:48 ` rguenth at gcc dot gnu dot org
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).