On 08/10/2016 12:50 PM, Eric Anholt wrote:
> Connor Abbott <cwabbo...@gmail.com> writes:
> 
>> On Wed, Aug 10, 2016 at 1:53 PM, Eric Anholt <e...@anholt.net> wrote:
>>> Kenneth Graunke <kenn...@whitecape.org> writes:
>>>
>>>> On Haswell (GL 3.3):
>>>>
>>>> total instructions in shared programs: 6208759 -> 6203860 (-0.08%)
>>>> instructions in affected programs: 856541 -> 851642 (-0.57%)
>>>> helped: 3157
>>>> HURT: 113
>>>> LOST:   7
>>>> GAINED: 15
>>>>
>>>> On Broadwell (GL 4.4):
>>>>
>>>> total instructions in shared programs: 11637854 -> 11632016 (-0.05%)
>>>> instructions in affected programs: 1055693 -> 1049855 (-0.55%)
>>>> helped: 3900
>>>> HURT: 176
>>>> LOST:   1
>>>> GAINED: 18
>>>>
>>>> Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
>>>> ---
>>>>  src/compiler/nir/nir_opt_algebraic.py | 4 ++++
>>>>  1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/src/compiler/nir/nir_opt_algebraic.py 
>>>> b/src/compiler/nir/nir_opt_algebraic.py
>>>> index 1cf614c..4e9896f 100644
>>>> --- a/src/compiler/nir/nir_opt_algebraic.py
>>>> +++ b/src/compiler/nir/nir_opt_algebraic.py
>>>> @@ -251,6 +251,10 @@ optimizations = [
>>>>     (('ieq', 'a@bool', False), ('inot', 'a')),
>>>>     (('bcsel', a, True, False), ('ine', a, 0)),
>>>>     (('bcsel', a, False, True), ('ieq', a, 0)),
>>>> +   (('bcsel@32', a, 1.0, 0.0), ('b2f', ('ine', a, 0))),
>>>> +   (('bcsel@32', a, 0.0, 1.0), ('b2f', ('ieq', a, 0))),
>>>> +   (('bcsel@32', a, -1.0, -0.0), ('fneg', ('b2f', ('ine', a, 0)))),
>>>> +   (('bcsel@32', a, -0.0, -1.0), ('fneg', ('b2f', ('ieq', a, 0)))),
>>>
>>> Isn't bcsel's first arg guaranteed to be 0 or ~0?  I thought that was
>>> how nir's bcsel (and b2f) worked.  If not, it would be good to see this
>>> documented.
>>
>> Yes, any ALU operation that takes a boolean input can expect it to be
>> 0 or ~0. If that isn't true, then something else in the compiler has
>> messed up. So I think we can replace 'a != 0' with 'a' and 'a == 0'
>> with '!a'.
> 
> Yeah.  So, I like the contents of this series a lot, but it would be
> nice to see some of the @bool annotations dropped.

Right... because ('b2f', 'a@bool') is redundant.  I agree.

> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to