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: d6a07732c9 ("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 30ac733680)
This commit is contained in:
Samuel Pitoiset 2020-02-26 15:09:40 +01:00 committed by Eric Engestrom
parent d0bfb09c67
commit 016b1e27b8
2 changed files with 5 additions and 3 deletions

View file

@ -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"
},

View file

@ -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);