A global chip shortage has helped send sales of semiconductors and related components through the roof, sending the stock prices of companies that design and sell chips skyrocketing, too. AMD (AMD -0.29%) and NVIDIA (NVDA 0.35%) are two of the hottest names in this space, and shares of the companies are up a respective 78% and 174% since the start of 2020. 

These two companies are expected to continue growing at breakneck speeds for the rest of 2021. AMD and NVIDIA thus both deserve consideration for your portfolio if you're planning on buying and holding for at least a few years -- the longer the better -- and if you can tolerate some wild swings in price. But one looks like the better long-term purchase. 

Two technicians working on semiconductors.

Image source: Getty Images.

An all-purpose chip upstart making waves

AMD has been making a comeback for years with a fast-improving lineup of chips addressing the laptop and PC markets, as well as hardware for data centers and the cloud computing services built on them. Its battle has been primarily with Chipzilla, Intel (INTC), which made over half of its nearly $78 billion in trailing-12-month sales from PCs and related hardware. AMD is tiny in comparison, with sales of just $11.4 billion over that same span of time. But a 70% surge in revenue over the last year (compared to Intel's 8% rise in revenue) implies AMD is scooping up lots of new market share at the expense of its larger peer.

AMD's plan of attack has centered around its suite of affordable CPUs (central processing units), GPUs (graphics processing units), and other processors for personal computing and enterprise data centers. But it's adding a new chip type to its arsenal, FPGAs (field programmable gate arrays), used in everything from data centers to networking to industrial equipment. AMD is getting into this space with the acquisition of FPGA leader Xilinx, and will test the mettle of Intel's FPGA business, which Intel acquired via two smaller peers: Altera and Omnitek.

AMD expects its revenue to increase 50% this year, but the real story here is its expanding profit margin. Historically, AMD has lagged behind many of its peers as far as profitability goes. But as it increases its market share and chip technology, it's making serious headway. Operating margin was 16% through the last 12-month stretch, compared to less than 10% at the onset of 2020 just a year and a half ago. Adding Xilinx to the mix should help AMD make further advances on this front. 

Given its fast-growing sales and even faster-growing bottom line, AMD is reasonably priced at 38 times full-year expected earnings per share. Semiconductors and tech components follow a cyclical business model (sales ebb and flow with customer demand, which tends to revolve around new product launches and new tech capabilities), so don't expect sales to continue their torrid double-digit percentage pace for forever. But given its current momentum, AMD looks like a buy to me as the chip shortage keeps sales churning higher. 

A leader in AI and high-tech advancement

NVIDIA got its start designing GPUs to enable high-end video game graphics, but it too has been chipping away at Intel's lead -- specifically in data centers. Intel's "data center group" quarterly revenue was nearly as much as NVIDIA's total income in the first quarter of 2021. But like AMD, NVIDIA is stealing away market share. Its revenue is up 47% over the trailing 12 months.

The company is quickly becoming more than just a semiconductor industry leader -- it's also a leading research and development company in high tech. In fact, spending on research and development was at 22.5% of sales over the last year, one of the highest rates among tech giants. NVIDIA aspires to lead the way in artificial intelligence, and its GPUs are well-suited to the task, in data centers, but also in personal devices as well. And in spite of its heavy spending, NVIDIA's operating margin was a very healthy 29% over the last one-year stretch. 

AI requires crunching massive amounts of data, and this is an intense computing process that stretches the limits of CPUs. A GPU, by contrast, can accelerate the process many times over, all the while consuming less power than older CPU designs. Thus, many data center operators are adding NVIDIA GPUs to the mix, or outright replacing old hardware with new NVIDIA systems. Paired with its gaming business, this pushed NVIDIA's sales 84% higher in Q1. The company doesn't provide full-year guidance, but said to expect Q2 revenue to increase another 63% year-over-year in Q2

NVIDIA trades for 41 times full-year expected earnings per share. It's a steep price tag, but NVIDIA is helping build a more efficient world with AI, applying it to all sorts of areas from vehicle safety and autonomy to healthcare research to cloud computing. For those looking at the long-term potential, NVIDIA is a great stock to own as it goes from GPU specialist to full-blown tech platform for the future of computing.  

Which is the better buy?

AMD is the cheaper stock right now, especially considering its rapidly rising bottom line as years of investment finally start to pay off. AMD is certainly worthy of a buy in my book as it reaps the rewards from the global chip shortage.

However, I think NVIDIA is the better long-term investment. This is a semiconductor business through and through, but it's expanding its reach beyond tech component design and helping its customers make new applications utilizing AI. With a hand in all areas of cutting-edge technology, NVIDIA has many years of high-growth potential ahead of it despite the cyclical nature of its semiconductor-based business.