When Berkshire Hathaway (BRK.A 0.64%) (BRK.B 0.54%) makes a move, investors often follow. That's why, when news broke this month that Warren Buffett's company dumped most (about 86%) of its holdings in Taiwan Semiconductor Manufacturing (TSM -4.86%), the tech stock's price fell on the news. It's a bit of a surprise move, given that it was only the previous quarter that Berkshire acquired the stock.

Has something happened to make Taiwan Semiconductor Manufacturing, better known as TSMC, a worse buy recently, and should investors follow suit and sell the stock as well?

The company is coming off a strong quarter

The biggest news to come out between the time Berkshire bought and sold shares of TSMC was the release of the company's fourth-quarter financials in January, which covered the last three months of 2022. And those figures were by no means bad.

In Q4, TSMC's revenue totaled just under $20 billion and was up 27% year over year. Although that's not as high as the growth rate has been in the past, it's still better than what it has averaged over the past five years:

Chart showing Taiwan Semiconductor's quarterly year-over-year revenue growth down from its high in 2020.

TSM Revenue (Quarterly YoY Growth) data by YCharts

This comes even as the company says there has been "end market demand softness," which it expects to continue to affect the current quarter, where revenue will be between $16.7 billion and $17.5 billion.

But for long-term investors like Buffett, the near term is irrelevant when buying a stock for the long haul. Demand may be down now as businesses and individuals scale back expenditures due to inflation, but it won't stay that way for long. According to Fortune Business Insights, the global semiconductor market will grow at a compounded annual growth rate of 12.2% until 2029. And as a top chipmaker in the world, owning a more than 50% market share, TSMC should be able to benefit and profit from those opportunities.

If the business isn't doing worse, why did Berkshire sell?

Although Buffett preaches long-term investing, that has typically applied to the businesses he buys rather than stocks, which Berkshire often buys and holds at varying durations. The decision to sell TSMC stock could be a sign that management simply changed its mind on how much of the business to hold. Berkshire, after all, doesn't typically invest in tech stocks to begin with (although Apple is its largest holding, I'd argue that Apple has evolved into a safer consumer goods business over the years), and so this type of investment was a bit out in left field.

There's no definitive answer as to why Buffett's company sold most of its stake in TSMC. But nothing has changed drastically over the past three months that would have altered the outlook for the business. Buffett always advises investors to stay within their circle of competence, and it may be that after a more careful analysis, Berkshire didn't think owning more than $4 billion in a semiconductor company fell within its comfort zone.

Should you sell TSMC stock as well?

TSMC stock struggled in the past year, as have other tech stocks. But over the past five years, it has doubled in value. And with more growth on the horizon, it could make for a good long-term investment. Trading at 14 times its trailing earnings, the stock is also a relatively cheap buy -- in comparison, the S&P 500 averages a multiple of 18.

If you're comfortable with the tech industry and are bullish on TSMC's prospects, you should hang on to the stock or buy it if you don't own it. In the end, it's always better to do your own analysis as opposed to just following someone else's moves, as not every stock is suitable for every type of investor.