[all-commits] [llvm/llvm-project] 1cc8a7: [X86] Use carry flag from add for (seteq (add X, -...

topperc via All-commits all-commits at lists.llvm.org
Tue Dec 31 15:22:41 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 1cc8a74de345b66fd340ddc71580ad412e8e2abf
      https://github.com/llvm/llvm-project/commit/1cc8a74de345b66fd340ddc71580ad412e8e2abf
  Author: Craig Topper <craig.topper at intel.com>
  Date:   2019-12-31 (Tue, 31 Dec 2019)

  Changed paths:
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/test/CodeGen/X86/pr44412.ll

  Log Message:
  -----------
  [X86] Use carry flag from add for (seteq (add X, -1), -1).

If we just subtracted 1 and are checking if the result is -1. We can use the carry flag from the ADD instead of an explicit CMP. I'm using the same checks for the add users as EmitTest.

Fixes one case from PR44412

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


  Commit: 374e0299cf08dc1ff2c68e7f6c159b98ab55dfb8
      https://github.com/llvm/llvm-project/commit/374e0299cf08dc1ff2c68e7f6c159b98ab55dfb8
  Author: Craig Topper <craig.topper at intel.com>
  Date:   2019-12-31 (Tue, 31 Dec 2019)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
    M llvm/test/Transforms/InstCombine/X86/x86-bmi-tbm.ll

  Log Message:
  -----------
  [X86][InstCombine] Add constant folding and simplification support for pdep and pext

The instructions use a mask to either pack disjoint bits together(pext) or spread bits to disjoint locations(pdep). If the mask is all 0s then no bits are extracted or deposited. If the mask is all ones, then the source value is written to the result since no compression or expansion happens. Otherwise if both the source and mask are constant we can walk the bits in the source/mask and calculate the result.

There other crazier things we could do like computeKnownBits or turning pext into shift/and if only a single contiguous range of bits is extracted.

Fixes PR44389

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


Compare: https://github.com/llvm/llvm-project/compare/4ae3120ed81c...374e0299cf08


More information about the All-commits mailing list