It seems...(from a single trivial check of the asm output) that gcc does it.
But that may not be the case for more complicated code.