We can implement these similarly to DerivedToBase casts. We just have to walk the class hierarchy, sum the base offsets and subtract it from the current base offset of the pointer.
As a side-effect, this also changes the BaseToDerived casts to only emit one opcode instead of one per base cast.