Custom legalize add, sub, mul operations with i32 type for RV64 to reduce signed extensions.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
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.
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.