The S&P 500 and the Dow hit record highs on ​Tuesday after strong forecasts from Caterpillar and Palantir reassured investors about AI-driven demand, while hopes for an imminent deal to end ‌the Middle East conflict sent crude prices lower.Palantir Technologies soared 26% after raising its annual revenue forecast again, while Caterpillar, seen as a bellwether for the global industrial economy, gained 5.8% after raising its annual revenue growth forecast, benefiting from a buildout of AI data centers that has spurred demand for its power-generation and construction equipment.Investors have been scrutinizing ​results from AI-linked companies this earnings season for signs that their billion-dollar investments are yielding returns. Strong results from AI leaders ​Microsoft and Amazon last week were a relief and have underpinned gains on Wall Street following a turbulent July.“The ⁠AI earnings performance has been fantastic, but the big question that investors are asking themselves now is that if it’s going to be ​sustainable,” said Eric Parnell, chief market strategist at Great Valley Advisor Group.“And if it’s sustainable, we’re going to have to start to separate the winners ​from the losers.”Chip stocks were on a tear, with the Philadelphia Semiconductor index up around 5.8%. Shares of top hyperscalers, though, were mixed, with Amazon dropping 2% as it cooled from the recent rally, while Microsoft gained 2%.The S&P 500 tech sector added 3.5% and was offsetting broader losses on the benchmark index, as seven ​of the 11 sectors were trading lower.In geopolitics, crude prices fell about 4% after a Qatari official said efforts to secure a diplomatic resolution to ​the conflict were continuing, while U.S. Treasury Secretary Scott Bessent said a deal with Iran to reopen the Strait of Hormuz could come as soon as Tuesday or ‌Wednesday.At 11:37 ⁠a.m. ET, the Dow Jones Industrial Average rose 768.56 points, or 1.44%, to 53,946.83 and the Nasdaq Composite gained 478.21 points, or 1.85%, to 26,392.10.The S&P 500 gained 98.24 points, or 1.29%, to 7,698.74, hitting its first record high since June.Investors have been scrutinizing ​results from AI-linked companies this earnings season for signs that their billion-dollar investments are yielding returns. Strong results from AI leaders ​Microsoft and Amazon last week were a relief and have underpinned gains on Wall Street following a turbulent July.“The ⁠AI earnings performance has been fantastic, but the big question that investors are asking themselves now is that if it’s going to be ​sustainable,” said Eric Parnell, chief market strategist at Great Valley Advisor Group.“And if it’s sustainable, we’re going to have to start to separate the winners ​from the losers.”Overall, this earnings season has so far been better than historical standards. Of the 304 companies in the S&P 500 that have reported second-quarter earnings as of Friday, 85.2% have beaten estimates, versus ​the long-term average of 67.5%.Elon Musk’s ​SpaceX will release its first earnings report ⁠since its public debut after markets close. The company’s shares were up 4%.Shares of U.S. photonic firms Coherent and Lumentum added 14% and 10%, respectively, after Reuters reported the Trump administration is drafting a ban on U.S. imports ​of new models of Chinese data center components.McDonald’s inched 1.6% higher despite reporting disappointing results, while Pfizer gained ​1.1% after reporting upbeat quarterly ⁠results.On the data front, job openings dropped in June, weighed down by a sharp decline in the healthcare and social assistance sector, but a rise in hiring and low layoffs suggested the labor market remained stable.Traders priced in a 58.6% chance that the Federal Reserve will hike interest rates in September, the CME Group’s ⁠FedWatch Tool ​showed.Advancing issues outnumbered decliners by a 2.11-to-1 ratio on the NYSE and by a ​2.57-to-1 ratio on the Nasdaq.The S&P 500 posted 18 new 52-week highs and three new lows, while the Nasdaq Composite recorded 92 new highs and 38 new lows.