[llvm] [SPIR-V] Add support for OpFMod intrinsic (PR #193172)
Dmitry Sidorov via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 21 04:28:33 PDT 2026
================
@@ -98,6 +98,7 @@ let TargetPrefix = "spv" in {
def int_spv_degrees : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty], [IntrNoMem]>;
def int_spv_distance : DefaultAttrsIntrinsic<[LLVMVectorElementType<0>], [llvm_anyfloat_ty, LLVMMatchType<0>], [IntrNoMem]>;
def int_spv_faceforward : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty, LLVMMatchType<0>, LLVMMatchType<0>], [IntrNoMem]>;
+ def int_spv_fmod : DefaultAttrsIntrinsic<[LLVMMatchType<0>], [llvm_anyfloat_ty, LLVMMatchType<0>], [IntrNoMem]>;
----------------
MrSidims wrote:
I'd expect to get `OpFMod` from either `frem` LLVM instruction or `fmod` OpenCL builtin (or equivalent from HLSL is there is any). I don't see a reason to add a dedicated intrinsic for it that is exposed only in SPIR-V backend (unless you want to wire it with `frem`, but I hope that currently lowering already works, though I haven't checked it myself).
https://github.com/llvm/llvm-project/pull/193172
More information about the llvm-commits
mailing list