[clang] [llvm] Implement operand bundles for floating-point operations (PR #109798)

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 15:44:05 PDT 2024


andykaylor wrote:

> With the constrained intrinsics the default is safe because optimizations don't recognize the constrained intrinsic and thus don't know how to optimize it. If we instead rely on the strictfp attribute then we'll need possibly thousands of checks for this attribute, we'll need everyone going forward to remember to check for it, and we'll have no way to verify that this rule is being followed.

I may have given a wrong impression here. I'm basically in agreement with you on this point. We definitely need the safe-by-default behavior. What I meant to say was that we don't necessarily need the current constrained intrinsics. We could replace the current constrained intrinsics with a new set of intrinsics that could be used for this and other purposes.

Right now, I can think of at least three types of math intrinsics needed:

1. Correctly-rounded results
2. Vector-predication
3. Strict FP semantics

I think a lot of us would wish that the semantics of the libm-equivalent intrinsics required correctly rounded results, but as long as the common system math libraries aren't producing correctly-rounded results, that's a tough ask.

I'm a bit concerned that we've missed the boat on the vector-predicated intrinsics, because they are in widespread use already, so if we want to combine vector predication with strict FP semantics via operand bundles, that gets us right back into the problem of retrofitting correctness.

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


More information about the llvm-commits mailing list