This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Add add.cc/addc.cc/sub.cc/subc.cc for i64
ClosedPublic

Authored by slydiman on Apr 29 2022, 1:56 PM.

Details

Summary

PTX supports those instructions for i64 starting from 4.3.
The patch also marks corresponding DAG nodes legal for both i32 and i64.

Diff Detail

Event Timeline

slydiman created this revision.Apr 29 2022, 1:56 PM
slydiman requested review of this revision.Apr 29 2022, 1:56 PM
tra accepted this revision.Apr 29 2022, 3:03 PM
tra added a subscriber: tra.

LGTM.
Nice. We could use a bit more tests, though.

llvm/test/CodeGen/NVPTX/add-sub-128bit.ll
3

We should add ptxas test for ptx43+ here, too.

7

CHECK -> COMMON
DEFAULT -> NOCARRY
PTX34 -> CARRY

8

Can you think of a way to test 32-bit sub/add-with-carry that the patch makes legal?
We can't use the same approach as we do here with i128 as we'd just end up with a regular 64-bit add/sub.

This revision is now accepted and ready to land.Apr 29 2022, 3:03 PM
tra added inline comments.Apr 29 2022, 3:27 PM
llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
490

BTW, ADDC/SUBC are apparently deprecated in favor of ADDCARRY/SUBCARRY
https://github.com/llvm/llvm-project/blob/a83f4b9cda57c5b3d414ec3bcf9ac891b2ec27e1/llvm/include/llvm/CodeGen/ISDOpcodes.h#L269

Perhaps those should be added as well.

This revision was landed with ongoing or failed builds.Apr 29 2022, 3:34 PM
This revision was automatically updated to reflect the committed changes.
tra added a comment.Apr 29 2022, 4:03 PM

Any thoughts on the comments I've posted?

slydiman marked an inline comment as done.Apr 30 2022, 1:33 AM
slydiman added inline comments.
llvm/test/CodeGen/NVPTX/add-sub-128bit.ll
3

I will collaborate with @asavonic to do this.

8

Sure. I need some time for it.

llvm/lib/Target/NVPTX/NVPTXInstrInfo.td