[all-commits] [llvm/llvm-project] 1ce026: [InstCombine] Add tests for equality `icmp` with r...

goldsteinn via All-commits all-commits at lists.llvm.org
Sat Jun 10 12:39:10 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1ce0265230c0810589fabdaed7150f4fb737b34f
      https://github.com/llvm/llvm-project/commit/1ce0265230c0810589fabdaed7150f4fb737b34f
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-06-10 (Sat, 10 Jun 2023)

  Changed paths:
    A llvm/test/Transforms/InstCombine/icmp-equality-rotate.ll

  Log Message:
  -----------
  [InstCombine] Add tests for equality `icmp` with rotates; NFC

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


  Commit: 2df6309555963fb9411ed8023a8e585f7981b3bf
      https://github.com/llvm/llvm-project/commit/2df6309555963fb9411ed8023a8e585f7981b3bf
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-06-10 (Sat, 10 Jun 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp-equality-rotate.ll
    M llvm/test/Transforms/InstCombine/icmp-rotate.ll

  Log Message:
  -----------
  [InstCombine] Transform (icmp eq/ne rotate(X,AX),rotate(Y,AY)) -> (icmp eq/ne rotate(Y,AX-AY))

Only do so if we don't create more instructions, so either both
rotates have one use or one of the rotates has one use and both `AX`
and `AY` are constant.
Proof: https://alive2.llvm.org/ce/z/rVmJgz

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


  Commit: 5189eff3459c4e60e7fd772b208b187eeef7e115
      https://github.com/llvm/llvm-project/commit/5189eff3459c4e60e7fd772b208b187eeef7e115
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-06-10 (Sat, 10 Jun 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/icmp-equality-rotate.ll

  Log Message:
  -----------
  [InstCombine] Canonicalize (icmp eq/ne X, rotate(X)) to always use rotate-left

We canonicalize rotate-right -> rotate-left in other places. Makes
sense to do so here as well.
Proof: https://alive2.llvm.org/ce/z/HL3TpK

Reviewed By: nikic

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


  Commit: b6808ba291fcb5ff2e0d651e9e710f3d75631bc4
      https://github.com/llvm/llvm-project/commit/b6808ba291fcb5ff2e0d651e9e710f3d75631bc4
  Author: Noah Goldstein <goldstein.w.n at gmail.com>
  Date:   2023-06-10 (Sat, 10 Jun 2023)

  Changed paths:
    M llvm/lib/Target/X86/X86.td
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86TargetTransformInfo.h
    M llvm/test/CodeGen/X86/avx512-broadcast-unfold.ll
    M llvm/test/CodeGen/X86/combine-add.ll
    M llvm/test/CodeGen/X86/rotate-extract-vector.ll
    M llvm/test/CodeGen/X86/vector-idiv-sdiv-128.ll
    M llvm/test/CodeGen/X86/vector-idiv-sdiv-256.ll
    M llvm/test/CodeGen/X86/vector-idiv-sdiv-512.ll
    M llvm/test/CodeGen/X86/vector-idiv-udiv-128.ll
    M llvm/test/CodeGen/X86/vector-idiv-udiv-256.ll
    M llvm/test/CodeGen/X86/vector-idiv-udiv-512.ll
    M llvm/test/CodeGen/X86/vector-mul.ll

  Log Message:
  -----------
  [X86] Make constant `mul` -> `shl` + `add`/`sub` work for vector types

Something like:
    `%r = mul %x, <33, 33, 33, ...>`

Is best lowered as:
    `%tmp = %shl x, <5, 5, 5>; %r = add %tmp, %x`

As well, since vectors have non-destructive shifts, we can also do
cases where the multiply constant is `Pow2A +/- Pow2B` for arbitrary A
and B, unlike in the scalar case where the extra `mov` instructions
make it not worth it.

Reviewed By: pengfei

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


Compare: https://github.com/llvm/llvm-project/compare/211efbb1983c...b6808ba291fc


More information about the All-commits mailing list