ac/llvm: flush denorms for nir_op_fmed3 on GFX8 and older gens
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 26 Feb 2020 14:12:55 +0000 (15:12 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 27 Feb 2020 07:04:33 +0000 (08:04 +0100)
The hardware doesn't flush denorms, exactly like fmin/fmax, so
we have to do it manually. This doesn't fix anything known.

Fixes: d6a07732c9c ("ac: use llvm.amdgcn.fmed3 intrinsic for nir_op_fmed3")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3962>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3962>

src/amd/llvm/ac_llvm_build.c

index 116abf942c23adc2a88d96441e6f2d50d6ed9650..2531c5740e022556ba81a557c55eddb47df7b921 100644 (file)
@@ -2759,6 +2759,11 @@ LLVMValueRef ac_build_fmed3(struct ac_llvm_context *ctx, LLVMValueRef src0,
                                            AC_FUNC_ATTR_READNONE);
        }
 
+       if (ctx->chip_class < GFX9 && bitsize == 32) {
+               /* Only pre-GFX9 chips do not flush denorms. */
+               result = ac_build_canonicalize(ctx, result, bitsize);
+       }
+
        return result;
 }