[all-commits] [llvm/llvm-project] 86dcb5: [AMDGPU] Prefer v_fmac over v_fma only when no sou...

Jay Foad via All-commits all-commits at lists.llvm.org
Tue Sep 21 04:02:57 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 86dcb592069f2d18a183fa1daa611029ae80ef4c
      https://github.com/llvm/llvm-project/commit/86dcb592069f2d18a183fa1daa611029ae80ef4c
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2021-09-21 (Tue, 21 Sep 2021)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIInstructions.td
    M llvm/test/CodeGen/AMDGPU/GlobalISel/fdiv.f32.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/fma.ll
    M llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-fma.s32.mir
    M llvm/test/CodeGen/AMDGPU/dagcombine-fma-fmad.ll
    M llvm/test/CodeGen/AMDGPU/fdiv.ll
    M llvm/test/CodeGen/AMDGPU/fma.f64.ll
    M llvm/test/CodeGen/AMDGPU/fmad-formation-fmul-distribute-denormal-mode.ll
    M llvm/test/CodeGen/AMDGPU/fmuladd.f16.ll
    M llvm/test/CodeGen/AMDGPU/frem.ll
    M llvm/test/CodeGen/AMDGPU/mad-mix.ll
    M llvm/test/CodeGen/AMDGPU/strict_fma.f16.ll
    M llvm/test/CodeGen/AMDGPU/strict_fma.f32.ll
    M llvm/test/CodeGen/AMDGPU/udiv.ll

  Log Message:
  -----------
  [AMDGPU] Prefer v_fmac over v_fma only when no source modifiers are used

v_fmac with source modifiers forces VOP3 encoding, but it is strictly
better to use the VOP3-only v_fma instead, because $dst and $src2 are
not tied so it gives the register allocator more freedom and avoids a
copy in some cases.

This is the same strategy we already use for v_mad vs v_mac and
v_fma_legacy vs v_fmac_legacy.

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


  Commit: 598bebeaa645049d13f1d3d1c8b8b821bb97283f
      https://github.com/llvm/llvm-project/commit/598bebeaa645049d13f1d3d1c8b8b821bb97283f
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2021-09-21 (Tue, 21 Sep 2021)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
    M llvm/test/CodeGen/AMDGPU/fdiv.ll
    M llvm/test/CodeGen/AMDGPU/frem.ll

  Log Message:
  -----------
  [AMDGPU] Prefer fmac over fma when selecting FMA_W_CHAIN

FMA_W_CHAIN is used when lowering fdiv f32. Prefer to select it to fmac
if there are no source modifiers, just like we do for other mad/mac and
fma/fmac cases.

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


Compare: https://github.com/llvm/llvm-project/compare/e83629280f32...598bebeaa645


More information about the All-commits mailing list