This is an archive of the discontinued LLVM Phabricator instance.

[VE] Support lowering to NND instruction
ClosedPublic

Authored by kaz7 on Jun 8 2020, 5:41 AM.

Details

Summary

Support NND instruction of Aurora VE. Add hasAndNot function also
for optimization.

Diff Detail

Event Timeline

kaz7 created this revision.Jun 8 2020, 5:41 AM
simoll added a comment.Jun 8 2020, 5:51 AM

Just one nit.

llvm/lib/Target/VE/VEISelLowering.cpp
541–547

Why not return true for all scalar NANDs? Constants can always be pulled through registers if we cannot turn them into immediates.

kaz7 marked an inline comment as done.Jun 8 2020, 6:24 AM

Thanks for reviewing. Add reply to your question.

llvm/lib/Target/VE/VEISelLowering.cpp
541–547

Because retrieving immediate value uses LEA or aother instruction.

Let me explain the background of this function. This hasAndNot function is used in SelectionDAG/DAGCombiner.cpp in order to check conversion from ((x ^ y) & m) ^ y to higher (x & m) | (y & ~m) or ~(~x & m) & (m | y).

All of them uses 3 instructions but latter two has better parallelism on pipeline. So, adding new instruction to use and-not instruction is not OK for this case.

simoll added inline comments.Jun 8 2020, 6:57 AM
llvm/lib/Target/VE/VEISelLowering.cpp
541–547

Thanks for the explanation.
It would be helpful to have a comment here that explains what motivates this and how the function is used in DAGCombiner.

kaz7 updated this revision to Diff 269383.Jun 8 2020, 5:17 PM

Update following a suggestion.

kaz7 marked an inline comment as done.Jun 8 2020, 5:17 PM

Thanks. Updated.

llvm/lib/Target/VE/VEISelLowering.cpp
541–547

Add it.

kaz7 updated this revision to Diff 269413.Jun 8 2020, 9:13 PM

Rebased.
I've notived that it is possible to use PatFrag instead of writing
(and (not ...)) as new multicalss, so I've updated modifications.

simoll accepted this revision.Jun 9 2020, 1:12 AM
This revision is now accepted and ready to land.Jun 9 2020, 1:12 AM
This revision was automatically updated to reflect the committed changes.