This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Implement narrowScalar for UADDO/USUBO
ClosedPublic

Authored by porglezomp on Feb 14 2021, 3:36 PM.

Diff Detail

Event Timeline

porglezomp created this revision.Feb 14 2021, 3:36 PM
porglezomp requested review of this revision.Feb 14 2021, 3:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2021, 3:36 PM
arsenm added inline comments.Feb 15 2021, 2:29 PM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
4488

I don't like using Optional for Register, a default constructed Register behaves like none

Change Optional<Register> to Register

arsenm added inline comments.Feb 17 2021, 11:44 AM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
4485

Might as well hard code the 2 here, treating it as unknown is slightly more confusing

4489

This must be exactly ==, > adds ambiguity

llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp
898

Should have a dedicated buildUAddo

935

We should have a dedicated buildUSubo

paquette added inline comments.Feb 17 2021, 1:21 PM
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
4485

I think this is supposed to be shared between the overflow ops/non-overflow ops, so it makes sense to not hardcode a 2.

I think a comment saying that this should be 1 or 2 would be handy though.

porglezomp added inline comments.Feb 17 2021, 6:19 PM
llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp
898

I wrote it this way to match the style of the surrounding tests. Which would we prefer here, better style, or more consistency? I'm already changing some other things in favor of better style in the new tests, so I wouldn't be opposed.

arsenm added inline comments.Feb 18 2021, 5:16 AM
llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp
898

Raw buildInstr is always uglier and only appropriate if you don't know the exact opcode you're using

Add comment about number of defs, change buildInstr

Change some ASSERT_TRUE to ASSERT_EQ

arsenm added inline comments.Feb 19 2021, 5:20 AM
llvm/unittests/CodeGen/GlobalISel/LegalizerHelperTest.cpp
903–904

It's a gtest-ism that these should be swapped to get the correct error message as EXPECT_EQ(expected, actual)

Flip argument order of EXPECT_EQ for better failure messages

ping on this one, since it's the first in the stack and blocking the others

arsenm accepted this revision.Feb 22 2021, 1:40 PM
This revision is now accepted and ready to land.Feb 22 2021, 1:40 PM
This revision was automatically updated to reflect the committed changes.