This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC][GISel] Add initial GlobalISel support for vector functions.
ClosedPublic

Authored by amyk on Nov 10 2022, 6:20 AM.

Details

Summary

This patch adds the initial support for vector functions and register banks within GlobalISel.
With this patch, we are able to support simple functions that return vectors, and also
functions that perform simple operations.

This patch also:

  • Legalizes vector types for G_AND, G_OR, G_XOR, G_ADD, G_SUB, G_BITCAST, G_FADD, G_FSUB
  • Introduce initial support for bitcasting (that will need to be extended upon)
  • Add various different test cases to for test vector support within GlobalISel

Diff Detail

Event Timeline

amyk created this revision.Nov 10 2022, 6:20 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2022, 6:20 AM
amyk requested review of this revision.Nov 10 2022, 6:20 AM
arsenm added inline comments.Nov 15 2022, 6:32 PM
llvm/lib/Target/PowerPC/GISel/PPCRegisterBankInfo.cpp
66–67

Why bother with this then?

155–156

Don't bother asserting on things the verifier checks

159

Don't need to bother checking each size

168

There's no other opcode here

arsenm requested changes to this revision.Nov 16 2022, 3:18 PM
This revision now requires changes to proceed.Nov 16 2022, 3:18 PM
amyk updated this revision to Diff 476662.Nov 18 2022, 10:52 PM

Address review comments from @arsenm regarding removing unnecessary code for G_BITCAST.

arsenm accepted this revision.Nov 22 2022, 6:53 AM
This revision is now accepted and ready to land.Nov 22 2022, 6:53 AM
shchenz accepted this revision as: shchenz.Nov 22 2022, 5:36 PM

LGTM too with one minor question. Thanks very much.

llvm/lib/Target/PowerPC/GISel/PPCRegisterBanks.td
19

Maybe too early for this question as long double is not supported in globalisel for now. I see f128 is a type mapped to vector type register class VRRC, but to me, seems type f128 should be a scalar type?

amyk added inline comments.Nov 27 2022, 2:07 PM
llvm/lib/Target/PowerPC/GISel/PPCRegisterBanks.td
19

In the test cases for D137504 (implementing the default calling convention used for GlobalISel), it takes into account of two types of 128-bit floating point types.

  • fp128 is mapped to a vector type and will pass its values in registers.
  • ppc_fp128 will actually be split into two f64 scalars and will pass their values in floating point registers. I believe this is the scenario you are referencing in your comment, but please do correct me if I am misunderstanding.
shchenz added inline comments.Nov 28 2022, 11:36 PM
llvm/lib/Target/PowerPC/GISel/PPCRegisterBanks.td
19

Thanks for explanation.

amyk updated this revision to Diff 479798.Dec 2 2022, 8:04 PM

Rebase patch.

arsenm accepted this revision.Dec 13 2022, 2:36 PM
arsenm added inline comments.
llvm/lib/Target/PowerPC/GISel/PPCLegalizerInfo.cpp
28

Demorgan this

amyk updated this revision to Diff 491759.Jan 24 2023, 6:46 AM

Rebased patch, as well as demorgan a condition in PPCLegalizerInfo.cpp.

amyk marked an inline comment as done.Jan 24 2023, 6:46 AM
arsenm accepted this revision.Jan 25 2023, 11:34 AM
amyk updated this revision to Diff 492259.Jan 25 2023, 2:24 PM

Update revision to resolve failing test cases.

This revision was landed with ongoing or failed builds.Mar 27 2023, 6:23 AM
This revision was automatically updated to reflect the committed changes.