[llvm] [NVPTX] designate fabs and fneg as free (PR #121513)

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 07:03:18 PST 2025


d0k wrote:

This looks like a nice improvement, but I'm afraid it's built on a wrong assumption. PTX `abs` and `neg` are not equivalent to LLVM's `fabs` and `fneg` since the latter explicitly preserve NaN bits while PTX instructions do not.

LLVM uses that assumption internally so even if the user doesn't care about NaN payloads in general, it can miscompile things. https://godbolt.org/z/Y9Pr9jGxe

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


More information about the llvm-commits mailing list