i386.c: Replace "mcpu" with "mtune".
[gcc.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 { -mtune=i386 } \
28 { -mtune=i486 } \
29 { -mtune=i586 } \
30 { -mtune=i686 } \
31 { -mtune=pentium2 } \
32 { -mtune=k6 } \
33 { -mtune=k6-2 } \
34 { -mtune=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 -mtune for targets that treat prefetch
44 # instructions as nops.
45
46 set PREFETCH_SSE [list \
47 { -mtune=pentium3 } \
48 { -mtune=pentium4 } \
49 { -mtune=athlon } \
50 { -mtune=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 # Save these. They are needed if testsuite loops over multiple ABIs
79 set saved_torture_with_loops $torture_with_loops
80 set saved_torture_without_loops $torture_without_loops
81
82 set torture_with_loops $PREFETCH_NONE
83 set torture_without_loops $PREFETCH_NONE
84 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-none-*.c]] ""
85
86 set torture_with_loops $PREFETCH_SSE
87 set torture_without_loops $PREFETCH_SSE
88 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-sse-*.c]] ""
89
90 set torture_with_loops $PREFETCH_3DNOW
91 set torture_without_loops $PREFETCH_3DNOW
92 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-3dnow-*.c]] ""
93
94 set torture_with_loops $PREFETCH_ATHLON
95 set torture_without_loops $PREFETCH_ATHLON
96 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-athlon-*.c]] ""
97
98 set torture_with_loops $saved_torture_with_loops
99 set torture_without_loops $saved_torture_without_loops
100
101 dg-finish
102