Taiwan Semiconductor Manufacturing Co Ltd (TSMC), the world's largest contract chipmaker, posted second-quarter profit largely in line with estimates on Thursday, amid sluggish demand from phone makers impacted by a Sino-U.S. trade spat.