* arm64: opportunity for (micro) optimisation in set_bit et al?
@ 2013-06-05 9:36 Ian Campbell
2013-06-05 10:01 ` Catalin Marinas
2013-06-05 10:01 ` Catalin Marinas
0 siblings, 2 replies; 6+ messages in thread
From: Ian Campbell @ 2013-06-05 9:36 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
I was "borrowing" the arm64 Linux bitops for use in Xen and Tim Deegan
wondered about the use of eor in:
and x3, x0, #63 // Get bit offset
eor x0, x0, x3 // Clear low bits
mov x2, #1
add x1, x1, x0, lsr #3 // Get word offset
That eor has a dependency on the previous and instruction which could be
avoided using a bic or a lsr #5 followed by lsl #2 instead of the lsr #3
on the add (this is what arm32 does).
The same goes for the test_and_blah variants.
Perhaps these sorts of hazards aren't such a big deal on arm64 or
perhaps eor has some advantage which we aren't aware of but I thought
I'd mention it...
Cheers,
Ian.
^ permalink raw reply [flat|nested] 6+ messages in thread
* arm64: opportunity for (micro) optimisation in set_bit et al?
@ 2013-06-05 9:36 Ian Campbell
0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2013-06-05 9:36 UTC (permalink / raw)
To: Catalin Marinas; +Cc: Tim Deegan, linux-arm-kernel, xen-devel
Hello,
I was "borrowing" the arm64 Linux bitops for use in Xen and Tim Deegan
wondered about the use of eor in:
and x3, x0, #63 // Get bit offset
eor x0, x0, x3 // Clear low bits
mov x2, #1
add x1, x1, x0, lsr #3 // Get word offset
That eor has a dependency on the previous and instruction which could be
avoided using a bic or a lsr #5 followed by lsl #2 instead of the lsr #3
on the add (this is what arm32 does).
The same goes for the test_and_blah variants.
Perhaps these sorts of hazards aren't such a big deal on arm64 or
perhaps eor has some advantage which we aren't aware of but I thought
I'd mention it...
Cheers,
Ian.
^ permalink raw reply [flat|nested] 6+ messages in thread
* arm64: opportunity for (micro) optimisation in set_bit et al?
2013-06-05 9:36 arm64: opportunity for (micro) optimisation in set_bit et al? Ian Campbell
@ 2013-06-05 10:01 ` Catalin Marinas
2013-06-05 10:09 ` Ian Campbell
2013-06-05 10:09 ` Ian Campbell
2013-06-05 10:01 ` Catalin Marinas
1 sibling, 2 replies; 6+ messages in thread
From: Catalin Marinas @ 2013-06-05 10:01 UTC (permalink / raw)
To: linux-arm-kernel
Hi Ian,
On Wed, Jun 05, 2013 at 10:36:21AM +0100, Ian Campbell wrote:
> I was "borrowing" the arm64 Linux bitops for use in Xen and Tim Deegan
> wondered about the use of eor in:
> and x3, x0, #63 // Get bit offset
> eor x0, x0, x3 // Clear low bits
> mov x2, #1
> add x1, x1, x0, lsr #3 // Get word offset
BTW, the latest kernel uses W registers (32-bit here since the function
prototype has an 'int' and the compiler does not guarantee that the top
32-bit are 0.
> That eor has a dependency on the previous and instruction which could be
> avoided using a bic or a lsr #5 followed by lsl #2 instead of the lsr #3
> on the add (this is what arm32 does).
Any of these would do (I haven't tried, bic #imm is an alias for and).
I'll check with the hardware guys whether it makes any difference but it
is a harmless change anyway.
Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: arm64: opportunity for (micro) optimisation in set_bit et al?
2013-06-05 9:36 arm64: opportunity for (micro) optimisation in set_bit et al? Ian Campbell
2013-06-05 10:01 ` Catalin Marinas
@ 2013-06-05 10:01 ` Catalin Marinas
1 sibling, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2013-06-05 10:01 UTC (permalink / raw)
To: Ian Campbell; +Cc: Tim Deegan, linux-arm-kernel@lists.infradead.org, xen-devel
Hi Ian,
On Wed, Jun 05, 2013 at 10:36:21AM +0100, Ian Campbell wrote:
> I was "borrowing" the arm64 Linux bitops for use in Xen and Tim Deegan
> wondered about the use of eor in:
> and x3, x0, #63 // Get bit offset
> eor x0, x0, x3 // Clear low bits
> mov x2, #1
> add x1, x1, x0, lsr #3 // Get word offset
BTW, the latest kernel uses W registers (32-bit here since the function
prototype has an 'int' and the compiler does not guarantee that the top
32-bit are 0.
> That eor has a dependency on the previous and instruction which could be
> avoided using a bic or a lsr #5 followed by lsl #2 instead of the lsr #3
> on the add (this is what arm32 does).
Any of these would do (I haven't tried, bic #imm is an alias for and).
I'll check with the hardware guys whether it makes any difference but it
is a harmless change anyway.
Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 6+ messages in thread
* arm64: opportunity for (micro) optimisation in set_bit et al?
2013-06-05 10:01 ` Catalin Marinas
@ 2013-06-05 10:09 ` Ian Campbell
2013-06-05 10:09 ` Ian Campbell
1 sibling, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2013-06-05 10:09 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, 2013-06-05 at 11:01 +0100, Catalin Marinas wrote:
> Hi Ian,
>
> On Wed, Jun 05, 2013 at 10:36:21AM +0100, Ian Campbell wrote:
> > I was "borrowing" the arm64 Linux bitops for use in Xen and Tim Deegan
> > wondered about the use of eor in:
> > and x3, x0, #63 // Get bit offset
> > eor x0, x0, x3 // Clear low bits
> > mov x2, #1
> > add x1, x1, x0, lsr #3 // Get word offset
>
> BTW, the latest kernel uses W registers (32-bit here since the function
> prototype has an 'int' and the compiler does not guarantee that the top
> 32-bit are 0.
Thanks, that was in the version I actually picked up (from v3.10-rc4) I
just grabbed the wrong thing when cut-n-pasting here.
> > That eor has a dependency on the previous and instruction which could be
> > avoided using a bic or a lsr #5 followed by lsl #2 instead of the lsr #3
> > on the add (this is what arm32 does).
>
> Any of these would do (I haven't tried, bic #imm is an alias for and).
> I'll check with the hardware guys whether it makes any difference but it
> is a harmless change anyway.
ACK, thanks.
Ian.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: arm64: opportunity for (micro) optimisation in set_bit et al?
2013-06-05 10:01 ` Catalin Marinas
2013-06-05 10:09 ` Ian Campbell
@ 2013-06-05 10:09 ` Ian Campbell
1 sibling, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2013-06-05 10:09 UTC (permalink / raw)
To: Catalin Marinas
Cc: Tim Deegan, linux-arm-kernel@lists.infradead.org, xen-devel
On Wed, 2013-06-05 at 11:01 +0100, Catalin Marinas wrote:
> Hi Ian,
>
> On Wed, Jun 05, 2013 at 10:36:21AM +0100, Ian Campbell wrote:
> > I was "borrowing" the arm64 Linux bitops for use in Xen and Tim Deegan
> > wondered about the use of eor in:
> > and x3, x0, #63 // Get bit offset
> > eor x0, x0, x3 // Clear low bits
> > mov x2, #1
> > add x1, x1, x0, lsr #3 // Get word offset
>
> BTW, the latest kernel uses W registers (32-bit here since the function
> prototype has an 'int' and the compiler does not guarantee that the top
> 32-bit are 0.
Thanks, that was in the version I actually picked up (from v3.10-rc4) I
just grabbed the wrong thing when cut-n-pasting here.
> > That eor has a dependency on the previous and instruction which could be
> > avoided using a bic or a lsr #5 followed by lsl #2 instead of the lsr #3
> > on the add (this is what arm32 does).
>
> Any of these would do (I haven't tried, bic #imm is an alias for and).
> I'll check with the hardware guys whether it makes any difference but it
> is a harmless change anyway.
ACK, thanks.
Ian.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-05 10:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-05 9:36 arm64: opportunity for (micro) optimisation in set_bit et al? Ian Campbell
2013-06-05 10:01 ` Catalin Marinas
2013-06-05 10:09 ` Ian Campbell
2013-06-05 10:09 ` Ian Campbell
2013-06-05 10:01 ` Catalin Marinas
-- strict thread matches above, loose matches on Subject: below --
2013-06-05 9:36 Ian Campbell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.