Page MenuHomePhabricator

[RISCV] Improve legalization of i32 UADDO/USUBO on RV64.
ClosedPublic

Authored by craig.topper on Mar 8 2021, 9:03 PM.

Details

Summary

The default legalization uses zero extends that require pair of shifts
on RISCV. Instead we can take advantage of the fact that unsigned
compares work equally well on sign extended inputs. This allows
us to use addw/subw and sext.w.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 8 2021, 9:03 PM
craig.topper requested review of this revision.Mar 8 2021, 9:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 8 2021, 9:03 PM
Herald added a subscriber: MaskRay. · View Herald Transcript

clang-format

Improve comment

craig.topper added inline comments.Mar 9 2021, 9:32 AM
llvm/test/CodeGen/RISCV/xaluo.ll
221

This add isn't needed. We could use the addw. I suspect this is SimplifyDemandedBits dropping the sign_extend_inreg on the store use. This causes isel to match sign_extend_inreg+add to addw for one path, but still leaving the add to be matched alone.

This revision is now accepted and ready to land.Mar 15 2021, 2:42 AM