x86: Micro-optimization in nhmex_rbox_get_constraint
Subsystems (2)
PATCH 1/1 x86: Micro-optimization in 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 <[email protected]>
--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +1 -4
@@ -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 ;
Signature · 1 line
1.9.2
Peter Zijlstra
maintainerQuoted 4 lines · 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 <[email protected]>
Thanks!
tip-bot for Rasmus Villemoes
merge bot[tip:perf/core] perf/x86: Micro-optimize nhmex_rbox_get_constraint()
In reply to Rasmus Villemoesperf/x86: Micro-optimize nhmex_rbox_get_constraint()
Commit-ID: 2172c1f5aa58310784f358ca20fdddfcdc2a0d7b Gitweb: http://git.kernel.org/tip/2172c1f5aa58310784f358ca20fdddfcdc2a0d7b Author: Rasmus Villemoes <[email protected]> AuthorDate: Thu, 19 Jun 2014 15:15:31 +0200 Committer: Ingo Molnar <[email protected]> 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 <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by Peter Zijlstra <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +1 -4
@@ -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 ;