This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Custom legalize i32 operations for RV64 to reduce signed extensions
ClosedPublic

Authored by shiva0217 on Jul 30 2019, 1:45 AM.

Details

Diff Detail

Repository
rL LLVM

Event Timeline

shiva0217 created this revision.Jul 30 2019, 1:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2019, 1:45 AM
lenary requested changes to this revision.Jul 30 2019, 8:06 AM

This does seem to simplify the code in both examples (eliminating ~5 instructions from both functions in rv64i-w-insts-legalization.ll, and turning others from op; sext.w into op.w, or sext.w into mv). I also think the operations in customLegalizeToWOpWithSExt do make sense, as a replacement.

I guess I'm slightly surprised that LLVM cannot manage to eliminate the sign extensions in these cases, but I didn't see anything in DagCombiner.cpp, so it makes sense that we have to do a custom lowering.

Some tests in test/CodeGen/RISCV/ are no longer passing. These can be updated by running utils/update_llc_test_checks.py. Please update the diff with the results of updating the 6 failing tests.

This revision now requires changes to proceed.Jul 30 2019, 8:06 AM
shiva0217 updated this revision to Diff 212490.Jul 30 2019, 6:38 PM

Updated the test cases changed by the patch.

Hi @lenary,
Thanks for the review.

lenary accepted this revision.Aug 5 2019, 7:59 AM

I'm happy with these changes. I realise this changes the tests that are looking for the w-patterns, but in every changed test, it seems the -w instructions are just as valid as the full 64-bit instructions.

This revision is now accepted and ready to land.Aug 5 2019, 7:59 AM
This revision was automatically updated to reflect the committed changes.