Western Digital (WDC -0.05%) and Taiwan Semiconductor Manufacturing (TSM 2.85%) represent two essential links in the global supply chain for electronic devices. WD is one of the world's leading manufacturers of disk drives and flash memory, and TSMC is its most advanced contract chipmaker. Both tech stocks have more than doubled in value over the past 12 months.

Over the past two years, WD struggled with a cyclical decline in memory prices and soft demand for its older platter-based hard disk drives (HDDs), but its business is gradually stabilizing and attracting value-seeking investors.

TSMC's revenue growth accelerated last year as it accepted more orders from fabless chipmakers like AMD, Apple, and Qualcomm. But TSMC's stock is also getting pricier, and it expects to ramp up its spending to maintain its lead in the "process race" to create smaller and more power-efficient chips.

A platter-based HDD.

Image source: Getty Images.

Will WD's low valuations help it outperform TSMC over the next 12 months, or will investors favor TSMC's robust growth over WD's potential turnaround? Let's take a fresh look at both companies to decide.

WD's main challenges

WD shares a near-duopoly in HDDs with Seagate. However, HDDs are gradually ceding the data storage market to solid-state drives (SSDs), which store data on flash memory chips instead of platters. SSDs are pricier than HDDs, but they're smaller, faster, more power-efficient, and less prone to physical damage.

WD bought SanDisk, one of the world's top flash memory and SSD makers, to diversify its business away from HDDs five years ago. It also pivoted its HDDs away from the consumer PC market, which was more exposed to competition from SSDs, and toward higher-capacity HDDs for enterprise and data center customers. WD still generates nearly half of its revenue from HDD sales, while the rest comes from its flash products.

WD's revenue rose 1% in fiscal 2020, which ended last July, but its adjusted earnings dropped 37% as weak flash memory prices crushed the flash segment's margins. The HDD segment's revenue and margins also declined, even as the pandemic sparked purchases of new PCs and data center upgrades to handle the rising usage of cloud-based services.

In the first half of fiscal 2021, WD's revenue dipped 5% year over year as soft demand for its HDDs from data center customers offset higher sales of its drives to PC makers. That slowdown offset the stabilization of its flash business, which benefited from cyclically higher memory prices.

On the bright side, WD's adjusted earnings jumped 40% year over year in the first six months, buoyed by an easy comparison to the previous year and tighter spending throughout the pandemic.

TSMC's main challenges

TSMC produces the world's smallest chips, which are measured in nanometers. TSMC generated 41% of its revenue from its smallest 5nm and 7nm nodes in 2020. By end market, 48% of TSMC's revenue came from the smartphone market during the year, 33% came from the HPC (high-performance computing market), and the rest came from other industries.

A wafer of chips being manufactured.

Image source: Getty Images.

TSMC's revenue rose 31% in 2020. The expansion of its smaller higher-margin nodes boosted its gross and operating margins, and its earnings jumped 50%.

Those growth rates were impressive, especially since it faced pandemic-related disruptions of the smartphone and auto industries in the first half of the year. The Trump administration also barred TSMC from producing chips for the Chinese tech giant Huawei.

However, TSMC faces intense pressure to produce even smaller chips to stay ahead of its chief rival Samsung. It's already developing 3nm chips, which will be 15% more efficient and consume 30% less power than its 5nm chips, and it's building a new plant in Taiwan to develop 2nm chips.

To maintain its lead, TSMC plans to boost its annual capex by up to 45%-63% in 2021. Samsung and its South Korean chipmaking peers plan to increase their average capex by more than 20% this year.

The forecasts and valuations

Analysts expect WD's revenue to dip 4% this year before rebounding 16% in fiscal 2022. Its earnings are expected to dip 2% this year and more than double next year -- but it's unclear if it will reinstate its dividend, which has been suspended since last May. That outlook seems shaky, but its stock looks cheap at 10 times forward earnings.

Wall Street expects TSMC's revenue to rise 20% this year, but increase just 2% in 2022 as the semiconductor upgrade cycle cools off. Its earnings are expected to increase 15% this year and 17% next year, which suggests its jaw-dropping capex won't crush its earnings.

TSMC still pays a forward dividend yield of 1.5%, and its stock looks reasonably valued at 25 times forward earnings. However, TSMC's higher valuation could expose it to the ongoing rotation from growth stocks to value stocks if bond yields continue to rise.

The winner: TSMC

WD is a decent turnaround play, but its HDD business will continue to struggle as its flash business faces intense competition from bigger companies like Samsung. TSMC faces tougher year-over-year comparisons this year, but its best-in-breed reputation, reasonable valuation, and decent dividend all make it a more compelling investment than WD.