mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARC: bitops: Remove unecessary operation and value
@ 2020-10-21 21:12 Gustavo Pimentel
  2020-11-05 23:16 ` Vineet Gupta
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo Pimentel @ 2020-10-21 21:12 UTC (permalink / raw)
  To: Vineet Gupta; +Cc: Joao Pinto, Gustavo Pimentel, linux-snps-arc, linux-kernel

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(-)

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;
 }
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARC: bitops: Remove unecessary operation and value
  2020-10-21 21:12 [PATCH] ARC: bitops: Remove unecessary operation and value Gustavo Pimentel
@ 2020-11-05 23:16 ` Vineet Gupta
  0 siblings, 0 replies; 2+ messages in thread
From: Vineet Gupta @ 2020-11-05 23:16 UTC (permalink / raw)
  To: Gustavo Pimentel; +Cc: Joao Pinto, linux-snps-arc, linux-kernel

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;
>   }
>   


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-05 23:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 21:12 [PATCH] ARC: bitops: Remove unecessary operation and value Gustavo Pimentel
2020-11-05 23:16 ` Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®