diff options
author | Christophe Leroy <christophe.leroy@c-s.fr> | 2015-09-22 16:34:34 +0200 |
---|---|---|
committer | Scott Wood <oss@buserror.net> | 2016-03-04 23:04:00 -0600 |
commit | 5a8847c83ce6072d6fdf0d15d9aa060c0b83537f (patch) | |
tree | e45ad68b2205e70108faa4ece40f35a315ea973b /arch/powerpc/include | |
parent | f867d556dd8525fe6ff0d22a34249528e590f994 (diff) | |
download | blackbird-op-linux-5a8847c83ce6072d6fdf0d15d9aa060c0b83537f.tar.gz blackbird-op-linux-5a8847c83ce6072d6fdf0d15d9aa060c0b83537f.zip |
powerpc: simplify csum_add(a, b) in case a or b is constant 0
Simplify csum_add(a, b) in case a or b is constant 0
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Scott Wood <oss@buserror.net>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r-- | arch/powerpc/include/asm/checksum.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/checksum.h b/arch/powerpc/include/asm/checksum.h index 1778f75bf769..74cd8d82628a 100644 --- a/arch/powerpc/include/asm/checksum.h +++ b/arch/powerpc/include/asm/checksum.h @@ -119,7 +119,13 @@ static inline __wsum csum_add(__wsum csum, __wsum addend) { #ifdef __powerpc64__ u64 res = (__force u64)csum; +#endif + if (__builtin_constant_p(csum) && csum == 0) + return addend; + if (__builtin_constant_p(addend) && addend == 0) + return csum; +#ifdef __powerpc64__ res += (__force u64)addend; return (__force __wsum)((u32)res + (res >> 32)); #else |