[TargetLowering] Better code generation for ISD::SADDSAT/SSUBSAT when operand sign...
authorDhruv Chawla <44582521+dc03@users.noreply.github.com>
Thu, 22 Jun 2023 17:02:01 +0000 (22:32 +0530)
committerDhruv Chawla <44582521+dc03@users.noreply.github.com>
Fri, 23 Jun 2023 07:50:36 +0000 (13:20 +0530)
commit3f77724de7bc84f5f6a89b81de990b2c49f93953
tree144d6c84d3dea6bfc1d5e7b70260581a6fc3c851
parent911df1e8ddfe31fdd2536f8a73628d53b3dd5ef6
[TargetLowering] Better code generation for ISD::SADDSAT/SSUBSAT when operand sign is known

When the sign of either of the operands is known, it is possible to
determine what the saturating value will be without having to compute it
using the sign bits.

Differential Revision: https://reviews.llvm.org/D153575
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/test/CodeGen/AArch64/aarch64-saturating-arithmetic.ll
llvm/test/CodeGen/X86/combine-add-ssat.ll