[all-commits] [llvm/llvm-project] 282d5a: Add tests for BMI patterns across non-adjacent and...

goldsteinn via All-commits all-commits at lists.llvm.org
Mon Jan 16 22:09:56 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 282d5a5b063e09d059591778dd56ab351130e4d7
      https://github.com/llvm/llvm-project/commit/282d5a5b063e09d059591778dd56ab351130e4d7
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-01-16 (Mon, 16 Jan 2023)

  Changed paths:
    A llvm/test/CodeGen/X86/bmi-out-of-order.ll

  Log Message:
  -----------
  Add tests for BMI patterns across non-adjacent and assosiative instructions.

I.e for blsi match (and (sub 0, x), x) but we currently miss valid
patterns like (and (and (sub 0, x), y), x).

Reviewed By: pengfei

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


  Commit: 0b74e34938ba6cb89cbd197835219a6970ebaf39
      https://github.com/llvm/llvm-project/commit/0b74e34938ba6cb89cbd197835219a6970ebaf39
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-01-16 (Mon, 16 Jan 2023)

  Changed paths:
    M llvm/include/llvm/IR/IntrinsicsX86.td
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.h
    M llvm/lib/Target/X86/X86InstrCompiler.td
    M llvm/test/CodeGen/X86/atomic-rm-bit-test-64.ll
    M llvm/test/CodeGen/X86/atomic-rm-bit-test.ll

  Log Message:
  -----------
  Transform AtomicRMW logic operations to BT{R|C|S} if only changing/testing a single bit.

This is essentially expanding on the optimizations added on: D120199
but applies the optimization to cases where the bit being changed /
tested is not am IMM but is a provable power of 2.

The only case currently added for cases like:
`__atomic_fetch_xor(p, 1 << c, __ATOMIC_RELAXED) & (1 << c)`

Which instead of using a `cmpxchg` loop can be done with `btcl; setcc; shl`.

There are still a variety of missed cases that could/should be
addressed in the future. This commit documents many of those
cases with Todos.

Reviewed By: pengfei

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


Compare: https://github.com/llvm/llvm-project/compare/f4cce0f47b3e...0b74e34938ba


More information about the All-commits mailing list