About the prefetch

Andrew Haley aph-gcc@littlepinkcloud.COM
Mon Aug 6 10:03:00 GMT 2007


Yang_Jialin@emc.com writes:

 > About the prefetch data of gcc, with optimization option "-O0", some gcc
 > versions have defined "prefetch" and ''prefetchw" function, whether with
 > operations or not.
 > But for other gcc versions , they have not been defined, e.g. 3.4 . I am
 > now confused about what version defines it and which not. Can you tell
 > me about this?

BUILT_IN_PREFETCH was added here:

r47582 | janis | 2001-12-04 00:50:35 +0000 (Tue, 04 Dec 2001) | 6 lines

        * builtin-types.def (BT_FN_VOID_PTR_INT_INT): New.
        * builtins.def (BUILT_IN_PREFETCH): New.
        * builtins.c (expand_builtin_expect): New.
          (expand_builtin): Call it.
        * doc/extend.texi: Document __builtin_expect.

So every version of gcc that branched since then has it.  That would
be, I think, 3.1 onwards.  

Whether __builtin_prefetc does anything or not depends on the
particular back end you're using.

Andrew.



More information about the Gcc-help mailing list