IBM will sell the semiconductor technologies unit that makes its Power processors to GlobalFoundries, paying the chip manufacturer about $1.3 billion to take two factories off its hands in a move to save money.

Like many old-school tech companies IBM has struggled to find its feet in a world where mobile devices and cloud services are becoming increasingly important. The company is under pressure to cut costs as well as find ways to halt falling revenues.

The deal with GlobalFoundries and the sale of its server business to Lenovo falls into the first category. In a bid a to get a better foothold in the growing mobile enterprise sector, the company announced a partnership with Apple in July. As part of the deal IBM will develop iOS apps that integrate with its big data and analytics services and promote iPhones and iPads.

The last nine months have been a time of change for GlobalFoundries, as well. In January, it announced former Motorola Mobility boss Sanjay Jha had been appointed as the company’s new Chief Executive Officer, highlighting its growing interest in mobile devices.

Since then it has signed a licensing deal with Samsung on chipsets for mobile devices as well as deals on wearables and automotive. Together those three areas are expected to help propel growth over the next couple of year for GlobalFoundries and its competitors.

Under Monday’s deal, GlobalFoundries will take over IBM’s existing semiconductor manufacturing operations and facilities in East Fishkill, New York, and Essex Junction, Vermont, the companies said in a joint statement on Monday. GlobalFoundries is also getting “thousands of patents, making it the holder of one of the largest semiconductor patent portfolios in the world,” according to the statement.

The deal seems to have been in the works for some time, and isn’t surprising as the chip market has become increasingly competitive, making it difficult for IBM to keep up. Reports of a deal surfaced this summer, but it was never finalized due the price tag. IBM was offering $1 billion to take over the factories, but GlobalFoundries wanted $2 billion, according to a Bloomberg report.

IBM is now expected to pay GlobalFoundries $1.5 billion in cash over the next three years. That sum will be adjusted by the amount of working capital, estimated to be $200 million, according to the statement.

IBM will still invest $3 billion over five years in semiconductor technology research, the results of which GlobalFoundries will have “primary” access to.

GlobalFoundries will also provide employment opportunities for substantially all IBM employees at the two facilities who are part of the transferred businesses, except for a team of semiconductor server group employees who will remain with IBM. Exactly how many GlobalFoundries will hire wasn’t immediately clear.

As part of the deal, GlobalFoundries will become IBM’s exclusive server processor provider for 22 nanometer, 14nm and 10nm chipsets for the next 10 years. IBM sold its x86 servers to Lenovo, but kept System z mainframes, Power Systems and Power-based Flex servers.

GlobalFoundries is based in Silicon Valley and has about 13,000 employees. It is owned by Advanced Technology Investment Company (ATIC), which is a part of the Abu Dhabi government’s Mubadala Development investment arm.