[PATCH] Add Integer Saturation Intrinsics.

Ahmed Bougacha ahmed.bougacha at gmail.com
Fri Mar 20 19:20:19 PDT 2015

In http://reviews.llvm.org/D6976#142319, @rengolin wrote:

> Hi Ahmed,
> This looks clean enough for me, and it matches the ARM semantics. I believe front-ends could generate it directly, but also it could become the end-result of an optimization pass looking for that pattern in IR, right?

Right, my goal was to have an InstCombine that recognizes this.

However, on the RFC thread there were some concerns with adding intrinsics, and honestly I can see where they're coming from (you'd need to teach the various optimizers about those intrinsics).  We can do all this at the SelectionDAG level, with a CodeGenPrepare fixup to get the select/icmp closer together.  So, why would we add special-case intrinsics if we can express this in fairly simple canonical IR?  We do the same for min/max, and we don't have intrinsics for those.

Anyway, I'll try to rebase this soon-ish and put my other patches up;  sorry I couldn't get to this sooner!

In http://reviews.llvm.org/D6976#142095, @weimingz wrote:

> Do we need to remove the llvm.arm.usat with this patch?

For now I'd rather keep the ARM intrinsics, we can deprecate and autoupgrade down the road.





More information about the llvm-commits mailing list