Profiling shows that gcc isn't recognising these as loop invariants, so we help it a little bit by explicitly storing them.