This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Instruction selection for add/sub with carry-in
AbandonedPublic

Authored by porglezomp on Jan 18 2021, 3:53 PM.

Details

Summary

[AArch64][GlobalISel] Make G_USUBO legal and select it

The expansion for wide subtractions includes G_USUBO, so it's important
that it's a legal instruction.

[AArch64][GlobalISel] Add selection support for G_UADDE and G_USUBE

These take a carry-in argument. In the common case where it's directly
fed by a carry-out operation in the preceding instruction, we can
translate it to an ADCS/SBCS operation. Otherwise, we re-generate the
condition flags.

[AArch64][GlobalISel] Make G_SADDE and G_SSUBE legal

Diff Detail

Event Timeline

porglezomp created this revision.Jan 18 2021, 3:53 PM
porglezomp requested review of this revision.Jan 18 2021, 3:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2021, 3:53 PM

Re-enable G_SADDE and G_SSUBE in selection

Update revision again - accidentally pushed only the last commit

porglezomp retitled this revision from [AArch64][GlobalISel] Make G_USUBO legal and select it to [AArch64][GlobalISel] Instruction selection for overflowing add/sub.Jan 18 2021, 5:22 PM
porglezomp edited the summary of this revision. (Show Details)
  • [AArch64][GlobalISel] Fix legalize-arith-128 test ABI
porglezomp retitled this revision from [AArch64][GlobalISel] Instruction selection for overflowing add/sub to [AArch64][GlobalISel] Instruction selection for add/sub with carry-in.Jan 19 2021, 9:24 AM

Do you think you could split this into 3 patches, one for each commit?

llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
2794

Could debug instructions mess this up?

If so, adding a isPredecessorIgnoringDBG helper might be useful here.

2795

Looks like you can fold the variables above into this one?

llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
169

Can you add testcases for the s32/s64 cases here, and for the minScalar case?

llvm/test/CodeGen/AArch64/GlobalISel/legalize-arith-128.ll
2

I think this should be a MIR test rather than a IR test.

This command line should get you 90% there:

llc -mtriple aarch64 -stop-before=legalizer -global-isel -simplify-mir -o -

You'll probably have to tidy it up a little bit after generating it though. (See: test/CodeGen/AArch64/legalize-uaddo.mir as an example)

porglezomp abandoned this revision.Jan 20 2021, 12:01 PM

Closing this in favor of separate revisions for the individual changes.