It wasn't much of a month for the broad market. In fact, the S&P 500 only advanced by a quarter of a percentage point in May.

For a handful of technology stocks, however, May was a bullish blowout. Several of them even dished out strong double-digit gains.

And that's a conundrum. Investors love stocks that are capable of climbing. But they don't necessarily love paying a steep price for these stocks following big rallies. Are the S&P 500's biggest winners from last month still worth buying at their newly inflated price? Keep reading.

Best of the best

The S&P 500's best-performing stocks in May are Nvidia (NVDA 2.49%), Advanced Micro Devices (AMD -1.41%), and Broadcom (AVGO -1.26%), up 36.5%, 32.3%, and 28.9% respectively. Clearly the semiconductor industry had a moment, bouncing back -- in spades -- from a lethargic April.

^SPX Chart

^SPX data by YCharts

Thank Nvidia, mostly. It's the pacesetter for the group, and its stock was catapulted late in the month by the company's fiscal first-quarter results. Overall sales were up 19% year over year, lifted by strong growth of its data center business; you know it better as artificial intelligence (AI). Indeed, accounting for nearly $4.3 billion of last quarter's total top line of $7.2 billion, AI is now easily the company's biggest breadwinner.

Of course, the artificial intelligence tailwind was already blowing before Nvidia released last quarter's results, pushing most chipmakers' stocks higher early on in the month.

The question remains, however, can you still buy these red-hot stocks at their current price, or have they already raced out of reach?

In simplest terms, yes, you can still buy these stocks.

Being in the right business is half the battle

Although trying to time the market is typically a bad idea, this is a case where it makes sense to hold off a bit and see if these stocks' current lulls shave off any more of their current prices. Gains of this size reaped in just a few weeks are tough to hold on to!

On the flip side, don't be penny-wise and pound-foolish.

The semiconductor industry certainly has its ups and downs. But, it's got more ups than downs -- we're never not going to need microchips. In fact, we're going to need more and more of them in the near future. While this year's apt to be lackluster, the Semiconductor Industry Association suggests total demand for chips will grow more than 50% from 2020's levels by 2030.

Nvidia seems to be leading the charge, too. Its revenue is projected to grow nearly 60% this year despite the broad chip headwind, followed by more than 27% sales growth next year. Earnings are set to grow at an even faster clip.

The Semiconductor Industry Association further believes the automobile industry will eventually account for 20% of worldwide chip demand. Cars aren't a huge part of Nvidia's revenue mix right now, making up less than 5% of last quarter's top line. It's an encouraging outlook for Nvidia all the same, setting the stage for a new growth vehicle once the artificial intelligence market finally slows down.

In the meantime, technology market research IDC says investments in artificial intelligence systems will grow by an annual average of 27% through 2026, when this spending should eclipse $300 billion. It's a movement that plays right into the strong AI hand Nvidia is already holding.

Broadcom and AMD may not turn as many heads as Nvidia does these days, especially now that Nvidia has joined the trillion-dollar valuation club. All three of these tickers are riding the same bullish wave, though. There's a bullish case to be made for each, even if Nvidia is the proverbial pick of the litter.

Just bear in mind that common-sense diversification rules still apply -- you'll probably only want to add one of these names to your portfolio.

The main thing is to keep the main thing the main thing

This won't always be the case. Sometimes, one month's biggest winners are the next month's most pronounced laggards.

In all cases, though, a company's long-term potential trumps any and all considerations of a stock's short-term action. If you wanted to buy Advanced Micro Devices, Broadcom, or Nvidia a month ago, you should still want to own them even at their present price. If you didn't like any of the companies when their stocks were floundering earlier in the year, nothing's changed about their businesses just because their corresponding stocks are soaring. If your stance on owning any of these three companies for the long haul changed last month, you may be chasing performance more than you're investing.

Mostly though, know that there's no reason not to buy any of these S&P 500 constituents now even if they rocketed higher in May. Investing remains a game ultimately won by people with a long-term mindset.