A tool for generating tight data permutation loops with advanced spatial and temporal locality optimizations