Skip to content

Commit

Permalink
perf/x86: Micro-optimize nhmex_rbox_get_constraint()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rasmus Villemoes authored and Ingo Molnar committed Jul 5, 2014
1 parent 985c8dc commit 2172c1f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions arch/x86/kernel/cpu/perf_event_intel_uncore.c
Original file line number Diff line number Diff line change
Expand Up @@ -2946,10 +2946,7 @@ nhmex_rbox_get_constraint(struct intel_uncore_box *box, struct perf_event *event
* 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;
Expand Down

0 comments on commit 2172c1f

Please sign in to comment.