SoftBank has agreed to buy Silicon Valley-based chip startup Ampere Computing for $6.5 billion, part of the Japanese giant's broader push to become a top player in the artificial-intelligence field.