[PATCH] D115804: [CodeGen] use saturating FP casts when compiling with "no-strict-float-cast-overflow"

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 20 03:59:05 PST 2021

sepavloff added a comment.

In D115804#3201681 <https://reviews.llvm.org/D115804#3201681>, @spatel wrote:

> In D115804#3201044 <https://reviews.llvm.org/D115804#3201044>, @craig.topper wrote:
>> What's the plan for constrained intrinsics versions of these intrinsics? The IRBuilder calls for CreateFPToSI and CreateFPToUI are strict FP aware, but this new code isn't.
> Not sure. cc'ing @kpn @sepavloff @andrew.w.kaylor  
> The saturating intrinsics implement non-standard behavior for C languages AFAIK, so we might want to warn if someone tries to use "-fno-strict-float-cast-overflow" and "-ffp-exception-behavior=strict" at the same time? Or we try to support that corner case by adding even more FP intrinsics?

Conversion `float`->`int` depends on rounding mode. At least on some ML cores this conversion is made with saturating semantics. So ability to specify rounding mode would be useful for such targets.

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list