From: Martin Kronbichler Date: Wed, 23 Apr 2014 14:36:45 +0000 (+0000) Subject: Initial test to detect optimization bug for gcc-4.6 X-Git-Tag: v8.2.0-rc1~562 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98ae1da6a8aa0ff8fecdd9813e4c588151ad659a;p=dealii.git Initial test to detect optimization bug for gcc-4.6 git-svn-id: https://svn.dealii.org/trunk@32818 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/base/vectorization_03.cc b/tests/base/vectorization_03.cc new file mode 100644 index 0000000000..65e98e84d2 --- /dev/null +++ b/tests/base/vectorization_03.cc @@ -0,0 +1,52 @@ +// --------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2012 - 2014 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +// expression from step-48 that was computed in a wrong way for gcc-4.6.3 with +// vectorization + + +#include "../tests.h" + +#include + + +void test() +{ + VectorizedArray array[3]; + for (unsigned int i=0; i<4; ++i) + for (unsigned int v=0; v::n_array_elements; ++v) + array[i][v] = static_cast(rand())/RAND_MAX; + + const VectorizedArray tmp = 2. * array[0] - array[1] - array[2] * std::sin(array[0]); + + for (unsigned int v=0; v::n_array_elements; ++v) + deallog << tmp[v]-(2.*array[0][v]-array[1][v]-array[2][v]*std::sin(array[0][v])) << " "; + deallog << std::endl; +} + + +int main (int argc, char **argv) +{ + std::ofstream logfile("output"); + deallog.attach(logfile); + deallog << std::setprecision(4); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + test(); +} + diff --git a/tests/base/vectorization_03.output b/tests/base/vectorization_03.output new file mode 100644 index 0000000000..c18e43299f --- /dev/null +++ b/tests/base/vectorization_03.output @@ -0,0 +1,2 @@ + +DEAL::0 0