Advances in artificial intelligence (AI) have led Wall Street to grow increasingly bullish on the industry. And that optimism is not unfounded as the AI market is projected to expand at a compound annual growth rate of 37% through 2030 after hitting $137 billion in 2022.

As a result, it's not a bad idea to take a closer look at some of the companies moving the industry forward. Advanced Micro Devices (AMD -2.52%) and Microsoft (MSFT 1.20%) are two particularly attractive investment options as both companies have made AI a larger focus of their businesses. One of these companies looks likely to play a significant role in the hardware side of the market, while the other has made considerable investments in AI software. 

An argument can easily be made for investing in AMD or Microsoft. However, if you're only looking to add one new stock to your list of holdings, you'll need to know the better buy. So let's assess whether you're better off investing in AMD or Microsoft stock. 

AMD

AMD started the year at a disadvantage, with its biggest competitor Nvidia taking the lead in AI chips. However, the company has since put all of its efforts toward gearing up, and experts have taken notice. AMD shares have skyrocketed 92% since Jan. 1 in response. Meanwhile, other tech companies have shown interest in partnering with the semiconductor company.

A Bloomberg report from May 4 revealed Microsoft is supporting AMD's AI chip expansion by providing financial and engineering resources. The Windows company aims to help AMD become an alternative to Nvidia. Additionally, Amazon Web Services (AWS) is reportedly considering using AMD's AI chips in the near future. The partnership would be particularly promising as AWS is the world's largest cloud platform and has previously used mainly Nvidia chips.

AMD Chart

Data by YCharts

The chart above shows that AMD shares have soared 660% in the last five years, more than most other companies that have joined the AI race. Meanwhile, the company's ability to provide chips to the entire tech market makes its stock an exciting option as investors can profit from growing industries like AI, cloud computing, gaming, PCs, and more. 

Microsoft

Investors have rallied over Microsoft this week, pushing its stock up over 3% on June 15 after the company announced that its annual AI revenue could hit $10 billion. The boosted earnings are expected to come from Azure growth and models built using ChatGPT developer OpenAI's technology. 

Microsoft has become one of the biggest names in AI after investing $1 billion in OpenAI in 2019. The success of ChatGPT in 2022 prompted the company to invest a further $10 billion this year and begin integrating the start-up's technologies across its homegrown platforms. So far, Microsoft has added AI services to its Office productivity programs like Word and Excel, its cloud service Azure, and its search engine Bing as it strives to become the go-to for consumers and businesses seeking AI services.

The company's partnership with OpenAI has given it a massive advantage against competitors like AWS and Alphabet's Google Cloud, which are now playing catch-up with Microsoft. Meanwhile, a collaboration with AMD could allow it to attain chips tailored to its AI services, giving it another edge over peers. 

With a business that has seen annual revenue rise 80% since 2018 and operating income climb 138%, Microsoft's stock is an increasingly attractive investment. 

Is AMD or Microsoft the better buy?

AMD and Microsoft are both home to solid growth stocks with a history of consistent gains. As a result, determining which is the better buy comes down at least in part to which stock is currently trading at a better value.

Looking at these companies' forward price-to-earnings ratios (P/E), Microsoft's 36 is preferable to AMD's 45. Neither figure indicates a bargain buy. However, Microsoft's lower forward P/E suggests its stock offers more value. Moreover, Microsoft's price-to-free cash flow of 45 is once again in a better position than AMD's 80. The figures show that Microsoft is a better value and potentially in better financial standing. 

Consequently, Microsoft is currently the better buy. However, it's still wise to keep AMD on your radar and strike when the time is right.