summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.misc-tests/i386-pf-athlon-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.misc-tests/i386-pf-athlon-1.c')
-rw-r--r--gcc/testsuite/gcc.misc-tests/i386-pf-athlon-1.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.misc-tests/i386-pf-athlon-1.c b/gcc/testsuite/gcc.misc-tests/i386-pf-athlon-1.c
new file mode 100644
index 000000000..8d5ad1efe
--- /dev/null
+++ b/gcc/testsuite/gcc.misc-tests/i386-pf-athlon-1.c
@@ -0,0 +1,32 @@
+/* Test that the correct data prefetch instructions are generated for i386
+ variants that use 3DNow! prefetchw or SSE prefetch instructions with
+ locality hints. */
+
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-effective-target ilp32 } */
+
+extern void exit (int);
+
+char *msg = "howdy there";
+
+void foo (char *p)
+{
+ __builtin_prefetch (p, 0, 0);
+ __builtin_prefetch (p, 0, 1);
+ __builtin_prefetch (p, 0, 2);
+ __builtin_prefetch (p, 0, 3);
+ __builtin_prefetch (p, 1, 0);
+ __builtin_prefetch (p, 1, 1);
+ __builtin_prefetch (p, 1, 2);
+ __builtin_prefetch (p, 1, 3);
+}
+
+int main ()
+{
+ foo (msg);
+ exit (0);
+}
+
+/* { dg-final { scan-assembler "prefetchw" } } */
+/* { dg-final { scan-assembler "prefetchnta" } } */
+/* { dg-final { scan-assembler "prefetcht" } } */