[llvm] [LLVM] Add FP instruction intrinsics (PR #193588)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 24 02:36:17 PDT 2026
arsenm wrote:
> > fneg should not have an intrinsic
>
> @arsenm On some targets, the FP environment can affect even `fneg`.
No, this is not true. If the FP environment changes the result, it is not fneg. fneg, fabs, and copysign are all precisely defined as bit operations which can exclusively change the sign bit.
> Without an intrinsic, there would be no way to model this in IR. We could leave targets to define their own intrinsic (eg. `@llvm.nvvm.fneg`). But then that would force us to plumb support for target-specific `fneg`s throughout the optimization passes or leave such targets with degraded optimization support.
No, a negate with floating-point effects is `fsub -0.0, x`. Back in the dark ages, this was the usual way to do fneg in llvm. But that was broken, because fneg really is just a sign bit operation.
https://github.com/llvm/llvm-project/pull/193588
More information about the llvm-commits
mailing list