[Mesa-dev] [PATCH] r600/sb: Fix an &/&& mistake

Tobias Droste tdroste at gmx.de
Tue Jul 21 12:05:28 PDT 2015


Just FYI:
http://lists.freedesktop.org/archives/mesa-dev/2015-June/085869.html

Am Dienstag, 21. Juli 2015, 12:12:33 schrieb Adam Jackson:
> gcc says:
> 
>     sb/sb_sched.cpp: In member function 'bool r600_sb::alu_group_tracker::try_reserve(r600_sb::alu_node*)':
>     sb/sb_sched.cpp:492:7: warning: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '~' [-Wparentheses]
>       if (!trans & fbs)
> 
> It happens to be harmless; if fbs is ever non-zero, it will be VEC_210,
> which is 5, so (!trans & 5) == 1 and the branch works as expected.  But
> logical AND is clearly what was meant.
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  src/gallium/drivers/r600/sb/sb_sched.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/r600/sb/sb_sched.cpp b/src/gallium/drivers/r600/sb/sb_sched.cpp
> index 2e38a62..6268078 100644
> --- a/src/gallium/drivers/r600/sb/sb_sched.cpp
> +++ b/src/gallium/drivers/r600/sb/sb_sched.cpp
> @@ -489,7 +489,7 @@ bool alu_group_tracker::try_reserve(alu_node* n) {
>  
>  	n->bc.bank_swizzle = 0;
>  
> -	if (!trans & fbs)
> +	if (!trans && fbs)
>  		n->bc.bank_swizzle = VEC_210;
>  
>  	if (gpr.try_reserve(n)) {
> 



More information about the mesa-dev mailing list