Changeset 13246


Ignore:
Timestamp:
Dec 2, 2009, 6:22:15 AM (10 years ago)
Author:
gb
Message:

Add volatile attribute to inline asm statements, to keep GCC
from deleting/reordering those statements.

(This seems to allow GCC 3.x to compile the kernel reliably with -O2
in effect.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/bits.h

    r13067 r13246  
    159159#ifdef PPC
    160160#ifdef PPC64
    161   __asm__  ("cntlzd %0,%1" : "=r" (lz) : "r" (w));
     161  __asm__ __volatile__("cntlzd %0,%1" : "=r" (lz) : "r" (w));
    162162#else
    163   __asm__  ("cntlzw %0,%1" : "=r" (lz) : "r" (w));
     163  __asm__ __volatile__("cntlzw %0,%1" : "=r" (lz) : "r" (w));
    164164#endif
    165165#endif /* PPC */
    166166#ifdef X86
    167167#ifdef X8664
    168   __asm__ ("bsr %1,%0" : "=r" (lz) : "r" (w));
    169   __asm__ ("xor $63,%0" : "=r" (lz));
     168  __asm__ __volatile__("bsr %1,%0" : "=r" (lz) : "r" (w));
     169  __asm__ __volatile__("xor $63,%0" : "=r" (lz));
    170170#else
    171   __asm__ ("bsr %1,%0" : "=r" (lz) : "r" (w));
    172   __asm__ ("xor $31,%0" : "=r" (lz));
     171  __asm__ __volatile__("bsr %1,%0" : "=r" (lz) : "r" (w));
     172  __asm__ __volatile__("xor $31,%0" : "=r" (lz));
    173173#endif
    174174#endif
Note: See TracChangeset for help on using the changeset viewer.