U.S. stocks rose as optimism about the artificial-intelligence boom offset a rise in bond yields around the world.