The strip mine of a loop with a tile of 64 can be obtained with a scattering function as proposed by Tobias:
$ cat ./tobias_strip_mine.cloog
# language: C
c
# parameter {n | n >= 0}
1 3
# n 1
1 1 0
1
n
1 # Number of statements:
1
# {i | 0 <= i <= n}
2 4
# i n 1
1 1 0 0
1 -1 1 0
0 0 0
1
i
1 # Scattering functions
4 7
# NEW OLD LV1 i n 1
0 0 1 0 -1 0 0
1 -1 1 0 0 0 0
1 1 -1 0 0 0 63
0 1 0 -64 0 0 0
# LV1 is a "local variable" that is used to say that
# "the NEW loop is an integer multiple of 64",
# i.e. last row of the scattering function
1
NEW OLD LV1the output of CLooG is like this:
$ cloog -strides 1 ./tobias_strip_mine.cloog
/* Generated from ./strip_mine.cloog by CLooG 0.15 64 bits in 0.01s. */
for (NEW=0;NEW<=n;NEW+=64) {
for (OLD=NEW;OLD<=min(NEW+63,n);OLD++) {
S1(i = OLD) ;
}
}An alternative proposed by Albert is like this:
$ cat ./albert_strip_mine.cloog
# language: C
c
# parameter {n | n >= 0}
1 3
# n 1
1 1 0
1
n
1 # Number of statements:
1
# {i | 0 <= i <= n}
2 4
# i n 1
1 1 0 0
1 -1 1 0
0 0 0
1
i
1 # Scattering functions
3 6
# NEW OLD i n 1
1 -64 0 1 0 0
1 64 0 -1 0 63
0 0 1 -1 0 0
1
NEW OLDthe output of CLooG is like this:
cloog ./albert_strip_mine.cloog
/* Generated from ./albert_strip_mine.cloog by CLooG 0.15 64 bits in 0.01s. */
for (NEW=0;NEW<=floord(n,64);NEW++) {
for (OLD=max(64*NEW,0);OLD<=min(64*NEW+63,n);OLD++) {
S1(i = OLD) ;
}
}