The chips are down right now, both literally and figuratively. The semiconductor industry is having a rough year as supply has finally caught up with pandemic-related shortages, which is suppressing prices and sending shares of the best producers plunging.

On top of that, the broader stock market is trading in bear territory as high inflation and rising interest rates dampen consumer spending, putting the brakes on the economy. The technology-heavy Nasdaq-100 index has lost 34% of its value in 2022 as a result.

But Ultra Clean Holdings (UCTT -3.23%) and MKS Instruments (MKSI -2.36%) are two longstanding chip stocks that might be worth buying right now. Each company has a track record of performance that spans multiple decades, each company is highly profitable, and each plays a crucial role in the sector. 

Here's why they're great bear market buys. 

1. MKS Instruments touches every semiconductor in the world

It's a bold claim, but MKS Instruments says it plays a role in the manufacturing of every chip produced globally. The company has been around for 60 years, and it delivers equipment and services that assist with all steps of the semiconductor fabrication process. 

Device makers, particularly those that produce mobile products like smartphones that we use every day, are constantly trying to pack more performance into a smaller amount of space. Chipmakers must rise to this challenge, and MKS Instruments is a specialist in helping them do so. It applies its lengthy industry experience to solve the most complex manufacturing problems, including those that involve new, innovative components. 

But the company operates in more than just the semiconductor sector. It also supports the production of end products like device displays, LED lights for a variety of purposes, and even solar panels. MKS Instruments' footprint just expanded even further thanks to the completion of its acquisition of Atotech Limited in the third quarter (ended Sept. 30). Atotech is a leader in chemistry solutions for advanced electronics in addition to providing a host of other products and services. 

Despite the broader economic slowdown, MKS Instruments reported record-high revenue of $954 million in Q3, which was a 28% increase compared to the same period last year. Its non-GAAP earnings per share came in at $2.74, which brought its result over the last four quarters to $11.07. 

Why is that important? Because it places MKS Instruments stock at a price-to-earnings ratio of just 5.8. It means it will have to almost triple in value just to trade in line with its peers in the broader chip sector, represented by the iShares Semiconductor ETF (SOXX -1.77%), which trades at a P/E ratio of 16.6. 

2. Ultra Clean Holdings helps chipmakers achieve the highest yields

When manufacturing highly advanced, complex semiconductors, waste can be costly. It's imperative to ensure production processes are optimized so that the maximum level of output is achieved, and that's an area of specialty for Ultra Clean Holdings. 

The company has been assisting chipmakers for three decades, and it now offers an expansive portfolio of products and services. One of its areas of specialty is cleaning and coating manufacturing equipment, which can increase the length of the maintenance cycle and improve the lifespan of key components, which can significantly reduce costs. Additionally, it offers system integration and mechatronics products designed to ensure processes are operating at optimal efficiency.

Ultra Clean also provides solutions for the energy industry. Whether it's oil and gas or renewables like solar, the company's fitting and valve products are designed to boost efficiency and help producers safely meet rising demand. 

Ultra Clean's revenue growth slowed to 14.6% in the third quarter, from over 52% at the same time last year. But while it's feeling the effects of the difficult economic environment, combined with geopolitical challenges relating to its business with China, Ultra Clean managed to control costs and deliver $1.06 in non-GAAP earnings per share, which was up slightly year over year. Put simply, slowing revenue growth did not deal a major blow to the company's bottom line, which is a sign of prudent management. 

Like MKS Instruments, Ultra Clean stock trades at a discount to the broader sector with its P/E ratio of just 8. To be precise, it would have to double to move in line with the iShares Semiconductor ETF. 

One thing is for certain -- chip manufacturing is only going to grow more complex over time as devices shrink yet require more processing power. That calls for maximum efficiency, and Ultra Clean Holdings is a key solution to that need.