IBM rides software revenue to Q2 profit