[Patch, fortran] PR32239 Use builtin_powi

Janne Blomqvist blomqvist.janne@gmail.com
Sun Jun 17 11:39:00 GMT 2007


:ADDPATCH fortran:

Hi,

the attached patch changes gfortran to use builtin_powi for real**int4 
powers. This enables potentially better optimization, as the middle-end 
is not aware of the inner workings of __gfortran_pow_rn_i4. However, 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). So I left that part alone 
for now, i.e. builtin_powi is used only for real**int4 when int4 is 
non-constant. Also, it unfortunately seems the middle-end is not able to 
do the sort of optimization suggested in the PR, but perhaps some day.

So I guess at the moment this is mostly a library bloat reduction patch, 
with some potential for better optimization in the future.

-- 
Janne Blomqvist
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ChangeLog
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070617/32f89ee4/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: builtin-powi.diff
Type: text/x-patch
Size: 3173 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070617/32f89ee4/attachment.bin>


More information about the Fortran mailing list