[llvm-dev] should we have IR intrinsics for integer min/max?
Matt Arsenault via llvm-dev
llvm-dev at lists.llvm.org
Mon Nov 7 11:06:16 PST 2016
On 11/07/2016 11:01 AM, Sanjay Patel via llvm-dev wrote:
>
> FWIW, InstCombine doesn't canonicalize any of the first 3 options
> currently. Codegen suffers because of that (depending on the target
> machine and data types). Regardless of the IR choice, some backend
> fixes are needed.
>
> Another possible consideration is the structure/accuracy of the cost
> models used by the vectorizers and other passes. I don't think they
> ever special-case the cmp+sel pair as a possibly unified (and
> therefore cheaper than the sum of the parts) operation.
>
> Note that we added FP variants for min/max ops with:
> https://reviews.llvm.org/rL220341
FP min/max is different and more complicated due to the special NaN
handling behavior. Integer min/max is representable with only a compare
and select, so I think it would be preferable to just canonicalize to
using those two instructions
-Matt
More information about the llvm-dev
mailing list