Peter Maydell wrote: > On 23 November 2012 15:15, Paolo Bonzini <pbonz...@redhat.com> wrote: > > Il 23/11/2012 16:12, Peter Maydell ha scritto: > >> Adjust the conditional which guards the implementation of > >> > >> -#elif defined(__i386__) > >> +#elif defined(__i586__) > >> > >> static inline int64_t cpu_get_real_ticks(void) > >> { > >> > > > > You should at least test __i686__ too: > > > > $ gcc -m32 -dM -E -x c /dev/null |grep __i > > #define __i686 1 > > #define __i686__ 1 > > #define __i386 1 > > #define __i386__ 1 > > Yuck. I had assumed gcc would define everything from i386 > on up when building for later cores.
No, and it doesn't define __i686__ on all x86-32 targets after i686 either: $ gcc -march=core2 -dM -E -x c /dev/null | grep __[0-9a-z] | sort #define __core2 1 #define __core2__ 1 #define __gnu_linux__ 1 #define __i386 1 #define __i386__ 1 #define __linux 1 #define __linux__ 1 #define __tune_core2__ 1 #define __unix 1 #define __unix__ 1 x86 instruction sets haven't followed a linear progression of features for quite a while, especially including non-Intel chips, so it stopped making sense for GCC to indicate the instruction set in that way. GCC 4.6.3 defines __i586__ only when the target arch is set by -march (or default) to i586, pentium or pentium-mmx. And it defines __i686__ only when -march= is set (or default) to c3-2, i686, pentiumpro, pentium2, pentium3, pentium3m or pentium-m. Otherwise it's just things like __athlon__, __corei7__, etc. The only one that's consistent is __i386__ (and __i386). -- Jamie