summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2020-02-26 15:12:55 +0100
committerEric Engestrom <eric@engestrom.ch>2020-03-06 22:59:27 +0100
commit0bea36c204b78198ea613adb147527c6fa231ae3 (patch)
tree1778fc9f0b8eb7b67680b7e7731948dcc8f42fb6
parent016b1e27b879a73f048308788e943e3b2bf5796a (diff)
ac/llvm: flush denorms for nir_op_fmed3 on GFX8 and older gens
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> (cherry picked from commit 9e5d2a73c5fc12841b62758a035b2bdb191b3f86)
-rw-r--r--.pick_status.json2
-rw-r--r--src/amd/llvm/ac_llvm_build.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 8b5a42165cb..909216f47f8 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -3262,7 +3262,7 @@
"description": "ac/llvm: flush denorms for nir_op_fmed3 on GFX8 and older gens",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "d6a07732c9c155c73f7d2cddc10faa7eab768df9"
},
diff --git a/src/amd/llvm/ac_llvm_build.c b/src/amd/llvm/ac_llvm_build.c
index d15927986d2..ac322a82805 100644
--- a/src/amd/llvm/ac_llvm_build.c
+++ b/src/amd/llvm/ac_llvm_build.c
@@ -2734,6 +2734,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;
}