[Mesa-dev] [PATCH] st/mesa: make sure to create a "clean" bool when doing i2b
Roland Scheidegger
sroland at vmware.com
Mon May 11 12:29:08 PDT 2015
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
As for b2i I'm not really convinced using INEG is preferable there.
Generally I'd favor logic ops over arithmetic any day.
I suppose backend probably need to try to recognize such patterns anyway
for best performance (so that for instance things like b2i->i2b should
be no-ops), and I just don't see that INEG using AND instead would help
much there in general. But I don't really know...
Roland
Am 11.05.2015 um 20:38 schrieb Ilia Mirkin:
> Could any of the Gallium folk R-b this? It's been this way since Bryan
> Cain introduced it... I don't think that there was a USNE/etc variant
> at the time.
>
> Also, what do people think of making b2i do INEG instead of AND? That
> should allow implementations to fold the neg into instructions that
> support it...
>
> On Thu, May 7, 2015 at 12:44 AM, Jason Ekstrand <jason at jlekstrand.net> wrote:
>> I know nothing about TGSI but this looks perfectly reasonable to me.
>>
>> Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
>>
>> On Wed, May 6, 2015 at 8:33 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>>> i2b has to work for all integers, not just 1. INEG would not necessarily
>>> result with all bits set, which is something that other operations can
>>> rely on by e.g. using AND (or INEG for b2i).
>>>
>>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>>> ---
>>>
>>> Found by observation. Noticed a weird pattern in the generated code,
>>> which led up to this.
>>>
>>> src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> index 93671ba..8a591b9 100644
>>> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
>>> @@ -1941,7 +1941,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
>>> break;
>>> case ir_unop_i2b:
>>> if (native_integers)
>>> - emit(ir, TGSI_OPCODE_INEG, result_dst, op[0]);
>>> + emit(ir, TGSI_OPCODE_USNE, result_dst, op[0], st_src_reg_for_int(0));
>>> else
>>> emit(ir, TGSI_OPCODE_SNE, result_dst, op[0], st_src_reg_for_float(0.0));
>>> break;
>>> --
>>> 2.3.6
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=O4w34vxMqlqGFay7yc5k7qGagzc6zNfaCipZfxo8cyA&s=SmX-YkZSIqJwQTJEPqGJ_urIagfbgjrmYRNPZwrVf9I&e=
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=O4w34vxMqlqGFay7yc5k7qGagzc6zNfaCipZfxo8cyA&s=SmX-YkZSIqJwQTJEPqGJ_urIagfbgjrmYRNPZwrVf9I&e=
>
More information about the mesa-dev
mailing list