Hewlett-Packard Co. plans to cut 27,000 jobs as the growing popularity of smartphones, the iPad and other mobile devices makes it tougher for the company to sell personal computers.