Warren Buffett's conglomerate has increased its stake in Apple — and gotten rid of almost its entire IBM stake — a big move for a legendary investor who rarely bets on tech.

Berkshire Hathaway revealed Wednesday that it increased its Apple holdings by 23.3 percent to 165.3 million shares, according to SEC filings, and dumped about 94.5 percent of its IBM holdings, leaving just 2.05 million shares.

Last year, Buffett told CNBC that he was more sure about Apple's future than IBM's, and that he has continued to put his money where his mouth is (even if he still carries a flip phone).

In November, Berkshire reported that it cut its IBM stake by 32 percent, and upped its Apple stake. Before Wednesday's revelation, Berkshire was already the fourth-largest Apple shareholder, according to FactSet.

"IBM is a big strong company, but they've got big strong competitors too," Buffett told CNBC last year.

Still, Berkshire's latest announcement comes at an interesting time for both Apple and IBM.

Rivals in the 1980s, IBM and Apple have taken very different paths over the years: IBM has struggled with trends in enterprise technology, while Apple has become a dominant force in consumer electronics.

But Big Blue revenue grew in January for the first time in 23 quarters, perhaps a sign that the company's pivot to analytics, cloud, mobile and security has taken hold. Wall Street-darling Apple, meanwhile, has faced an unusual level of criticism, amid product issues like production delays, security patches and battery replacements.

IBM told CNBC that it doesn't comment on specific shareholders, but the company is "very focused on delivering shareholder value."

"That's why we have shifted our investment strategy to drive leadership in the key, high-value segments valued by our clients, including Cloud, AI, security, blockchain and quantum technologies," IBM said.

