[all-commits] [llvm/llvm-project] ca1154: AMDGPU: Disable pattern matching "x<<32-y>>32-y" t...

Changpeng Fang via All-commits all-commits at lists.llvm.org
Wed Oct 30 11:07:36 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ca1154d1d41c75db6594428a8cdf263cf7041896
      https://github.com/llvm/llvm-project/commit/ca1154d1d41c75db6594428a8cdf263cf7041896
  Author: Changpeng Fang <changpeng.fang at amd.com>
  Date:   2024-10-30 (Wed, 30 Oct 2024)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIInstructions.td
    M llvm/test/CodeGen/AMDGPU/bfe-patterns.ll
    M llvm/test/CodeGen/AMDGPU/extract-lowbits.ll

  Log Message:
  -----------
  AMDGPU: Disable pattern matching "x<<32-y>>32-y" to "bfe x, 0, y" (#114279)

It is not correct to lower "x<<32-y>>32-y" to "bfe x, 0, y". When y
equals to 32, the left-hand side is still x (unchanged), however, the
right-hand side will be evaluated to 0. So it is not always correct to
do such transformation.

We may be able to keep the pattern for immediate y while y is within [0,
31]. However, the immediate operands of the sub (32 - y) are easily
folded, and "(x << imm) >> imm" will be lowered to "and x,
(2^(32-imm))-1" anyway. So no bfe matching is needed.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list