After a brutal sell-off last year that sent many of the best stocks into the bargain bin, some of the strongest are now on the rebound. Amazon (AMZN -2.56%) and Advanced Micro Devices (AMD -5.44%) are up 30% and 50%, respectively, year to date. Following a new round of earnings reports for the first quarter, the market is starting to sense better times on the horizon.

Here's why both stocks could be great places to park some money for the long term.

1. Amazon

Shares of Amazon are still down 40% from their all-time high. The stock initially fell due to weak consumer spending trends in online stores, Amazon's largest revenue source. Another perceived problem is slowing growth in Amazon Web Services (AWS).

AWS is the company's cloud computing arm, which increased revenue 16% year over year last quarter. While that is less than Microsoft's 27% growth from its Azure cloud business, Amazon is still holding its market share steady. Based on the latest estimates from Synergy Research, Amazon's share in cloud services stands at 32%, with Microsoft at 23% and Alphabet's Google Cloud at 10%.

AWS generated an operating profit of $5.1 billion in Q1, which was responsible for all of the company's profit in the period. The profits from AWS helped offset the losses from Amazon's international retail business. You can see why the market is laser focused on the competitive health of this important growth driver.

However, Amazon believes it's still early days here. CEO Andy Jassy said the company is "not close to being done inventing in AWS." The choice of the word "inventing" implies long-term opportunities that don't exist right now. For example, Amazon is reportedly working on an AI-powered chat feature to integrate with the cloud-based Alexa voice assistant. 

Jassy said that "few folks appreciate how much new cloud business will happen over the next several years from the pending deluge of machine learning that's coming."  

Amazon is not short of resources. It just completed a major investment cycle that expanded its retail fulfillment capacity to meet the higher sales volume that came online during the pandemic. Amazon is investing in AI across many areas of its business, including product recommendations, among other things. Investors should expect the company to spend increasingly more on this technology in the years to come. 

All told, there are good reasons to expect Amazon to keep growing both its cloud services and e-commerce platforms for a long time, especially as it invests in AI. It's quite possible Amazon could develop new revenue streams from opportunities that no one can imagine right now. Even AWS didn't launch until 2006 -- roughly a decade after Amazon started. 

Amazon's experimental culture will occasionally produce disappointments (e.g., Fire Phone), but the successes will be delightful surprises for shareholders.

2. Advanced Micro Devices

Advanced Micro Devices is a leading supplier of high-powered chips for personal computers, data centers, video game consoles, and more. The stock has fallen 40% from its previous highs. Sales slumped 9% year over year in the most recent quarter as lower revenue from consumers and data centers softened demand. But AMD is well positioned to serve the long-term need for advanced chips and take market share away from industry leader Intel.

AMD's data center revenue was flat year over year in the first quarter. But Intel reported a bigger decline of 39% in its data center and AI business. AMD is clearly taking significant share away from Intel, which is the reason for the company's explosive revenue growth and stock return of more than 700% over the last five years. 

AMD is expanding its enterprise pipeline and recently closed multiple wins with large companies across automotive, technology, and financial services last quarter. The chipmaker said many of its larger cloud customers are enthusiastic about AMD's latest Zen 4 EPYC chip, which will more broadly begin to roll out to power internal data workloads and virtual cloud servers in Q2. 

"Our AI activities increased significantly in the first quarter, driven by expanded engagements with a broad set of data center and embedded customers," CEO Lisa Su said during the earnings call.

Positioning for the growing demand for AI is the company's top strategic priority. Given how well AMD has tackled its data center opportunity in recent years, there's no reason to doubt it won't benefit enormously from the AI revolution. The International Data Corporation forecasts spending on AI hardware, software, and services to grow 27% per year through 2026. 

AMD shares have already rebounded 50% year to date. The stock should be a market-crushing investment in the next bull market.