[all-commits] [llvm/llvm-project] 832c87: [AMDGPU] Use S_BITCMP0_* to replace AND in optimiz...

Stanislav Mekhanoshin via All-commits all-commits at lists.llvm.org
Thu Sep 2 09:38:20 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 832c87b4fbc820590704eaf02572dff762650a98
      https://github.com/llvm/llvm-project/commit/832c87b4fbc820590704eaf02572dff762650a98
  Author: Stanislav Mekhanoshin <Stanislav.Mekhanoshin at amd.com>
  Date:   2021-09-02 (Thu, 02 Sep 2021)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
    M llvm/test/CodeGen/AMDGPU/optimize-compare.mir

  Log Message:
  -----------
  [AMDGPU] Use S_BITCMP0_* to replace AND in optimizeCompareInstr

These can be used for reversed conditions if result of the AND
is unused except in the compare:

s_cmp_eq_u32 (s_and_b32 $src, 1), 0 => s_bitcmp0_b32 $src, 0
s_cmp_eq_i32 (s_and_b32 $src, 1), 0 => s_bitcmp0_b32 $src, 0
s_cmp_eq_u64 (s_and_b64 $src, 1), 0 => s_bitcmp0_b64 $src, 0
s_cmp_lg_u32 (s_and_b32 $src, 1), 1 => s_bitcmp0_b32 $src, 0
s_cmp_lg_i32 (s_and_b32 $src, 1), 1 => s_bitcmp0_b32 $src, 0
s_cmp_lg_u64 (s_and_b64 $src, 1), 1 => s_bitcmp0_b64 $src, 0

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




More information about the All-commits mailing list