SPRUI04F july 2015 – april 2023
advice #30005: Loop at line 5 cannot be scheduled efficiently, as it
contains a "division" operation. Rewrite using simpler
operations if possible.
The compiler can insert calls to special functions in the run-time support library (RTS) to support operations that are not natively supported by the ISA. For example, the compiler calls __c6xabi_divi() function to perform 32-bit integer divide operation. Such functions are called compiler helper functions, and result in a function call within the loop body. In the example below, the compiler will accomplish the division operation by calling the compiler helper function "_divi" :
void func(float *p, float n)
{
int i;
for (i = 1; i < 1000; i++) {
p[i] /= n;
}
}
However if we modify this loop, like below, the loop pipelines :
void func_adjusted(float *p, float n)
{
int i;
float inv = 1/n;
for (i = 1; i < 1000; i++) {
p[i] *= inv;
}
}