* gcc.dg/ipa/ipa-1.c: New test.
authorrazya <razya@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Oct 2005 09:31:34 +0000 (09:31 +0000)
committerrazya <razya@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 12 Oct 2005 09:31:34 +0000 (09:31 +0000)
        * gcc.dg/ipa/ipa-2.c: New test.
        * gcc.dg/ipa/ipa-3.c: New test.
        * gcc.dg/ipa/ipa-4.c: New test.
        * gcc.dg/ipa/ipa-5.c: New test.
        * gcc.dg/ipa/ipa.exp: New file.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105291 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/gcc.dg/ipa/ipa-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/ipa/ipa-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/ipa/ipa-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/ipa/ipa-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/ipa/ipa-5.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/ipa/ipa.exp [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-1.c b/gcc/testsuite/gcc.dg/ipa/ipa-1.c
new file mode 100644 (file)
index 0000000..d8f737a
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp"  } */
+
+#include <stdio.h>
+int g (int b, int c)
+{
+  printf ("%d %d\n", b, c);
+}
+int f (int a)
+{
+  /* Second parameter of g gets different values.  */
+  if (a > 0)
+    g (a, 3);
+  else
+    g (a, 5);  
+}
+int main ()
+{
+  f (7);
+  return 0;    
+}
+
+
+/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp"  } } */
+/* { dg-final { scan-ipa-dump-times "propagating const" 2 "cp"  } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
+
+
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-2.c b/gcc/testsuite/gcc.dg/ipa/ipa-2.c
new file mode 100644 (file)
index 0000000..e614b59
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp"  } */
+
+#include <stdio.h>
+int g (int b, int c)
+{
+  printf ("%d %d\n", b, c);
+}
+int f (int a)
+{
+  /* a is modified.  */
+  if (a++ > 0)
+    g (a, 3);
+}
+int main ()
+{
+  f (7);
+  return 0;    
+}
+
+
+/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp"  } } */
+/* { dg-final { scan-ipa-dump-times "propagating const" 2 "cp"  } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-3.c b/gcc/testsuite/gcc.dg/ipa/ipa-3.c
new file mode 100644 (file)
index 0000000..b4bf394
--- /dev/null
@@ -0,0 +1,28 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp"  } */
+
+
+/* Double constants.  */
+
+#include <stdio.h>
+int g (double b, double c)
+{
+  return (int)(b+c);  
+}
+int f (double a)
+{
+  if (a > 0)
+    g (a, 3.1);
+  else
+    g (a, 3.1);        
+}
+int main ()
+{
+  f (7.44);
+  return 0;    
+}
+
+
+/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp"  } } */
+/* { dg-final { scan-ipa-dump-times "propagating const" 3 "cp"  } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-4.c b/gcc/testsuite/gcc.dg/ipa/ipa-4.c
new file mode 100644 (file)
index 0000000..edb15a8
--- /dev/null
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp"  } */
+
+#include <stdio.h>
+int g (int b, int c)
+{
+  printf ("%d %d\n", b, c);
+}
+int f (int a)
+{
+  /* First and second parameter of g gets different values.  */ 
+     
+  if (a > 0)
+    g (a, 3);
+  else
+    g (a+1, 5);        
+}
+int main ()
+{
+  f (7);
+  return 0;    
+}
+
+
+/* { dg-final { scan-ipa-dump-times "versioned function" 1 "cp"  } } */
+/* { dg-final { scan-ipa-dump-times "propagating const" 1 "cp"  } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa-5.c b/gcc/testsuite/gcc.dg/ipa/ipa-5.c
new file mode 100644 (file)
index 0000000..efb08da
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fipa-cp -fdump-ipa-cp"  } */
+
+/* Float & short constants.  */
+
+#include <stdio.h>
+int g (float b, short c)
+{
+  return c + (int)b;
+}
+int f (float a)
+{
+  /* a is modified.  */
+  if (a++ > 0)
+    g (a, 3);
+}
+int main ()
+{
+  f (7.6);
+  return 0;    
+}
+
+
+/* { dg-final { scan-ipa-dump-times "versioned function" 2 "cp"  } } */
+/* { dg-final { scan-ipa-dump-times "propagating const" 2 "cp"  } } */
+/* { dg-final { cleanup-ipa-dump "cp" } } */
diff --git a/gcc/testsuite/gcc.dg/ipa/ipa.exp b/gcc/testsuite/gcc.dg/ipa/ipa.exp
new file mode 100644 (file)
index 0000000..d95b938
--- /dev/null
@@ -0,0 +1,35 @@
+# Copyright (C) 1997, 2004 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish