[PATCH] D68926: [Codegen] Alter the default promotion for add_sat and sub_sat

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 02:11:01 PDT 2019


dmgreen created this revision.
dmgreen added reviewers: nikic, leonardchan, craig.topper, RKSimon, efriedma.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.

This is round 2 of D68643 <https://reviews.llvm.org/D68643>. The values were not being sign extended or zero extended correctly, which could lead to incorrect results when the incoming values were not already extended. They are needed because the min/max need no superfluous values in the higher bits.

I've fixed that and added some extra tests. Not everything here is an improvement (although most of it still is). Some of the i4 cases look slightly larger, but this may be improved in cases where the extend can become free (from a load, for example).


https://reviews.llvm.org/D68926

Files:
  llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
  llvm/test/CodeGen/AArch64/sadd_sat.ll
  llvm/test/CodeGen/AArch64/sadd_sat_plus.ll
  llvm/test/CodeGen/AArch64/sadd_sat_vec.ll
  llvm/test/CodeGen/AArch64/ssub_sat.ll
  llvm/test/CodeGen/AArch64/ssub_sat_plus.ll
  llvm/test/CodeGen/AArch64/ssub_sat_vec.ll
  llvm/test/CodeGen/AArch64/uadd_sat.ll
  llvm/test/CodeGen/AArch64/uadd_sat_plus.ll
  llvm/test/CodeGen/AArch64/uadd_sat_vec.ll
  llvm/test/CodeGen/AArch64/usub_sat.ll
  llvm/test/CodeGen/AArch64/usub_sat_plus.ll
  llvm/test/CodeGen/AArch64/usub_sat_vec.ll
  llvm/test/CodeGen/ARM/sadd_sat.ll
  llvm/test/CodeGen/ARM/sadd_sat_plus.ll
  llvm/test/CodeGen/ARM/ssub_sat.ll
  llvm/test/CodeGen/ARM/ssub_sat_plus.ll
  llvm/test/CodeGen/ARM/uadd_sat.ll
  llvm/test/CodeGen/ARM/uadd_sat_plus.ll
  llvm/test/CodeGen/ARM/usub_sat.ll
  llvm/test/CodeGen/ARM/usub_sat_plus.ll
  llvm/test/CodeGen/X86/sadd_sat.ll
  llvm/test/CodeGen/X86/sadd_sat_plus.ll
  llvm/test/CodeGen/X86/ssub_sat.ll
  llvm/test/CodeGen/X86/ssub_sat_plus.ll
  llvm/test/CodeGen/X86/uadd_sat.ll
  llvm/test/CodeGen/X86/uadd_sat_plus.ll
  llvm/test/CodeGen/X86/usub_sat.ll
  llvm/test/CodeGen/X86/usub_sat_plus.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68926.224774.patch
Type: text/x-patch
Size: 121389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191013/226f7f72/attachment-0001.bin>


More information about the llvm-commits mailing list