The last five years have been very good for Advanced Micro Devices (AMD 1.90%). Case in point: An investment of $10,000 in AMD made in April 2017 would now be worth $75,600.

That said, 2022 has been a dud. Shares are down 35% year-to-date as investors have soured on the technology sector. Nevertheless, there are still reasons to remain optimistic about AMD's prospects. Here are two reasons to buy now and one reason to steer clear. 

An engineer works with semiconductors and microchips.

Image source: Getty Images.

Margins are growing

Operating margin is a key piece of financial data to review when considering a stock investment because it tells you how efficient a company is at turning sales into profits. 

Chart showing AMD's operating margin rising since 2018, and its price dropping since 2021.

AMD data by YCharts

As you can see from the chart above, AMD's operating margins have been climbing steadily over the last five years -- along with its stock price. Because of increasing demand for AMD's graphics processing units (GPUs), operating margins over the previous 12 months have grown and now stand at 22.2%. GPUs are found in everything from mobile phones to gaming consoles and help render computer graphics and high-quality images at blazing speeds. As demand for AMD's products has surged, the company has been able to raise prices, leading to wider margins.

AMD is investing in innovation

As revenues and operating margins have increased, AMD has reinvested in its future. The company has boosted its annual research and development (R&D) expenses to $2.9 billion. At first blush, this might seem like an over-investment. After all, R&D expenses were less than $2.0 billion as recently as 2020.

However, context is key. When viewed as a percentage of revenues, a different picture emerges. R&D expenses are only 17.3% of 2021 revenues, down from 22.8% in 2020.

Chart showing AMD's R&D expenses rising, and R&D to revenue falling, since 2018.

AMD Research and Development Expense (Annual) data by YCharts

Innovation is critical in a competitive market, such as the one for microprocessors. AMD's solid financial standing today has led to rising investment in research and development and should pay off in future years.

One reason to hesitate: An oversupply of chips?

AMD is a well-run company. However, the semiconductor sector has long been considered a cyclical industry, with periods of booming demand followed by stretches of excess supply. Some argue that's changing and that the economy is now so reliant on semiconductors that demand is unlikely to taper off, but I'm skeptical. Some Wall Street analysts think equilibrium might arrive in the chip market as soon as 2023, followed quickly after that by a surplus. Such conditions would pressure AMD to cut prices and reduce their margins. 

However, if you're an investor willing to stomach what could be a volatile few years, AMD still looks attractive. Its margins are solid, and its investment in research and development should pay off in the long run.