Renormalization of exponential sums and matrix cocycles