Ab initio simulations of MgO under extreme conditions