[llvm] [DirectX] legalize frem so that modulo behavior is the same as fmod (PR #133772)

Farzon Lotfi via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 12:15:50 PDT 2025


farzonl wrote:

This is blocked need to know what more experienced people on the team think. This is what I see as the differences.

Feature | A % B | fmod(A, B)
-- | -- | --
LLVM Instruction | frem | IR sequence with fdiv, frac, select, etc.
Handles sign explicitly? | ❌ No | ✅ Yes
Rounding behavior | trunc(A / B) | floor(A / B)
Matches C fmod? | ❌ Not exactly | ✅ Yes



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


More information about the llvm-commits mailing list