i386-prefetch.exp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. # Copyright (C) 2002-2015 Free Software Foundation, Inc.
  2. # This program is free software; you can redistribute it and/or modify
  3. # it under the terms of the GNU General Public License as published by
  4. # the Free Software Foundation; either version 3 of the License, or
  5. # (at your option) any later version.
  6. #
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. # GNU General Public License for more details.
  11. #
  12. # You should have received a copy of the GNU General Public License
  13. # along with GCC; see the file COPYING3. If not see
  14. # <http://www.gnu.org/licenses/>.
  15. # Test that the correct data prefetch instructions (SSE or 3DNow! variant,
  16. # or none) are used for various i386 cpu-type and instruction set
  17. # extension options for __builtin_prefetch. When using -mtune, specify
  18. # the minimum supported architecture in case the compiler was configured
  19. # with a different default.
  20. # Failure reports do not include the compile option that was used; that
  21. # information can be seen in the compile line in the log file.
  22. # Do not generate prefetch instructions for the following options.
  23. set PREFETCH_NONE [list \
  24. { -march=i386 -mtune=i386 } \
  25. { -march=i386 -mtune=i486 } \
  26. { -march=i386 -mtune=i586 } \
  27. { -march=i386 -mtune=i686 } \
  28. { -march=i386 -mtune=pentium2 } \
  29. { -march=i386 -mtune=k6 } \
  30. { -march=i386 -mtune=k6-2 } \
  31. { -march=i386 -mtune=k6-3 } \
  32. { -march=i386 } \
  33. { -march=i486 } \
  34. { -march=i586 } \
  35. { -march=i686 } \
  36. { -march=pentium2 } \
  37. { -march=k6 } ]
  38. # For options in PREFETCH_SSE, generate SSE prefetch instructions for
  39. # __builtin_prefetch. This includes -mtune for targets that treat prefetch
  40. # instructions as nops.
  41. set PREFETCH_SSE [list \
  42. { -march=i686 -mtune=pentium3 } \
  43. { -march=i686 -mtune=pentium3m } \
  44. { -march=i686 -mtune=pentium-m } \
  45. { -march=i686 -mtune=pentium4 } \
  46. { -march=i686 -mtune=pentium4m } \
  47. { -march=i686 -mtune=prescott } \
  48. { -march=i686 -mtune=athlon } \
  49. { -march=i686 -mtune=athlon-4 } \
  50. { -march=i686 -mtune=c3-2 } \
  51. { -march=pentium3 } \
  52. { -march=pentium3m } \
  53. { -march=pentium-m } \
  54. { -march=pentium4 } \
  55. { -march=pentium4m } \
  56. { -march=prescott } \
  57. { -march=c3-2 } ]
  58. # Generate 3DNow! prefetch instructions for the following.
  59. set PREFETCH_3DNOW [list \
  60. { -march=c3 } \
  61. { -march=k6-2 } \
  62. { -march=k6-3 } ]
  63. # Athlon supports both 3DNow! and SSE prefetch instructions. For
  64. # __builtin_prefetch, generate the 3DNow! instruction for write
  65. # prefetches but SSE prefetch instructions for read prefetches.
  66. set PREFETCH_ATHLON [list \
  67. { -march=athlon } \
  68. { -march=athlon-4 } ]
  69. if $tracelevel then {
  70. strace $tracelevel
  71. }
  72. # Load support procs.
  73. load_lib gcc-dg.exp
  74. load_lib torture-options.exp
  75. # Initialize harness.
  76. dg-init
  77. torture-init
  78. if { [board_info target exists multilib_flags]
  79. && [string match "* -march=*" " [board_info target multilib_flags] "] } {
  80. # Multilib flags come after the -march flags we pass and override
  81. # them, so skip these tests when such flags are passed.
  82. return
  83. }
  84. set-torture-options $PREFETCH_NONE
  85. gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-none-*.c]] "" ""
  86. set-torture-options $PREFETCH_SSE
  87. gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-sse-*.c]] "" ""
  88. set-torture-options $PREFETCH_3DNOW
  89. gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-3dnow-*.c]] "" ""
  90. set-torture-options $PREFETCH_ATHLON
  91. gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/i386-pf-athlon-*.c]] "" ""
  92. torture-finish
  93. dg-finish