* [PATCH] x86: Micro-optimization in nhmex_rbox_get_constraint
@ 2014-06-19 13:15 Rasmus Villemoes
2014-06-23 8:55 ` Peter Zijlstra
2014-07-05 10:47 ` [tip:perf/core] perf/x86: Micro-optimize nhmex_rbox_get_constraint() tip-bot for Rasmus Villemoes
0 siblings, 2 replies; 3+ messages in thread
From: Rasmus Villemoes @ 2014-06-19 13:15 UTC (permalink / raw)
To: Peter Zijlstra, H. Peter Anvin, Ingo Molnar
Cc: x86, linux-kernel, Rasmus Villemoes
Flipping the LSB doesn't require four lines of code. This shaves a few
bytes of the generated code, including a branch.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
arch/x86/kernel/cpu/perf_event_intel_uncore.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 65bbbea..e009f3c 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2946,10 +2946,7 @@ again:
* extra registers. If we failed to take an extra
* register, try the alternative.
*/
- if (idx % 2)
- idx--;
- else
- idx++;
+ idx ^= 1;
if (idx != reg1->idx % 6) {
if (idx == 2)
config1 >>= 8;
--
1.9.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: Micro-optimization in nhmex_rbox_get_constraint
2014-06-19 13:15 [PATCH] x86: Micro-optimization in nhmex_rbox_get_constraint Rasmus Villemoes
@ 2014-06-23 8:55 ` Peter Zijlstra
2014-07-05 10:47 ` [tip:perf/core] perf/x86: Micro-optimize nhmex_rbox_get_constraint() tip-bot for Rasmus Villemoes
1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2014-06-23 8:55 UTC (permalink / raw)
To: Rasmus Villemoes; +Cc: H. Peter Anvin, Ingo Molnar, x86, linux-kernel
On Thu, Jun 19, 2014 at 03:15:31PM +0200, Rasmus Villemoes wrote:
> Flipping the LSB doesn't require four lines of code. This shaves a few
> bytes of the generated code, including a branch.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/core] perf/x86: Micro-optimize nhmex_rbox_get_constraint()
2014-06-19 13:15 [PATCH] x86: Micro-optimization in nhmex_rbox_get_constraint Rasmus Villemoes
2014-06-23 8:55 ` Peter Zijlstra
@ 2014-07-05 10:47 ` tip-bot for Rasmus Villemoes
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Rasmus Villemoes @ 2014-07-05 10:47 UTC (permalink / raw)
To: linux-tip-commits; +Cc: linux-kernel, linux, hpa, mingo, peterz, acme, tglx
Commit-ID: 2172c1f5aa58310784f358ca20fdddfcdc2a0d7b
Gitweb: http://git.kernel.org/tip/2172c1f5aa58310784f358ca20fdddfcdc2a0d7b
Author: Rasmus Villemoes <linux@rasmusvillemoes.dk>
AuthorDate: Thu, 19 Jun 2014 15:15:31 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 5 Jul 2014 11:21:52 +0200
perf/x86: Micro-optimize nhmex_rbox_get_constraint()
Flipping the LSB doesn't require four lines of code. This shaves a few
bytes of the generated code, including a branch.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1403183731-15402-1-git-send-email-linux@rasmusvillemoes.dk
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/cpu/perf_event_intel_uncore.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 65bbbea..e009f3c 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2946,10 +2946,7 @@ again:
* extra registers. If we failed to take an extra
* register, try the alternative.
*/
- if (idx % 2)
- idx--;
- else
- idx++;
+ idx ^= 1;
if (idx != reg1->idx % 6) {
if (idx == 2)
config1 >>= 8;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-05 10:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-19 13:15 [PATCH] x86: Micro-optimization in nhmex_rbox_get_constraint Rasmus Villemoes
2014-06-23 8:55 ` Peter Zijlstra
2014-07-05 10:47 ` [tip:perf/core] perf/x86: Micro-optimize nhmex_rbox_get_constraint() tip-bot for Rasmus Villemoes
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.