lkml.org 
[lkml]   [2000]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC] Merge softirq, local_irq_count, local_bh_count
Russell King wrote:
> > Except for the places where cpu is a variable instead of
> > smp_processor_id(), those places might generate array access code.
>
> They shouldn't do - GCC should realise that code like:
>
> int this_cpu = 0;
>
> array_access[this_cpu].foo = 0;
> array_access[this_cpu].bar = 1;
>
> can be optimised. So long as "this_cpu" remains an auto variable, then
> it should be ok.

This is generally true, though there are a few situations where x86 GCC
makes some decisions about which instruction pattern to use before it
realises that `this_cpu' is constant. It probably makes no difference
in this example.

Of course, it knows the array has only one element so in principle it
could always just optimise away the index ;-)

-- Jamie

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.048 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site