It's no secret by now that artificial intelligence (AI) has the full attention of the stock market. All three major indexes have touched all-time highs recently, confirming a new bull market is underway, and artificial intelligence is a big reason why.

The launch of ChatGPT in late 2022 was the clearest signal yet that the next era in technology is underway and generative AI has big tech companies and others pouring billions into AI infrastructure.

Early on, Nvidia has been a big winner as demand for its graphics processing units (GPUs) has skyrocketed, and other AI hardware stocks have soared, as well. However, there will be more winners from the breakthrough technology. Keep reading to see two that look set to become trillion-dollar companies in the coming years thanks to AI.

A digitally generated face

Image source: Getty Images.

1. Taiwan Semiconductor Manufacturing

Nvidia might look like the pick-and-shovel play for the AI boom, but if you take that line of thinking one step further, the higher-level pick-and-shovel play in the industry appears to be Taiwan Semiconductor Manufacturing (TSM 1.26%).

TSMC, as it is also known, is the world's largest contract chip manufacturer with roughly 55% market share of the third-party chip fabrication market and around 90% of advanced chip manufacturing. This typically includes the kind of semiconductors and complex components involved in generative AI. Given that market power, it's no exaggeration to say that the company is the linchpin in the growth of generative AI and the broader semiconductor industry.

Its largest customers include the likes of Apple, Nvidia, Broadcom, and Advanced Micro Devices. These companies have emerged as the power players in generative AI or have aspirations of becoming them.

TSMC's advantage over other foundries in advanced chip manufacturing and its relationships with those top chip designers should help drive its growth in the AI era. It also should allow the company to benefit from increased demand for chips, as AI plays a larger role in technology and the economy.

TSMC has wide operating margins that are better than 40%, which signals a competitive advantage, and the company's current market cap is $709 billion. At that valuation and given the growth it is seeing, it could top $1 trillion within a year or two.

2. Broadcom

Broadcom (AVGO 3.84%) is another AI stock that looks poised to cross the $1 trillion mark in the coming years, as it's currently valued at $573 billion. It's also seeing AI-driven growth start to ramp up.

The company is best known as a chip designer, but its business is far-reaching as it's grown over its history through several acquisitions. Most recently, it acquired VMWare, the virtualization software specialist, which will give Broadcom a significant bump in revenue and profits this year. It also owns Symantec, the cybersecurity firm, and enterprise software and DevOps company CA Technologies, among others.

Broadcom has a history of acquiring companies, slashing costs, and absorbing them into its larger business to grow revenue and profits.

While Broadcom doesn't compete in GPUs, it's known for its switches, accelerators, and networking solutions, which are expected to see increasing demand in the AI era. Management called out strong demand for networking products in AI data centers, as well as custom accelerators in its recent earnings report.

It also noted that AI revenue quadrupled in the quarter to $2.3 billion and raised its forecast for AI-related revenue higher. Broadcom said it would now represent roughly 35% of semiconductor revenue, or more than $10 billion, up from its prior guidance of 25% of revenue.

Like TSMC, Broadcom also has wide operating margins with an expected 60% earnings before interest, taxes, depreciation, and amortization (EBITDA) margin this year, a sign of competitive strength.

With multiple ways of capitalizing on the AI boom, Broadcom looks well-positioned to be a winner. A 70% gain in market cap over the next few years is certainly within reach for the diversified chip giant, which would make it worth $1 trillion.