U.S. stocks ended lower on Wednesday, with losses in Advanced Micro Devices, Palantir and other technology companies, as investors worried about pricey valuations and whether Wall Street’s ‍AI ​rally has reached its peak. The TSX, however, ended higher, finding strength in rallying oil prices.

Alphabet fell almost ‍2% ahead ​of its quarterly results after the bell. After the close, it regained 2% as the company said it was aggressively ramping up spending as it deepens its investments in the AI race.

Advanced Micro Devices tumbled 17% after the chipmaker forecast quarterly revenue that disappointed investors and suggested it is having a tough time competing against AI heavyweight Nvidia. Nvidia dropped 3.4% and the PHLX semiconductor index ⁠fell 4.4%. Palantir slumped almost 12%, reversing sharp gains from the previous day that were driven by the AI data company’s strong quarterly sales.

“The size of the infrastructure buildout is unprecedented, and the pace of consumers and businesses adopting AI tools is also unprecedented. The stock market is having a really hard time knowing where to price the stocks and what the future looks like. … The market is ‌suddenly skeptical and concerned about it,” ‍said Jed Ellerbroek, a portfolio manager at Argent Capital in St. Louis. Some software companies added to recent ‍losses amid worries that rapidly advancing AI could disrupt industry incumbents. Snowflake fell ‌4.6% and Datadog lost 3.3%.

“If you’ve got legacy software that’s old and clunky, you’re a ⁠ripe target for AI. We’re a bit bearish on software in general, with the whole impetus of AI,” said Josh Chastant, portfolio ​manager, public investments at GuideStone Funds.

Investors selling AI-related stocks shifted into less pricey companies that sat out the tech rally in recent years. The S&P 500 value index gained for a fifth straight session, while the S&P 500 growth index dropped.

The S&P 500 declined 0.51% to end the session at 6,882.72 points. The Nasdaq fell 1.51% to 22,904.58 points, while the Dow Jones Industrial ​Average rose 0.53% to 49,501.30 points. Even as the S&P 500 lost ground, seven of the 11 S&P 500 sector indexes rose, led by energy, up 2.25%, followed by a 1.8% gain in materials.

The S&P/TSX Composite Index ended up ⁠182.95 points, or 0.6%, at 32,571.55, extending its rebound from a four-week low on Friday.

Shares of Thomson Reuters Corp – which generates some of its revenues from software sales seen vulnerable to AI – rose 2%, clawing back some of the previous day’s steep ​decline and helping to lift the industrials group. Industrials rose 1.9%, benefiting additionally from gains of railroad shares and ATS Corp. ATS shares were up 6.4% after the industrial automation firm’s third-quarter revenue beat estimates.

Consumer discretionary added 3.5% and consumer staples ended 2.9% higher. Energy was up 1.4% ⁠as the price of oil settled 3.05% higher at US$65.14 a ⁠barrel on concern that planned talks between the United States and Iran due ‌on Friday could collapse.

Suncor Energy reported fourth-quarter profit after the bell on Tuesday that beat estimates. Still, its shares declined 1.2%.

Technology was the only one of 10 major sectors to end lower in Toronto. It lost 0.4%, tracking the declines for ‌U.S. technology shares.

Volume on U.S. exchanges was heavy, with 24.6 billion shares traded, compared to an average of 19.9 billion shares over the previous 20 sessions.

Among other U.S. stocks, Super Micro Computer’s shares jumped 13.8% after the company raised its annual revenue forecast on sustained demand for its AI-optimized servers as companies ramp up data center capacity.

Limiting losses ⁠in the S&P 500, shares of the drugmaker Eli Lilly rallied about 10% after the company forecast 2026 profit above ⁠Wall Street expectations.

The U.S. government’s closely watched jobs report for January has been pushed back from its scheduled release on Friday due to a four-day ‌partial government shutdown that ended on Tuesday.

In the meantime, the ADP national employment report on Wednesday showed that U.S. private payrolls increased less than expected in January amid job losses in the professional and business services, as well as manufacturing sectors.

Advancing issues outnumbered falling ones within the S&P 500 by a 2.6-to-one ratio. The S&P 500 posted 93 new highs and 23 new lows; the Nasdaq recorded 218 new highs ‌and 318 new lows.

Reuters, Globe staff