This is an archive of the discontinued LLVM Phabricator instance.

[RISCV][SelectionDAG] Support VP_ADD/VP_MUL/VP_SUB mask operations
ClosedPublic

Authored by Jimerlife on Apr 20 2022, 8:25 PM.

Details

Summary

I abandoned D124080. In SelectionDAG::getNode, use VP_XOR or VP_AND replace VP_ADD/VP_MUL/VP_SUB when operand type is mask.

Diff Detail

Event Timeline

Jimerlife created this revision.Apr 20 2022, 8:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 20 2022, 8:25 PM
Jimerlife requested review of this revision.Apr 20 2022, 8:25 PM

This should be done in SelectionDAG::getNode not SelectionDAGBuilder so it happens any time a mask VP_ADD/VP_SUB/VP_MUL is created.

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
7586 ↗(On Diff #424087)

VP_MUL should be replaced with VP_AND.

0 * 0 -> 0
0 * 1 -> 0
1 * 0 -> 0
1 * 1 -> 1

The same as the truth table for AND.

Jimerlife updated this revision to Diff 424122.Apr 21 2022, 1:15 AM
Jimerlife edited the summary of this revision. (Show Details)

Address comments.
1.Move CheckVPMaskOp to SelectionDAG::getNode.

  1. use VP_AND replace VP_MUL
Jimerlife updated this revision to Diff 424405.Apr 22 2022, 1:45 AM
Jimerlife edited the summary of this revision. (Show Details)

rebase main

This should be done in SelectionDAG::getNode not SelectionDAGBuilder so it happens any time a mask VP_ADD/VP_SUB/VP_MUL is created.

I have done it in SelectionDAG::getNode. Thank for your advice.

craig.topper added inline comments.Apr 22 2022, 9:03 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
8838

Why not make this part of the switch? You don't need the VTList. This function only receives one VT.

Jimerlife updated this revision to Diff 424759.Apr 23 2022, 7:15 PM

address comment

Jimerlife marked an inline comment as done.Apr 23 2022, 7:16 PM
craig.topper added inline comments.Apr 25 2022, 9:17 AM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
8840

I meant use the existing switch at line 8796.

Jimerlife updated this revision to Diff 425105.Apr 25 2022, 7:14 PM

address comment

Jimerlife marked an inline comment as done.Apr 25 2022, 7:14 PM
This revision is now accepted and ready to land.Apr 25 2022, 7:23 PM
This revision was landed with ongoing or failed builds.Apr 25 2022, 7:34 PM
This revision was automatically updated to reflect the committed changes.