From: Rasmus Villemoes Date: Thu, 19 Jun 2014 13:15:31 +0000 (+0200) Subject: perf/x86: Micro-optimize nhmex_rbox_get_constraint() X-Git-Tag: firefly_0821_release~176^2~3503^2~12 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2172c1f5aa58310784f358ca20fdddfcdc2a0d7b;p=firefly-linux-kernel-4.4.55.git 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 Cc: Arnaldo Carvalho de Melo Signed-off-by: Peter Zijlstra Link: http://lkml.kernel.org/r/1403183731-15402-1-git-send-email-linux@rasmusvillemoes.dk Signed-off-by: Ingo Molnar --- diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c index 65bbbea38b9c..e009f3cedf89 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;