lkml.org 
[lkml]   [2000]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: (*(unsigned long *)&jiffies)++;
On Fri, 7 Jan 2000, Peter K wrote:

> On Thu, 6 Jan 2000, Richard B. Johnson wrote:
>
> > #include <stdio.h>
> > volatile long foo;
> > main()
> > {
> > foo++;
> > printf("%ld\n", foo);
> > }
> >
> Well it __is__ cached into registers on this compiler (2.7.2.3)!
>
> #include <stdio.h>
> volatile long foo;
> main()
> {
> foo++;
> printf("%ld\n", foo);
> }
> Well it __is__ cached into registers on this compiler (2.7.2.3)!
>
> #include <stdio.h>
> volatile long foo;
> main()
> {
> foo++;
> printf("%ld\n", foo);
> }
> gcc 2.7.2.3 gcc 2.95.2
> ---------------------------------- -----------------------------
> .file "xxx.c" .file "x.c"
> .version "01.01" .version "01.01"
> gcc2_compiled.: gcc2_compiled.:
> .section .rodata .section .rodata
> .LC0: .LC0:
> .string "%ld\n" .string "%ld\n"
> .text .text
> .align 4 .align 4
> .globl main .globl main
> .type main,@function .type main,@function
> main: main:
> movl foo,%eax
> pushl %ebp subl $12,%esp ! Uh ..
> movl %esp,%ebp
> movl foo,%eax ! Get it
> leal 1(%eax),%edx ! bump it by one incl %eax
> addl $-8,%esp ! Uh ..
> movl %eax,foo
> movl %edx,foo ! write it back
> movl foo,%eax ! Then something dumb movl foo,%eax
> movl foo,%edx ! Then something dumb again
> ! actually just loading the parameter for printf()
> pushl %edx pushl %eax
> pushl $.LC0 pushl $.LC0
> call printf call printf
> addl $8,%esp addl $16,%esp
> addl $12,%esp ! Waste
> .L1:
> leave
> ret ret
> .Lfe1: .Lfe1:
> .size main,.Lfe1-main .size main,.Lfe1-main
> .comm foo,4,4 .comm foo,4,4
> .ident "GCC: (GNU) 2.7.2.3" .ident "GCC: (GNU) 2.95.2 19991024 (release)"
>
> Dick, did you compile with the default kernel flags ?
>

Just -O2.


Cheers,
Dick Johnson

Penguin : Linux version 2.3.36 on an i686 machine (400.59 BogoMips).


-
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:55    [W:0.082 / U:0.028 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site