diff mbox series

ARC: bitops: Remove unecessary operation and value

Message ID 21124fbdd2ebfe150cc750f673a31e89d6fe5752.1603314740.git.gustavo.pimentel@synopsys.com
State New
Headers show
Series ARC: bitops: Remove unecessary operation and value | expand

Commit Message

Gustavo Pimentel Oct. 21, 2020, 9:12 p.m. UTC
The 1-bit shift rotation to the left on x variable located on
4   last if statement can be removed because the computed value is will
not be used afront.

Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
 arch/arc/include/asm/bitops.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Vineet Gupta Nov. 5, 2020, 11:16 p.m. UTC | #1
On 10/21/20 2:12 PM, Gustavo Pimentel wrote:
> The 1-bit shift rotation to the left on x variable located on
> 4   last if statement can be removed because the computed value is will
> not be used afront.

All of constant_fls() is anyhow optimized away at compile time, so this 
won't affect any code-gen at all, still this patch is legit.

> Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>

Added to for-curr !

Thx,
-Vineet

> ---
>   arch/arc/include/asm/bitops.h | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h
> index 50eb3f6..8cddddc 100644
> --- a/arch/arc/include/asm/bitops.h
> +++ b/arch/arc/include/asm/bitops.h
> @@ -297,10 +297,8 @@ static inline int constant_fls(unsigned int x)
>   		x <<= 2;
>   		r -= 2;
>   	}
> -	if (!(x & 0x80000000u)) {
> -		x <<= 1;
> +	if (!(x & 0x80000000u))
>   		r -= 1;
> -	}
>   	return r;
>   }
>
diff mbox series

Patch

diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h
index 50eb3f6..8cddddc 100644
--- a/arch/arc/include/asm/bitops.h
+++ b/arch/arc/include/asm/bitops.h
@@ -297,10 +297,8 @@  static inline int constant_fls(unsigned int x)
 		x <<= 2;
 		r -= 2;
 	}
-	if (!(x & 0x80000000u)) {
-		x <<= 1;
+	if (!(x & 0x80000000u))
 		r -= 1;
-	}
 	return r;
 }