The stock market has been in recovery mode since the S&P 500 index hit a low on Oct. 12, 2022, with the index rising more than 24% since then thanks to resilient economic growth, cooling inflation, and a strong jobs market.

This impressive rally led some investors to believe that we are already in the midst of a bull market (bull market definitions vary and some say exceeding the previous high is also needed). What's more, Bank of America analysts expect the S&P 500 to hit the 5,000 level next year, which would translate into a 12.4% jump from current levels.

That's why now would be a good time for investors to add the likes of Alphabet (GOOG 0.07%) (GOOGL 0.14%) and Taiwan Semiconductor Manufacturing (TSM -0.73%) to their portfolios -- two companies that could soar in the event of a bull market as they are on track to take advantage of the growing adoption of artificial intelligence (AI). Enthusiasm around AI turned out to be a key growth driver for the stock market in 2023, and the good part is that this technology is still in its early phases of growth.

Bloomberg Intelligence estimates that the generative AI market could clock a compound annual growth rate (CAGR) of 42% over the next decade, generating $1.3 trillion in revenue in 2032 as compared to just $40 billion last year. Investors can benefit from this massive growth with the help of the two names discussed above, and the good part is that both of them are trading at attractive multiples right now.

Let's look at the reasons why you should consider buying these two AI stocks and holding them for a long, long time.

1. Alphabet

The generative AI market is expected to grow rapidly because of its deployment in digital ads, generative AI-based assistants such as chatbots, business services, and IT (information technology) services. Bloomberg Intelligence estimates that the generative AI-driven digital ad market could be worth $192.5 billion in 2032 as compared to just $57 billion last year.

Alphabet is one of the best ways to take advantage of this huge incremental growth opportunity because of its dominant position in the digital ad market. Data and analytics provider Visible Alpha estimates that Alphabet controls just over 42% of the global ads market, which puts it well ahead of second-placed Meta Platforms' share of almost 23%.

So, it wasn't surprising to see Alphabet stock jump after the company released new AI tools in May this year. The company's Google AI tools allow advertisers to generate relevant headlines, images, descriptions, and keywords for their products with the help of text-based prompts. Advertisers can also use Google's AI offerings to generate product headlines and descriptions for ads.

Google's AI tools also allow advertisers to find the best channels for placing their ads to improve their returns on advertising dollars spent. For instance, Alphabet claims that AI-placed video ads are generating 40% more views. Considering Alphabet's already dominant position in the digital ad market and the steps that it is taking to maintain its lead in a generative AI-powered world, the company could very well corner a significant chunk of the huge end-market opportunity mentioned above.

However, this is not the only niche where Alphabet is deploying generative AI to maintain its supremacy. The company's Google Workspace suite of apps reportedly controls half of the office productivity software market. Microsoft is the other big player in this market with a 45% share. With the business productivity software market expected to double in revenue by 2028 to $104 billion, according to Mordor Intelligence, it is easy to see why Alphabet is busy integrating generative AI into its Workspace offerings.

The company introduced Duet AI for Workspace earlier this year to help customers create images for presentations using text prompts, write emails and documents, and even organize, analyze, and act on data in Sheets. Alphabet is charging $30 per user from its enterprise customers for this tool and points out that it will continue to add more capabilities to Duet AI.

All this indicates why investors would do well to buy Alphabet stock while it is still trading at an attractive valuation. Though the stock has shot up 56% in 2023 as of this writing, it trades at 29 times trailing earnings. The tech-heavy Nasdaq-100 index, on the other hand, sports a trailing-earnings multiple of 30. Even Alphabet's forward-earnings multiple of 22 is lower than the Nasdaq-100's reading of 27.

With Alphabet expected to clock annual earnings growth of 16% for the next five years, which it may exceed thanks to AI and its dominant position in lucrative markets, investors may want to buy this tech stock before it flies higher.

2. Taiwan Semiconductor Manufacturing

Taiwan Semiconductor Manufacturing, popularly known as TSMC, is the world's largest pure-play semiconductor foundry that manufactures chips for third parties such as Nvidia, Advanced Micro Devices, Apple, and others. TSMC controls a whopping 59% of the semiconductor foundry market, according to Counterpoint Research, which is way ahead of second-ranked Samsung's 13% share.

This puts TSMC in a solid position to benefit from the booming demand for AI chips, a market that's expected to clock 38% annual growth over the next decade and generate almost $384 billion in revenue in 2032. TSMC is already taking steps to capitalize on the AI semiconductor opportunity by investing in advanced tools that will allow it to cater to the growing demand for chips in this sector.

Not surprisingly, TSMC sees its revenue from selling AI chips increasing in the coming years. CEO C.C. Wei said on the company's July earnings conference call:

Today, server AI processor demand, which we define as CPUs, GPUs, and AI accelerators that are performing, training, and inference functions accounts for approximately 6% of TSMC's total revenue. We forecast this to grow at close to 50% CAGR in the next five years and increased low teens percent of our revenue.

All this explains why analysts expect a sharp improvement in TSMC's revenue growth following a 13% drop in 2023 to $66 billion.

TSM Revenue Estimates for Current Fiscal Year Chart

TSM Revenue Estimates for Current Fiscal Year data by YCharts.

What's more, TSMC expects to sustain solid growth levels in the long run as well. Wei forecasts that the company's revenue could increase at a CAGR of 15% to 20% "over the next several years." With shares of TSMC trading at just 16 times trailing earnings, which is lower than the S&P 500's multiple of 20, investors would do well to buy this stock hand over fist before it flies higher thanks to the lucrative catalyst it is sitting on in the form of AI.