This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: preliminary patch: prefetch support for i386


Hi,
first of all, thanks for the patch. It is something I really
wanted to do for long time.
> This preliminary patch provides i386 support for the data prefetch
> framework in http://gcc.gnu.org/ml/gcc-patches/2001-11/msg02007.html.
> 
> I'm quite confused by the support for multiple targets and extensions
> in i386.md and don't know how to set up support for the various data
> prefetch instructions provided by different i386 targets.  This patch
> works for me on a Pentium III when I lie and say that PentiumPro
> supports SSE prefetch instructions, but I'd like to know how to do it
> correctly.

I think the proper sollution is to include the pentium2/pentium3 switches
now when we can use some of their features.  I can bring it soon,
but as your patch appears to be getting in, I can wait for it to get
installed.
> 
> There are two kinds of prefetch support available on ix86 targets.
> Athlon supports the 3DNow! prefetch instructions, and the SSE prefetch
> instructions are used on Pentium III, Pentium 4, and x86-64.  The
> existing built-in function __builtin_ia32_prefetch is enabled by -msse
> or by -march=athlon -m3dnow, with TARGET_SSE or TARGET_3DNOW_A, and have
> "sse" attribute type.  __builtin_ia32_prefetch_3dnow and
> __builtin_ia32_prefetchw aren't documented, but are enabled by
> TARGET_3DNOW and have "mmx" attribute type.
> 
> Documentation for -mmx, -msse and -m3dnow says that they "enable or
> disable the use of built-in functions that allow direct access to the
> MMX, SSE, and 3Dnow extensions of the instruction set."  If a specified
This should be fixed, -msse also enables the float and -msse2 double
code generation.
> architecture (via -march) supports data prefetch instructions then an
> additional option for extensions shouldn't be necessary to get the new
> generic __builtin_prefetch or to get future data prefetch optimizations.
> It's also not clear how to get prefetch support for Pentium III, which
> isn't one of the cpu-type choices for -march.
I remember that the property of SSE prefetch is that it is nop for older
CPUs, so I guess it should be controlled by -mcpu instead of -march.

Also writting the program, how I will get informed about whether the
prefetch builtin is supported or not.
> 
> Any suggestions on how to provide generic data prefetch support in
> i386.md would be greatly appreciated.
What do you mean exactly?

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]