This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Handle non-multiples of the base type in narrowScalarAddSub
ClosedPublic

Authored by bogner on Mar 2 2021, 2:57 PM.

Details

Summary

When narrowing G_ADD and G_SUB, handle types that aren't a multiple of
the type we're narrowing to. This allows us to handle types like s96
on 64 bit targets.

Note that the test here has a couple of dead instructions because of
the way the setup legalizes. I wasn't able to come up with a way to
write this test that avoids that easily.

Depends on D97791

Diff Detail

Event Timeline

bogner created this revision.Mar 2 2021, 2:57 PM
bogner requested review of this revision.Mar 2 2021, 2:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 2 2021, 2:57 PM
arsenm added inline comments.Mar 3 2021, 6:40 PM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
4526

Also I still want to kill G_EXTRACT usage

llvm/test/CodeGen/AArch64/GlobalISel/legalize-add.mir
110

Should also add cases that aren't a nice multiple of the target size like s33

arsenm added inline comments.Mar 21 2021, 10:20 AM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
4534

Why do you need to getType here? It should be the same as NarrowTy?

bogner updated this revision to Diff 333591.Mar 26 2021, 10:53 AM
bogner marked 2 inline comments as done.
bogner added inline comments.
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
4526

I agree in principle but I think it's probably best to do that systematically since it applies to so much of LegalizerHelper right now.

4534

Not necessarily for the last register - since we appended Src1Left/Src2Left to the source registers the last register can be smaller

llvm/test/CodeGen/AArch64/GlobalISel/legalize-add.mir
110

Went with s65 since s33 will just be widened on aarch64 instead

arsenm accepted this revision.Mar 29 2021, 2:55 PM
This revision is now accepted and ready to land.Mar 29 2021, 2:55 PM
This revision was landed with ongoing or failed builds.Jun 8 2021, 10:14 AM
This revision was automatically updated to reflect the committed changes.
bogner marked 2 inline comments as done.