[all-commits] [llvm/llvm-project] 28d888: AMDGPU: Teach fneg combines that select has source...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Sun Feb 19 16:13:52 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 28d8889d272590856e7e270aff66de080225d501
      https://github.com/llvm/llvm-project/commit/28d8889d272590856e7e270aff66de080225d501
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2023-02-19 (Sun, 19 Feb 2023)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
    M llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h
    M llvm/test/CodeGen/AMDGPU/fmin_fmax_legacy.amdgcn.ll
    M llvm/test/CodeGen/AMDGPU/fneg-combines.ll
    M llvm/test/CodeGen/AMDGPU/fneg-combines.new.ll
    M llvm/test/CodeGen/AMDGPU/select-fabs-fneg-extract-legacy.ll
    M llvm/test/CodeGen/AMDGPU/select-fabs-fneg-extract.f16.ll
    M llvm/test/CodeGen/AMDGPU/select-fabs-fneg-extract.legal.f16.ll
    M llvm/test/CodeGen/AMDGPU/select-fabs-fneg-extract.ll

  Log Message:
  -----------
  AMDGPU: Teach fneg combines that select has source modifiers

We do match source modifiers for f32 typed selects already, but the
combiner code was never informed of this.

A long time ago the documentation lied and stated that source
modifiers don't work for v_cndmask_b32 when they in fact do. We had a
bunch fo code operating under the assumption that they don't support
source modifiers, so we tried to move fnegs around to work around
this.

Gets a few small improvements here and there. The main hazard to watch
out for is infinite loops in the combiner since we try to move fnegs
up and down the DAG. For now, don't fold fneg directly into select.
The generic combiner does this for a restricted set of cases
when getNegatedExpression obviously shows an improvement for both
operands. It turns out to be trickier to avoid infinite looping the
combiner in conjunction with pulling out source modifiers, so
leave this for a later commit.




More information about the All-commits mailing list