We have used a newly developed ab initio constant-pressure molecular dynamics technique to investigate the zero-temperature behaviour of MgSiO3 and CaSiO3 perovskites up to pressures which exceed the highest values reached within the Earth's mantle. Despite the similarities between these solids, we demonstrate that their behaviours at 150 GPa differ: whereas CaSiO3 prefers the cubic perovskite phase, MgSiO3 remains in the orthorhombically distorted perovskite (Pbnm) phase. Our theoretical strategy, besides in principle allowing finite-temperature simulations of solids under isotropic pressure, permits efficient and accurate determination of structural behaviour under arbitrary external pressures and/or stresses. This enabled us to offer reliable predictions for the elastic constants and shear modulus of MgSiO3 perovskite, and to provide an estimate of the bulk modulus and its pressure derivative for CaSiO3. Our calculations show that a Ca-enriched lower mantle would have a similar compressibility to a Ca-poor one.