Debian Codegraph @

gcc/testsuite/gcc.misc-tests/i386-prefetch.exp

raw
1 # Copyright (C) 2002-2025 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 3 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 GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
16
17 if { [board_info target exists multilib_flags]
18 && [string match "* -march=*" " [board_info target multilib_flags] "] } {
19 # Multilib flags come after the -march flags we pass and override
20 # them, so skip these tests when such flags are passed.
21 return
22 }
23
24 # Test that the correct data prefetch instructions (SSE or 3DNow! variant,
25 # or none) are used for various i386 cpu-type and instruction set
26 # extension options for __builtin_prefetch. When using -mtune, specify
27 # the minimum supported architecture in case the compiler was configured
28 # with a different default.
29
30 # Failure reports do not include the compile option that was used; that
31 # information can be seen in the compile line in the log file.
32
33 # Do not generate prefetch instructions for the following options.
34
35 set PREFETCH_NONE [list \
36 { -march=i386 -mtune=i386 } \
37 { -march=i386 -mtune=i486 } \
38 { -march=i386 -mtune=i586 } \
39 { -march=i386 -mtune=i686 } \
40 { -march=i386 -mtune=pentium2 } \
41 { -march=i386 -mtune=k6 } \
42 { -march=i386 -mtune=k6-2 } \
43 { -march=i386 -mtune=k6-3 } \
44 { -march=i386 } \
45 { -march=i486 } \
46 { -march=i586 } \
47 { -march=i686 } \
48 { -march=pentium2 } \
49 { -march=k6 } ]
50
51 # For options in PREFETCH_SSE, generate SSE prefetch instructions for
52 # __builtin_prefetch. This includes -mtune for targets that treat prefetch
53 # instructions as nops.
54
55 set PREFETCH_SSE [list \
56 { -march=i686 -mtune=pentium3 } \
57 { -march=i686 -mtune=pentium3m } \
58 { -march=i686 -mtune=pentium-m } \
59 { -march=i686 -mtune=pentium4 } \
60 { -march=i686 -mtune=pentium4m } \
61 { -march=i686 -mtune=prescott } \
62 { -march=i686 -mtune=athlon } \
63 { -march=i686 -mtune=athlon-4 } \
64 { -march=i686 -mtune=c3-2 } \
65 { -march=pentium3 } \
66 { -march=pentium3m } \
67 { -march=pentium-m } \
68 { -march=pentium4 } \
69 { -march=pentium4m } \
70 { -march=prescott } \
71 { -march=c3-2 } ]
72
73 # Generate 3DNow! prefetch instructions for the following.
74
75 set PREFETCH_3DNOW [list \
76 { -march=c3 } \
77 { -march=k6-2 } \
78 { -march=k6-3 } ]
79
80 # Athlon supports both 3DNow! and SSE prefetch instructions. For
81 # __builtin_prefetch, generate the 3DNow! instruction for write
82 # prefetches but SSE prefetch instructions for read prefetches.
83
84 set PREFETCH_ATHLON [list \
85 { -march=athlon } \
86 { -march=athlon-4 } ]
87
88 if $tracelevel then {
89 strace $tracelevel
90 }
91
92 # Load support procs.
93 load_lib gcc-dg.exp
94 load_lib torture-options.exp
95
96 # Initialize harness.
97 dg-init
98 torture-init
99
100 set-torture-options $PREFETCH_NONE
101 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-none-*.c]] "" ""
102
103 set-torture-options $PREFETCH_SSE
104 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-sse-*.c]] "" ""
105
106 set-torture-options $PREFETCH_3DNOW
107 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-3dnow-*.c]] "" ""
108
109 set-torture-options $PREFETCH_ATHLON
110 gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-athlon-*.c]] "" ""
111
112 torture-finish
113 dg-finish
114