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 26set 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 46set 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 56set 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 64set PREFETCH_ATHLON [list \ 65 { -march=athlon } \ 66 { -march=athlon-4 } ] 67 68if $tracelevel then { 69 strace $tracelevel 70} 71 72# Load support procs. 73load_lib gcc-dg.exp 74 75# Initialize harness. 76dg-init 77 78# Save these. They are needed if testsuite loops over multiple ABIs 79set saved_torture_with_loops $torture_with_loops 80set saved_torture_without_loops $torture_without_loops 81 82set torture_with_loops $PREFETCH_NONE 83set torture_without_loops $PREFETCH_NONE 84gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-none-*.c]] "" 85 86set torture_with_loops $PREFETCH_SSE 87set torture_without_loops $PREFETCH_SSE 88gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-sse-*.c]] "" 89 90set torture_with_loops $PREFETCH_3DNOW 91set torture_without_loops $PREFETCH_3DNOW 92gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-3dnow-*.c]] "" 93 94set torture_with_loops $PREFETCH_ATHLON 95set torture_without_loops $PREFETCH_ATHLON 96gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-athlon-*.c]] "" 97 98set torture_with_loops $saved_torture_with_loops 99set torture_without_loops $saved_torture_without_loops 100 101dg-finish 102 103