[PATCH] D52978: [TargetLowering][RISCV] Introduce isSExtCheaperThanZExt hook and implement for RISC-V

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 8 03:35:28 PDT 2018


asb created this revision.
asb added reviewers: eli.friedman, bogner, spatel.
Herald added subscribers: jocewei, PkmX, rkruppe, the_o, brucehoult, MartinMosbeck, rogfer01, mgrang, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, apazos, simoncook, johnrusso, rbar.
asb updated this revision to Diff 168635.
asb added a comment.

Update to attache the correct diff this time.


DAGTypeLegalizer::PromoteSetCCOperands currently prefers to zero-extend operands when it is able to do so. For some targets this is more expensive than a sign-extension, which is also a valid choice. Introduce the isSExtCheaperThanZExt hook and use it in the new SExtOrZExtPromotedInteger helper. On RISC-V, we prefer sign-extension for FromTy == MVT::i32 and ToTy == MVT::i64, as it can be performed using a single instruction.


https://reviews.llvm.org/D52978

Files:
  include/llvm/CodeGen/TargetLowering.h
  lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  lib/CodeGen/SelectionDAG/LegalizeTypes.h
  lib/Target/RISCV/RISCVISelLowering.cpp
  lib/Target/RISCV/RISCVISelLowering.h
  test/CodeGen/RISCV/alu32.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52978.168635.patch
Type: text/x-patch
Size: 5350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181008/73d023fe/attachment.bin>


More information about the llvm-commits mailing list