From bb3a963391a60d4ae7094277ce62b3162f511729 Mon Sep 17 00:00:00 2001 From: kronbichler Date: Wed, 23 Apr 2014 14:36:45 +0000 Subject: [PATCH] Initial test to detect optimization bug for gcc-4.6 git-svn-id: https://svn.dealii.org/trunk@32818 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/vectorization_03.cc | 52 ++++++++++++++++++++++++++++++ tests/base/vectorization_03.output | 2 ++ 2 files changed, 54 insertions(+) create mode 100644 tests/base/vectorization_03.cc create mode 100644 tests/base/vectorization_03.output 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 -- 2.39.5