This is an archive of the discontinued LLVM Phabricator instance.

[VP] Add support for vp.inttoptr & vp.ptrtoint
ClosedPublic

Authored by inclyc on Nov 1 2022, 9:30 AM.

Details

Summary

This patch add vp.inttoptr & vp.ptrtoint support by lowering them into
vp.zext / vp.truncate with in SelectionDAGBuilder.

Diff Detail

Event Timeline

inclyc created this revision.Nov 1 2022, 9:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 1 2022, 9:30 AM
inclyc published this revision for review.Nov 1 2022, 9:34 AM
inclyc updated this revision to Diff 472335.Nov 1 2022, 9:42 AM

Drop extra Function Attr

inclyc updated this revision to Diff 472501.Nov 1 2022, 10:09 PM

Add comments

craig.topper added inline comments.Nov 17 2022, 10:32 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
1486

Probably better to pass Mask and EVL explicitly. Op is the same as Ops[0]

1492

I don't think you need to check the element type.. The number of elements should match.

Something like this looks better to me structurally.

if (VT.bitsGT(Op.getValueType())
  return getNode(ISD::VP_ZERO_EXTEND, DL, VT, Op, Mask, EVL);
if (VT.bitsLT(Op.getValueType())
  return getNode(ISD::VP_TRUNCATE, DL, VT, Op, Mask, EVL);
return Op;
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
7708

This is OpValues[0] is it not?

7717

Same

inclyc updated this revision to Diff 476307.Nov 17 2022, 6:30 PM

Address comments

  • Pass EVL & Mask Directly
  • Clearer control flow logics
  • OpValues[0]
inclyc marked 4 inline comments as done.Nov 17 2022, 6:31 PM
This revision is now accepted and ready to land.Nov 17 2022, 6:35 PM
inclyc updated this revision to Diff 476311.Nov 17 2022, 6:38 PM

drop extra whitespace in comments

This revision was landed with ongoing or failed builds.Nov 17 2022, 6:43 PM
This revision was automatically updated to reflect the committed changes.