Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

LOOP COUNT

General Compiler Directive: Specifies the iterations (typical trip count) for a DO loop.

!DIR$ LOOP COUNT (n1[, n2]...)

!DIR$ LOOP COUNT= n1[, n2]...

!DIR$ LOOP COUNT qualifier(n)[, qualifier(n)]...

!DIR$ LOOP COUNT qualifier=n[, qualifier=n]...

n1, n2

Is a non-negative integer constant. It indicates that the next DO loop will iterate n1, n2, or some other number of times.

qualifier

Is one or more of the following:

  • MAX - specifies the maximum loop trip count.

  • MIN - specifies the minimum loop trip count.

  • AVG - specifies the average loop trip count.

The value of the loop count affects heuristics used in software pipelining, vectorization, and loop-transformations.

There is no check at runtime to determine if the MAX or MIN values are exceeded.

Example

Consider the following:

!DIR$ LOOP COUNT (10000)
do i =1,m 
b(i) = a(i) +1 ! This is likely to enable the loop to get software-pipelined 
enddo

Note that you can specify more than one LOOP COUNT directive for a DO loop. For example, the following directives are valid:

!DIR$ LOOP COUNT (10, 20, 30) 
!DIR$ LOOP COUNT MAX=100, MIN=3, AVG=17 
DO 
...