This is an archive of the discontinued LLVM Phabricator instance.

[LegalizeTypes][NVPTX] Remove extra compare from fallback code for ISD::ADD in ExpandIntRes_ADDSUB.
ClosedPublic

Authored by craig.topper on Sep 12 2022, 10:01 AM.

Details

Summary

This is the ultimate fallback code if UADDO isn't supported.

If the target uses 0/1 we used one compare, but if the target doesn't
use 0/1 we emitted two compares. Regardless of boolean constants we
should only need to check that the Result is less than one of the
original operands. So we only need one compare.

Diff Detail

Event Timeline

craig.topper created this revision.Sep 12 2022, 10:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2022, 10:01 AM
craig.topper requested review of this revision.Sep 12 2022, 10:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 12 2022, 10:01 AM
craig.topper added inline comments.Sep 12 2022, 10:02 AM
llvm/test/CodeGen/NVPTX/add-sub-128bit.ll
10

There were previously two add.s64 after the last selp.s64 but the test was only checking for one of them. With the code reduced, one of those adds is scheduled earlier.

spatel accepted this revision.Sep 13 2022, 8:11 AM

LGTM

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

Better to auto-gen the full output, so that's visible?

This revision is now accepted and ready to land.Sep 13 2022, 8:11 AM
craig.topper added inline comments.Sep 13 2022, 8:57 AM
llvm/test/CodeGen/NVPTX/add-sub-128bit.ll
10

I can try, but there don't seem to be any autogenerated tests for this target.

This revision was landed with ongoing or failed builds.Sep 13 2022, 9:08 AM
This revision was automatically updated to reflect the committed changes.