From 61ab55fa4a07001828ade78127075e2e355c77ca Mon Sep 17 00:00:00 2001 From: jconner Date: Thu, 18 Jan 2007 16:44:50 +0000 Subject: [PATCH] 2007-01-18 Josh Conner PR target/30485 * gcc.dg/vect/vect.exp: Add support for no-trapping-math tests. * gcc.dg/vect/no-trapping-math-1: New. * gcc.dg/vect/no-trapping-math-2: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120903 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/testsuite/ChangeLog | 7 +++++ gcc/testsuite/gcc.dg/vect/no-trapping-math-1.c | 12 ++++++++ gcc/testsuite/gcc.dg/vect/no-trapping-math-2.c | 38 ++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/vect/vect.exp | 6 ++++ 4 files changed, 63 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/no-trapping-math-1.c create mode 100644 gcc/testsuite/gcc.dg/vect/no-trapping-math-2.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9171b0d..3b88a02 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2007-01-18 Josh Conner + + PR target/30485 + * gcc.dg/vect/vect.exp: Add support for no-trapping-math tests. + * gcc.dg/vect/no-trapping-math-1: New. + * gcc.dg/vect/no-trapping-math-2: New. + 2007-01-18 Uros Bizjak * gcc.target/i386/387-8.c: Update comment about optimizing diff --git a/gcc/testsuite/gcc.dg/vect/no-trapping-math-1.c b/gcc/testsuite/gcc.dg/vect/no-trapping-math-1.c new file mode 100644 index 0000000..e9d9570 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/no-trapping-math-1.c @@ -0,0 +1,12 @@ +/* Test for pr30485. */ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_condition } */ +void +foo (float a[32], float b[2][32]) +{ + int i; + for (i = 0; i < 32; i++) + a[i] = (b[0][i] > b[1][i]) ? b[0][i] : b[1][i]; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-trapping-math-2.c b/gcc/testsuite/gcc.dg/vect/no-trapping-math-2.c new file mode 100644 index 0000000..b4e3249 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/no-trapping-math-2.c @@ -0,0 +1,38 @@ +/* Test for pr30485. */ +/* { dg-require-effective-target vect_float } */ + +#include +#include "tree-vect.h" + +#define N 16 + +int +main1 (void) +{ + int i; + float a[N]; + float b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; + + /* Condition in loop. */ + /* This loop is vectorized on platforms that support vect_condition. */ + for (i = 0; i < N; i++) + { + a[i] = (b[i] > 0 ? b[i] : 0); + } + + for (i = 0; i < N; i++) + { + if (a[i] != b[i]) + abort (); + } + return 0; +} + +int main (void) +{ + check_vect (); + return main1 (); +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_condition } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect.exp b/gcc/testsuite/gcc.dg/vect/vect.exp index ed5693f..723e9b6 100644 --- a/gcc/testsuite/gcc.dg/vect/vect.exp +++ b/gcc/testsuite/gcc.dg/vect/vect.exp @@ -150,6 +150,12 @@ lappend DEFAULT_VECTCFLAGS "-funswitch-loops" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/unswitch-loops-*.\[cS\]]] \ "" $DEFAULT_VECTCFLAGS +# -fno-trapping-math tests +set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS +lappend DEFAULT_VECTCFLAGS "-fno-trapping-math" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-trapping-math-*.\[cS\]]] \ + "" $DEFAULT_VECTCFLAGS + # With -Os lappend DEFAULT_VECTCFLAGS "-Os" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Os-vect-*.\[cS\]]] \ -- 2.7.4