This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Select G_SADDO and G_SSUBO
ClosedPublic

Authored by paquette on Dec 3 2020, 2:42 PM.

Details

Summary

We didn't have selector support for these.

Selection code is similar to getAArch64XALUOOp in AArch64ISelLowering. Similar to that code, this returns the AArch64CC and the instruction produced. In SDAG, this is used to optimize select + overflow and condition branch + overflow pairs. (See AArch64TargetLowering::LowerBR_CC and AArch64TargetLowering::LowerSelect)

(G_USUBO should be easy to add here, but it isn't legalized right now.)

This also factors out the existing G_UADDO selection code, and removes an unnecessary check for s32/s64. AFAIK, we shouldn't ever get anything other than s32/s64. It makes more sense for this to be handled by the type assertion in emitAddSub.

Diff Detail

Event Timeline

paquette created this revision.Dec 3 2020, 2:42 PM
paquette requested review of this revision.Dec 3 2020, 2:42 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 3 2020, 2:42 PM
aemerson accepted this revision.Dec 3 2020, 9:07 PM

LGTM.

This revision is now accepted and ready to land.Dec 3 2020, 9:07 PM
This revision was automatically updated to reflect the committed changes.
foad added a subscriber: foad.Oct 15 2021, 3:14 AM
foad added inline comments.
llvm/lib/Target/AArch64/GISel/select-saddo.mir
1

Should be in test/ not lib/.

llvm/lib/Target/AArch64/GISel/select-ssubo.mir
1

Should be in test/ not lib/.