commit | 33766d28542eb59888636d6df4237ab0bbdac699 | [log] [tgz] |
---|---|---|
author | Roman Lebedev <lebedev.ri@gmail.com> | Wed Jun 06 19:38:16 2018 +0000 |
committer | Roman Lebedev <lebedev.ri@gmail.com> | Wed Jun 06 19:38:16 2018 +0000 |
tree | 273482dd67e9aafb07ab6ea7872d02e186d94032 | |
parent | 300d3c160268db02189e80ad52909d3342bb5d21 [diff] |
[X86] Emit BZHI when mask is ~(-1 << nbits)) Summary: In D47428, i propose to choose the `~(-(1 << nbits))` as the canonical form of low-bit-mask formation. As it is seen from these tests, there is a reason for that. AArch64 currently better handles `~(-(1 << nbits))`, but not the more traditional `(1 << nbits) - 1` (sic!). The other way around for X86. It would be much better to canonicalize. This patch is completely monkey-typing. I don't really understand how this works :) I have based it on `// x & (-1 >> (32 - y))` pattern. Also, when we only have `BMI`, i wonder if we could use `BEXTR` with `start=0` ? Related links: https://bugs.llvm.org/show_bug.cgi?id=36419 https://bugs.llvm.org/show_bug.cgi?id=37603 https://bugs.llvm.org/show_bug.cgi?id=37610 https://rise4fun.com/Alive/idM Reviewers: craig.topper, spatel, RKSimon, javed.absar Reviewed By: craig.topper Subscribers: kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D47453 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334125 91177308-0d34-0410-b5e6-96231b3b80d8