OSDN Git Service

* gcc.misc-tests/i386-prefetch.exp: New.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.misc-tests / i386-prefetch.exp
1 #   Copyright (C) 2002 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
16
17 # Test that the correct data prefetch instructions (SSE or 3DNow! variant,
18 # or none) are used for various i386 cpu-type and instruction set
19 # extension options for __builtin_prefetch.
20
21 # Failure reports do not include the compile option that was used; that
22 # information can be seen in the compile line in the log file.
23
24 # Do not generate prefetch instructions for the following options.
25
26 set PREFETCH_NONE [list \
27         { -mcpu=i386 } \
28         { -mcpu=i486 } \
29         { -mcpu=i586 } \
30         { -mcpu=i686 } \
31         { -mcpu=pentium2 } \
32         { -mcpu=k6 } \
33         { -mcpu=k6-2 } \
34         { -mcpu=k6-3 } \
35         { -march=i386 } \
36         { -march=i486 } \
37         { -march=i586 } \
38         { -march=i686 } \
39         { -march=pentium2 } \
40         { -march=k6 } ]
41
42 # For options in PREFETCH_SSE, generate SSE prefetch instructions for
43 # __builtin_prefetch.  This includes -mcpu for targets that treat prefetch
44 # instructions as nops.
45
46 set PREFETCH_SSE [list \
47         { -mcpu=pentium3 } \
48         { -mcpu=pentium4 } \
49         { -mcpu=athlon } \
50         { -mcpu=athlon-4 } \
51         { -march=pentium3 } \
52         { -march=pentium4 } ]
53
54 # Generate 3DNow! prefetch instructions for the following.
55
56 set PREFETCH_3DNOW [list \
57         { -march=k6-2 } \
58         { -march=k6-3 } ]
59
60 # Athlon supports both 3DNow! and SSE prefetch instructions.  For
61 # __builtin_prefetch, generate the 3DNow! instruction for write
62 # prefetches but SSE prefetch instructions for read prefetches.
63
64 set PREFETCH_ATHLON [list \
65         { -march=athlon } \
66         { -march=athlon-4 } ]
67
68 if $tracelevel then {
69     strace $tracelevel
70 }
71
72 # Load support procs.
73 load_lib gcc-dg.exp
74
75 # Initialize harness.
76 dg-init
77
78 set torture_with_loops $PREFETCH_NONE
79 set torture_without_loops $PREFETCH_NONE
80 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-none-*.c]] ""
81
82 set torture_with_loops $PREFETCH_SSE
83 set torture_without_loops $PREFETCH_SSE
84 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-sse-*.c]] ""
85
86 set torture_with_loops $PREFETCH_3DNOW
87 set torture_without_loops $PREFETCH_3DNOW
88 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-3dnow-*.c]] ""
89
90 set torture_with_loops $PREFETCH_ATHLON
91 set torture_without_loops $PREFETCH_ATHLON
92 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-athlon-*.c]] ""
93
94 dg-finish