This is an archive of the discontinued LLVM Phabricator instance.

Add intrinsics and SDNodes for umin, umax, smin and smax.
ClosedPublic

Authored by jmolloy on Apr 27 2015, 8:17 AM.

Details

Summary

Add intrinsics and SDNodes for umin, umax, smin and smax.

This adds new intrinsics for signed/unsigned min/max. The intention is that
these intrinsics will be matched late in CGP (in a followup patch).

This patch adds the nodes, as well as legalization support and sets them to
be "expand" for all targets.

Sanity of generated code is tested on AArch64.

Diff Detail

Repository
rL LLVM

Event Timeline

jmolloy updated this revision to Diff 24477.Apr 27 2015, 8:17 AM
jmolloy retitled this revision from to Add intrinsics and SDNodes for umin, umax, smin and smax. .
jmolloy updated this object.
jmolloy edited the test plan for this revision. (Show Details)
jmolloy added reviewers: Gerolf, hfinkel, reames.
jmolloy set the repository for this revision to rL LLVM.
jmolloy added a subscriber: Unknown Object (MLST).
reames edited edge metadata.Apr 27 2015, 9:32 AM

Everything seems reasonable to me, but I'm not familiar enough with all the parts touched to sign off.

Also, you should make sure this gets highlighted on llvmdev. Summarize the current proposal, link to the review thread discussion, and give folks a chance to see the changes proposed. It's possible there's something we've missed when thinking about the trade offs.

lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
5461

Mild preference to pull out an LHS variable since you're using it twice. Same for each case below.

Gerolf added inline comments.Apr 27 2015, 11:55 AM
docs/LangRef.rst
9569

Is there are way to distinguish between user and compiler generated intrinsic? And assert on user?

lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
77

just MINMAX(N) would be consistent with (many :-) other Promote... interfaces.

jmolloy accepted this revision.Jul 17 2015, 2:30 AM
jmolloy added a reviewer: jmolloy.

This got LGTM'd on the list and was committed.

This revision is now accepted and ready to land.Jul 17 2015, 2:30 AM
jmolloy closed this revision.Jul 17 2015, 2:30 AM