Summary: | __builtin_pow[i] - vectorize for other exponents besides 2 and 0.5 | ||
---|---|---|---|
Product: | gcc | Reporter: | Tobias Burnus <burnus> |
Component: | tree-optimization | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | NEW --- | ||
Severity: | normal | CC: | egallager, gcc-bugs, jb, rguenth |
Priority: | P3 | Keywords: | missed-optimization |
Version: | 4.3.0 | ||
Target Milestone: | --- | ||
See Also: | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32239 | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2019-06-03 00:00:00 | |
Bug Depends on: | |||
Bug Blocks: | 53947 |
Description
Tobias Burnus
2007-06-25 19:51:00 UTC
> Additionally: It would be great if there would be a variant for long integers
> (8 byte integers) and long long (16 byte integers) as PR32239 could only use
> __builtin_powi for int4 and not for int8 or int16.
Actually, gfortran uses also: pow(integer,integer) and pow(complex,integer), which could also profit from a middle/back-end support. (integer: 4, 8, 16 bytes; complex: single, double, long double precision).
Confirmed. I had done tree-level expansion of powi into add/mul sequences at one time. But this had been rejected for some reason I cannot remember right now. (In reply to comment #2) > Confirmed. I had done tree-level expansion of powi into add/mul sequences at > one time. But this had been rejected for some reason I cannot remember right > now. The middle-end is able to expand builtin_powi for constant integers. The problem with vectorization is that the vectorizer runs before the pow(i) expansion, and the vectorizer is only aware of exponenets 2 and 0.5. Expanding in the FE works around that problem. In fact, it seems the FE expander is lifted from the ME. (In reply to Richard Biener from comment #2) > Confirmed. I had done tree-level expansion of powi into add/mul sequences at > one time. But this had been rejected for some reason I cannot remember > right now. Do you at least remember when that time was, so we can know where to go looking in the archives? (In reply to Eric Gallager from comment #4) > (In reply to Richard Biener from comment #2) > > Confirmed. I had done tree-level expansion of powi into add/mul sequences at > > one time. But this had been rejected for some reason I cannot remember > > right now. > > Do you at least remember when that time was, so we can know where to go > looking in the archives? See the followup comment. We now do this expansion but it is too late for vectorization. The vectorizer knows how to handle pow of a constant via exp[2] which have vectorized variants. It also knows square-root and square but doesn't try anything more fancy. See vect_recog_pow_pattern. |