[all-commits] [llvm/llvm-project] 2949ba: [X86] Add test case to demonstrate a Log2_32_Ceil ...

topperc via All-commits all-commits at lists.llvm.org
Wed Oct 14 10:24:32 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 2949baec3cc84cc6640f70d1f8aa3153c953b26a
      https://github.com/llvm/llvm-project/commit/2949baec3cc84cc6640f70d1f8aa3153c953b26a
  Author: Craig Topper <craig.topper at intel.com>
  Date:   2020-10-14 (Wed, 14 Oct 2020)

  Changed paths:
    M llvm/test/CodeGen/X86/ctpop-combine.ll

  Log Message:
  -----------
  [X86] Add test case to demonstrate a Log2_32_Ceil that can just be Log2_32 in SimplifySetCC ctpop combine.

This combine can look through (trunc (ctpop X)). When doing this
it tries to make sure the trunc doesn't lose any information
from the ctpop. It does this by checking that the truncated type
has more bits that Log2_32_Ceil of the ctpop type. The Ceil is
unnecessary and pessimizes non-power of 2 types.

For example, ctpop of i256 requires 9 bits to represent the max
value of 256. But ctpop of i255 only requires 8 bits to represent
the max result of 255. Log2_32_Ceil of 256 and 255 both return 8
while Log2_32 returns 8 for 256 and 7 for 255.




More information about the All-commits mailing list