[all-commits] [llvm/llvm-project] 89c8c8: AMDGPU: Change pre-gfx9 implementation of fcanonic...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Thu Apr 23 12:24:34 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 89c8c80bd52a62bede621d075eeb16f03a058b0e
      https://github.com/llvm/llvm-project/commit/89c8c80bd52a62bede621d075eeb16f03a058b0e
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2020-04-23 (Thu, 23 Apr 2020)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPU.td
    M llvm/lib/Target/AMDGPU/AMDGPUInstructions.td
    M llvm/lib/Target/AMDGPU/SIInstructions.td
    M llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-fcanonicalize.mir
    M llvm/test/CodeGen/AMDGPU/amdgcn-ieee.ll
    M llvm/test/CodeGen/AMDGPU/clamp.ll
    M llvm/test/CodeGen/AMDGPU/fcanonicalize-elimination.ll
    M llvm/test/CodeGen/AMDGPU/fcanonicalize.f16.ll
    M llvm/test/CodeGen/AMDGPU/fcanonicalize.ll
    M llvm/test/CodeGen/AMDGPU/fminnum.f64.ll

  Log Message:
  -----------
  AMDGPU: Change pre-gfx9 implementation of fcanonicalize to mul

If f32 denormals were enabled pre-gfx9, we would still try to
implement this with v_max_f32. Pre-gfx9, these instructions ignored
the denormal mode and did not flush. Switch to the multiply form for
f32 as a workaround which should always work in any case.

This fixes conformance failures when the library implementation of
fmin/fmax were accidentally not inlined, forcing the assumption of no
flushing on targets where denormals are not enabled by default. This
is a workaround, since really we should not be mixing code with
different FP mode expectations, but prefer the lowering that will work
in any mode.

Now this will always use max to implement canonicalize on gfx9+. This
is only really beneficial for f64. For f32/f16 it's a neutral choice
(and worse in terms of code size in 1 case), but possibly worse for
the compiler since it does add an extra register use operand. Leave
this change for later.




More information about the All-commits mailing list