http://gcc.gnu.org/ml/gcc-patches/2007-06/msg01172.html (PR 32239):
"At the moment the vectorizer only vectorizes builtin_pow if the exponent is
either 2 or 0.5. whereas if we expand constant exponents in the gfortran
frontend (gfc_conv_cst_int_power) it vectorizes for other constant integer
powers as well (the expansion by the frontend generates a number of calls to
builtin_pow with exponent 2.0)."
Expected: The same optimization is done for multiple of 2 (and -2) - as it is
currently in the Fortran FE. (If this has been implemented in the ME, please
inform the Fortraners to remove the expansion there.)
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.
--
Summary: __builtin_powi - optimize for other exponents besides 2
and 0.5
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32503