If you have some extra cash to invest in the stock market, now could be a great time to put some money to work. The S&P 500 index has returned 42% since bottoming out in 2022. The average duration of a new bull market is about five years, so buying shares of quality growth stocks could deliver sizable returns over the next few years.

Companies involved in the development of artificial intelligence (AI), including leading semiconductor companies supplying computing hardware for training AI models, are ripe for the picking. Here are two leaders in this burgeoning opportunity that could substantially grow your savings in the coming years.

1. Advanced Micro Devices

Advanced Micro Devices (AMD 1.23%) has become a popular option for investors interested in semiconductor stocks, but the company has been performing at a high level for most of the last 10 years. Its continued innovation and focus on serving the booming data center market make it a no-brainer stock to buy today.

AMD makes chips for consumer PCs, gaming consoles, and cloud computing markets, but the data center business is where the momentum is right now. Semiconductor spending in data centers is projected to grow 25% annually through 2028, according to Dell'Oro Group, and AMD is already capturing a healthy share of that spending increase. Its data center revenue was up 80% year over year in the first quarter.

After a strong start to the year, management raised its full-year guidance for data center revenue. This came after the new MI300 graphics processing unit (GPU) designed for AI workloads became the fastest ramping-up product in company history, which signals tremendous pent-up demand.

As the data center business continues to show outstanding long-term growth prospects, AMD is also seeing strong demand for its central processing units (CPUs). Its client segment revenue, including sales of Ryzen desktop processors, doubled year over year to $1.4 billion last quarter. It's also seeing significant revenue increases with the ramp-up of its fourth-generation EPYC CPUs for servers.

AMD's new MI300 should continue to experience strong demand, as there haven't been enough GPUs to satisfy AI demand over the past year. The company also expects its next generation of EPYC processors to deliver substantial performance improvements and gain further market share against Intel.

This is a great time to consider buying the stock. AMD shares trade down about 30% from their previous high, even as Wall Street analysts are raising their growth estimates and now expect the company's earnings to grow at an annualized rate of 43% over the next several years. The share price is currently $160.67, making it very affordable for someone with less than $1,000 to buy one share.

2. Meta Platforms

Facebook and Instagram owner Meta Platforms (META 1.25%) has made a solid recovery over the last year. The stock hit new highs earlier this year, as advertising revenue accelerated after a weak ad spending environment in 2022. The stock could be poised for more gains as the company benefits from the rollout of Meta AI across its family of apps.

Meta is a no-brainer because it has over 3.2 billion daily active users that it can monetize through advertising. Revenue soared 27% year over year to $36 billion in the first quarter, but tighter control of operating expenses drove a more impressive jump in net income of 117% to $12.4 billion.

Meta AI is contributing more to those impressive financial results. Based on Meta's latest Llama 3 large language model, Meta AI is significantly improving content recommendations and ad performance, which, in turn, is driving higher user engagement and more ad spending by brands.

Importantly, the value of the company's wide user reach led to a 6% year-over-year increase in the price per ad, which reflects solid advertising demand. While it's just one quarter, the latest results show how the company can continue to drive growth by investing in more advanced AI models.

It's encouraging that Meta Platforms recently initiated its first-ever dividend, with the quarterly payment currently set at $0.50 per share. This reflects a financially sound business with great prospects and plenty of resources to invest in the future while rewarding shareholders.

The stock trades at a reasonable valuation of 25 times expected earnings this year. That is very attractive for a business that analysts think will grow earnings at an annualized rate of 18% over the long term. Meta's share price is hovering around $500, so $1,000 could easily buy one share each of Advanced Micro Devices and Meta Platforms.