[Mesa-dev] [PATCH] gallivm: fix lp_build_compare_ext

Jose Fonseca jfonseca at vmware.com
Mon Jul 6 06:26:09 PDT 2015


On 04/07/15 07:15, Vinson Lee wrote:
> On Fri, Jul 3, 2015 at 6:05 PM,  <sroland at vmware.com> wrote:
>> From: Roland Scheidegger <sroland at vmware.com>
>>
>> The expansion should always be to the same width as the input arguments
>> no matter what, since these functions should work with any bit width of
>> the arguments (the sext is a no-op on any sane simd architecture).
>> Thus, fix the caller expecting differently.
>>
>> This fixes https://bugs.freedesktop.org/show_bug.cgi?id=91222 (not tested
>> otherwise)
>> ---
>>   src/gallium/auxiliary/gallivm/lp_bld_logic.c       | 2 +-
>>   src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c | 3 +++
>>   2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
>> index f724cfa..80b53e5 100644
>> --- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c
>> +++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c
>> @@ -81,7 +81,7 @@ lp_build_compare_ext(struct gallivm_state *gallivm,
>>                        boolean ordered)
>>   {
>>      LLVMBuilderRef builder = gallivm->builder;
>> -   LLVMTypeRef int_vec_type = lp_build_int_vec_type(gallivm, lp_type_int_vec(32, 32 * type.length));
>> +   LLVMTypeRef int_vec_type = lp_build_int_vec_type(gallivm, type);
>>      LLVMValueRef zeros = LLVMConstNull(int_vec_type);
>>      LLVMValueRef ones = LLVMConstAllOnes(int_vec_type);
>>      LLVMValueRef cond;
>> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
>> index 1f2af85..0ad78b0 100644
>> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
>> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
>> @@ -1961,8 +1961,11 @@ dset_emit_cpu(
>>      struct lp_build_emit_data * emit_data,
>>      unsigned pipe_func)
>>   {
>> +   LLVMBuilderRef builder = bld_base->base.gallivm->builder;
>>      LLVMValueRef cond = lp_build_cmp(&bld_base->dbl_bld, pipe_func,
>>                                       emit_data->args[0], emit_data->args[1]);
>> +   /* arguments were 64 bit but store as 32 bit */
>> +   cond = LLVMBuildTrunc(builder, cond, bld_base->int_bld.int_vec_type, "");
>>      emit_data->output[emit_data->chan] = cond;
>>   }
>>
>> --
>> 1.9.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
> Tested-by: Vinson Lee <vlee at freedesktop.org>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>


More information about the mesa-dev mailing list