# define PREFETCH(x) \
__asm__ __volatile__ (" prefetch %0": : "m"(*(char *)(x)))
# define PREFETCH_FOR_WRITE(x) \
__asm__ __volatile__ (" prefetchw %0": : "m"(*(char *)(x)))
It doesn't work with Intel ia32e processors.
Created attachment 5812 [details]
A patch to use __builtin_prefetch
This patch uses __builtin_prefetch instead of asm statement.
Confirmed, note that since x86_64 was only AMD64 until lately this was right, also note I think Intel
should implement 3DNow and get over this crazy semi compatiablity crap.
__builtin_prefetch may be fine for GCC's copy of the GC, however the upstream
version will need another solution as it is sometimes used with non-GCC compilers.
(There aren't many compilers available yet for x86-64, but I'd guess icc, msvc
and others will appear before long.)
Inline asm is already GCC-only, so this would not make it worse.
Created attachment 5813 [details]
A patch to use asm statement
This patch uses asm statement. But I agree it may only
work with gcc.
I'd be inclined to use __builtin_prefetch for both the X86_64 and I386 cases.
That gets rid of some obscure configuration options for the GC.
This should be guarded by a #ifdef __GNUC__ . The current assembly code isn't
going to work for a non-gcc compiler anyway. (This may still break the Intel
compiler. If so, we'll fix it then.)
I assume gcc does the right thing for __builtin_prefetch depending on the
command line arguments, i.e. generates nothing by default?
I would like to see the I386 and X86_64 cases handled identically, since the
underlying mess is now unfortunately the same.
If AMD and Intel can't work this out, we should eventually include two near
clones of the marker code, one using each version, and choose at run-time. But
that's real work.
__builtin_prefetch will generate the appropriate instruction for
Created attachment 5824 [details]
A new patch to use __builtin_prefetch
This patch uses __builtin_prefetch only if gcc 3.0 or above is used.
The third patch looks fine to me. Please check it in. I put it in the
Sorry about losing track of this.
Subject: Bug 14326
Module name: gcc
Changes by: firstname.lastname@example.org 2004-04-21 15:17:48
boehm-gc : ChangeLog
2004-04-21 H.J. Lu <email@example.com>
Backport from mainline:
* include/private/gcconfig.h (PREFETCH): Use __builtin_prefetch
for gcc >= 3.0.
Fixed in 3.4.1.