Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[x86] Improve select lowering for smin(x, 0) & smax(x, 0)
smin(x, 0): (select (x < 0), x, 0) -> ((x >> (size_in_bits(x)-1))) & x smax(x, 0): (select (x > 0), x, 0) -> (~(x >> (size_in_bits(x)-1))) & x The comparison is testing for a positive value, we have to invert the sign bit mask, so only do that transform if the target has a bitwise 'and not' instruction (the invert is free). The transform is performed only when CMP has a single user to avoid increasing total instruction number. https://alive2.llvm.org/ce/z/euUnNm https://alive2.llvm.org/ce/z/37339J Differential Revision: https://reviews.llvm.org/D123109
- Loading branch information
1 parent
674ee4d
commit 842d0bf
Showing
2 changed files
with
52 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters