[llvm] Add new llvm.cbrt intrinsic (PR #178396)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 05:03:33 PST 2026


arsenm wrote:

> Fair enough, but what about Intrinsic::sin, Intrinsic::atan2 and Intrinsic::sinh, etc? I assume for many of these intrinsics they can currently only be lowered to libcalls.

These are huge problems, and I think they should probably be removed. However these are more tolerable in practice, since  optimizations are not going to synthesize them out of something else. The current analog to cbrt is the pow->sqrt transform, but we have a way to expand that in terms of fdiv and fma. If cbrt is to be similarly introduced, it needs similar handling 

> 
> I am happy to look into an inline expansion - can you explain more about what this entails?

The legalizer should emit a correctly rounded implementation in terms of existing primitive nodes (as we already have for sqrt on most targets)

https://github.com/llvm/llvm-project/pull/178396


More information about the llvm-commits mailing list