Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

strength reduction optimizations

Izaak_Beekman
New Contributor II
505 Views

Is it reasonable to assume most modern compilers will see float**2 and replace it with float*float? I'm trying to improve the readability of someone else's code, without sacrificing performance, although I'm sure it's been quite some time since the code has been profiled on current hardware.

0 Kudos
2 Replies
Izaak_Beekman
New Contributor II
505 Views
just to clarify, the actual variable is a multidimensional array with a longer name, and is being indexed/sliced, so typing the equivalent of float*float is much longer than typing the exponentiation.
0 Kudos
TimP
Honored Contributor III
505 Views
Yes, all high quallty Fortran compilers I've seen in the last decade are expanding and optimizing **2 (some will do it even with the decimal point implying a real data type exponent). You could try a limited test, simply assure that no exponentiation function call is introduced when you run nm on the .o file.
0 Kudos
Reply