[llvm] [SelectionDAG][NVPTX] support expanding target intrinsics; implement for `nvvm.{fmax/fmin}` (PR #194783)

Princeton Ferro via llvm-commits llvm-commits at lists.llvm.org
Fri May 1 02:46:06 PDT 2026


Prince781 wrote:

@arsenm 

> I do not think this should be a feature. Target intrinsics should be for cases that should approximately directly select. They are not for providing general semantics with legalization. If you want higher level semantics, they should come from a generic intrinsic.

The problem is PTX has many math intrinsic variants that don't map cleanly to LLVM IR and probably never will. We're increasingly seeing clients emitting tile/vector-heavy code where scalar intrinsics are becoming the bottleneck to reducing code size and compile time.

Taking a liberal interpretation of "approximately directly select," this change is just adding syntactic sugar for an intrinsic like `@llvm.nvvm.fmax.elementwise.<flags>.vNf*()` that would be expanded in the target anyway. The core operation is the same. This is already the kind of code currently being emitted by frontends. They shouldn't have to emit unnecessary scalarization.

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


More information about the llvm-commits mailing list