summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2020-02-26 15:09:40 +0100
committerEric Engestrom <eric@engestrom.ch>2020-03-06 22:59:26 +0100
commit016b1e27b879a73f048308788e943e3b2bf5796a (patch)
treec958e22261dfc2b01b8092feb26c3f1a2f70eaac
parentd0bfb09c6789f1e3e1f736f884d743a7fcc59bfc (diff)
ac/llvm: fix 16-bit fmed3 on GFX8 and older gens
16-bit med3 is only supported on GFX9+. Fixes dEQP-VK.spirv_assembly.instruction.amd_trinary_minmax.mid3.f16.*. 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> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3962> (cherry picked from commit 30ac733680c3dfbfd1300c5498dd1b0c0a680905)
-rw-r--r--.pick_status.json2
-rw-r--r--src/amd/llvm/ac_llvm_build.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 2ab7391d93d..8b5a42165cb 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -3271,7 +3271,7 @@
"description": "ac/llvm: fix 16-bit 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 36eb1e316a5..d15927986d2 100644
--- a/src/amd/llvm/ac_llvm_build.c
+++ b/src/amd/llvm/ac_llvm_build.c
@@ -2700,8 +2700,10 @@ LLVMValueRef ac_build_fmed3(struct ac_llvm_context *ctx, LLVMValueRef src0,
{
LLVMValueRef result;
- if (bitsize == 64) {
- /* Lower 64-bit fmed because LLVM doesn't expose an intrinsic. */
+ if (bitsize == 64 || (bitsize == 16 && ctx->chip_class <= GFX8)) {
+ /* Lower 64-bit fmed because LLVM doesn't expose an intrinsic,
+ * or lower 16-bit fmed because it's only supported on GFX9+.
+ */
LLVMValueRef min1, min2, max1;
min1 = ac_build_fmin(ctx, src0, src1);