[Mesa-stable] [PATCH] gallivm: fix idiv

Roland Scheidegger sroland at vmware.com
Tue Sep 23 11:31:48 PDT 2014


Am 23.09.2014 20:27, schrieb Jose Fonseca:
> Sounds good.
> 
> The old commit wasn't crossported to stable branches right?
Yes it was...

> As rule of thumb, we should not crossport non-trivial patches we haven't ran through piglit to stable releases. 
That's true. Well it did fix a crash so it seemed appropriate for
stable. It did look trivial enough to me (as it was mostly a copy of the
udiv code - I guess it was a bit too much of a copy of it...) :-(.

Roland


> Jose
> 
> ________________________________________
> From: sroland at vmware.com <sroland at vmware.com>
> Sent: 23 September 2014 18:30
> To: Jose Fonseca; mesa-dev at lists.freedesktop.org
> Cc: Roland Scheidegger; 10.2 10.3
> Subject: [PATCH] gallivm: fix idiv
> 
> From: Roland Scheidegger <sroland at vmware.com>
> 
> ffeb77c7b0552a8624e46e65d6347240ac5ae84d had a typo which turned all signed
> integer divisions into unsigned ones. Oops.
> This gets us back the 51 little piglits
> (all from glsl built-in-functions, fs/vs/gs-op-div-int-ivec2 and similar).
> 
> Cc: "10.2 10.3" <mesa-stable at lists.freedesktop.org>
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
> index 4a9bc1f..722aa9a 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c
> @@ -1252,18 +1252,16 @@ idiv_emit_cpu(
>     LLVMValueRef div_mask = lp_build_cmp(&bld_base->uint_bld,
>                                          PIPE_FUNC_EQUAL, emit_data->args[1],
>                                          bld_base->uint_bld.zero);
> -   /* We want to make sure that we never divide/mod by zero to not
> -    * generate sigfpe. We don't want to crash just because the
> +   /* We want to make sure that we never divide/mod by zero to not
> +    * generate sigfpe. We don't want to crash just because the
>      * shader is doing something weird. */
>     LLVMValueRef divisor = LLVMBuildOr(builder,
>                                        div_mask,
>                                        emit_data->args[1], "");
> -   LLVMValueRef result = lp_build_div(&bld_base->uint_bld,
> +   LLVMValueRef result = lp_build_div(&bld_base->int_bld,
>                                        emit_data->args[0], divisor);
> -
>     LLVMValueRef not_div_mask = LLVMBuildNot(builder,
>                                              div_mask,"");
> -
>     /* idiv by zero doesn't have a guaranteed return value chose 0 for now. */
>     emit_data->output[emit_data->chan] = LLVMBuildAnd(builder,
>                                                       not_div_mask,
> @@ -1693,8 +1691,8 @@ udiv_emit_cpu(
>     LLVMValueRef div_mask = lp_build_cmp(&bld_base->uint_bld,
>                                          PIPE_FUNC_EQUAL, emit_data->args[1],
>                                          bld_base->uint_bld.zero);
> -   /* We want to make sure that we never divide/mod by zero to not
> -    * generate sigfpe. We don't want to crash just because the
> +   /* We want to make sure that we never divide/mod by zero to not
> +    * generate sigfpe. We don't want to crash just because the
>      * shader is doing something weird. */
>     LLVMValueRef divisor = LLVMBuildOr(builder,
>                                        div_mask,
> --
> 1.9.1
> 
> 



More information about the mesa-stable mailing list