Le 10/03/2017 à 16:41, Segher Boessenkool a écrit :
On Fri, Mar 10, 2017 at 03:41:23PM +0100, Christophe LEROY wrote:
gpio_get() and gpio_set() are used extensively by some GPIO based
drivers like SPI, NAND, so it may be worth it as it doesn't impair
readability (if anyone prefers, we could wr
On Fri, Mar 10, 2017 at 03:41:23PM +0100, Christophe LEROY wrote:
> gpio_get() and gpio_set() are used extensively by some GPIO based
> drivers like SPI, NAND, so it may be worth it as it doesn't impair
> readability (if anyone prefers, we could write (1 << 31) >> i instead
> of
Le 10/03/2017 à 15:32, Segher Boessenkool a écrit :
On Fri, Mar 10, 2017 at 03:04:48PM +0100, Christophe LEROY wrote:
Le 10/03/2017 à 14:06, Segher Boessenkool a écrit :
On Fri, Mar 10, 2017 at 11:54:19AM +0100, Christophe LEROY wrote:
gpio_get() and gpio_set() are used extensively by some G
On Fri, Mar 10, 2017 at 03:04:48PM +0100, Christophe LEROY wrote:
> Le 10/03/2017 à 14:06, Segher Boessenkool a écrit :
> >On Fri, Mar 10, 2017 at 11:54:19AM +0100, Christophe LEROY wrote:
> >>gpio_get() and gpio_set() are used extensively by some GPIO based
> >>drivers like SPI, NAND, so it may be
Le 10/03/2017 à 14:06, Segher Boessenkool a écrit :
On Fri, Mar 10, 2017 at 11:54:19AM +0100, Christophe LEROY wrote:
gpio_get() and gpio_set() are used extensively by some GPIO based
drivers like SPI, NAND, so it may be worth it as it doesn't impair
readability (if anyone prefers, we could wr
On Fri, Mar 10, 2017 at 11:54:19AM +0100, Christophe LEROY wrote:
> gpio_get() and gpio_set() are used extensively by some GPIO based
> drivers like SPI, NAND, so it may be worth it as it doesn't impair
> readability (if anyone prefers, we could write (1 << 31) >> i instead
> of 0x8000 >>
On Fri, Mar 10, 2017 at 07:41:33PM +1100, Michael Ellerman wrote:
> Well yeah, it saves one instruction, but is it worth it? Are these gpio
> routines in some hot path I don't know about?
If there was a GCC PR for this we probably would make GCC optimise
this; there are many similar things that ar
Le 10/03/2017 à 09:41, Michael Ellerman a écrit :
Christophe Leroy writes:
Help a bit the compiler to provide better code:
unsigned int f(int i)
{
return 1 << (31 - i);
}
unsigned int g(int i)
{
return 0x8000 >> i;
}
Disassembly of section .text:
:
0: 20
Christophe Leroy writes:
> Help a bit the compiler to provide better code:
>
> unsigned int f(int i)
> {
> return 1 << (31 - i);
> }
>
> unsigned int g(int i)
> {
> return 0x8000 >> i;
> }
>
> Disassembly of section .text:
>
> :
>0: 20 63 00 1f subfic r3,r3,31
>
Help a bit the compiler to provide better code:
unsigned int f(int i)
{
return 1 << (31 - i);
}
unsigned int g(int i)
{
return 0x8000 >> i;
}
Disassembly of section .text:
:
0: 20 63 00 1f subfic r3,r3,31
4: 39 20 00 01 li r9,1
8: 7d 23
10 matches
Mail list logo