gallivm: handle 16-bit input in i2b32

Fixes: dac8cb981f ("gallivm/nir: allow 8/16-bit conversion and comparison.")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10185>
(cherry picked from commit da5f346e6c)
This commit is contained in:
Erik Faye-Lund 2021-04-12 16:20:06 +02:00 committed by Eric Engestrom
parent 46b9602c75
commit 87fe4028c3
2 changed files with 4 additions and 2 deletions

View file

@ -229,7 +229,7 @@
"description": "gallivm: handle 16-bit input in i2b32",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "dac8cb981f4f2951a14e16851d59fb8d49a3e19b"
},

View file

@ -206,7 +206,9 @@ static LLVMValueRef int_to_bool32(struct lp_build_nir_context *bld_base,
LLVMBuilderRef builder = bld_base->base.gallivm->builder;
struct lp_build_context *int_bld = get_int_bld(bld_base, is_unsigned, src_bit_size);
LLVMValueRef result = lp_build_compare(bld_base->base.gallivm, int_bld->type, PIPE_FUNC_NOTEQUAL, val, int_bld->zero);
if (src_bit_size == 64)
if (src_bit_size == 16)
result = LLVMBuildSExt(builder, result, bld_base->int_bld.vec_type, "");
else if (src_bit_size == 64)
result = LLVMBuildTrunc(builder, result, bld_base->int_bld.vec_type, "");
return result;
}