Page MenuHomePhabricator

[MIPS GlobalISel] NarrowScalar G_MUL
ClosedPublic

Authored by Petar.Avramovic on Mar 1 2019, 6:25 AM.

Details

Summary

Narrow Scalar G_MUL for MIPS32.
Revisit NarrowScalar implementation in LegalizerHelper.
Introduce new helper function MultiplyRegisters.
It performs generic multiplication of values held in multiple registers.
Generated instructions use only types NarrowTy and i1.
Destination can be same or two times size of the source.

Diff Detail

Repository
rL LLVM

Event Timeline

Petar.Avramovic created this revision.Mar 1 2019, 6:25 AM
arsenm added inline comments.Mar 1 2019, 12:55 PM
include/llvm/CodeGen/GlobalISel/LegalizerHelper.h
169 ↗(On Diff #188897)

Should start with lower case

174 ↗(On Diff #188897)

ditto

lib/CodeGen/GlobalISel/LegalizerHelper.cpp
2547–2554 ↗(On Diff #188897)

This function doesn't particularly make sense to me as a general legalizer helper function, especially with the arbitrary choice of extending.

I think a buildUaddo should be added to MachineIRBuilder, and then the places using it just need something like
auto Carry = MIRBuilder.buildZext(MIRBuilder.buildUaddo({Ty, s1}, {src0, src1}).getReg(1))

2598 ↗(On Diff #188897)

You can avoid these explicit create calls by passing the type to the build*functions

Addressed review comments.

arsenm added inline comments.Mar 6 2019, 9:02 AM
lib/CodeGen/GlobalISel/LegalizerHelper.cpp
2573–2575 ↗(On Diff #189465)

Variable to avoid weird wrapping

2585–2600 ↗(On Diff #189465)

The formatting of this is weird. This looks like the horrors clang-format produces, so some intermediate variables might help

2592 ↗(On Diff #189465)

You can still avoid this by saving the result of buildUAddo

Addressed review comments.

arsenm accepted this revision.Mar 7 2019, 11:41 AM

LGTM

This revision is now accepted and ready to land.Mar 7 2019, 11:41 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2019, 3:01 AM