Commit Graph

5 Commits

Author SHA1 Message Date
Sanjay Patel 4956f49847 [x86] shrink 'and' immediate values by setting the high bits (PR35907)
Try to reverse the constant-shrinking that happens in SimplifyDemandedBits()
for 'and' masks when it results in a smaller sign-extended immediate.

We are also able to detect dead 'and' ops here (the mask is all ones). In
that case, we replace and return without selecting the 'and'.

Other targets might want to share some of this logic by enabling this under a
target hook, but I didn't see diffs for simple cases with PowerPC or AArch64,
so they may already have some specialized logic for this kind of thing or have
different needs.

This should solve PR35907:
https://bugs.llvm.org/show_bug.cgi?id=35907

Differential Revision: https://reviews.llvm.org/D42088


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322957 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-19 16:37:25 +00:00
Sanjay Patel c96fe476db [x86] add tests to show missed constant shrinking (PR35907); NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322523 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 21:57:41 +00:00
Sanjay Patel 04df9eb428 [x86] regenerate test checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322522 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-15 21:32:39 +00:00
Elena Demikhovsky 558bab1214 Optimized loading (zextload) of i1 value from memory.
This patch is a partial revert of https://llvm.org/svn/llvm-project/llvm/trunk@237793.
Extra "and" causes performance degradation.

We assume that i1 is stored in zero-extended form. And store operation is responsible for zeroing upper bits.

Differential Revision: http://reviews.llvm.org/D17541



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261828 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-25 07:05:12 +00:00
Rafael Espindola 7c91cefac5 Use small encodings for constants when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242493 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-17 00:57:52 +00:00