]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Initial test to detect optimization bug for gcc-4.6
authorkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 23 Apr 2014 14:36:45 +0000 (14:36 +0000)
committerkronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 23 Apr 2014 14:36:45 +0000 (14:36 +0000)
git-svn-id: https://svn.dealii.org/trunk@32818 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/vectorization_03.cc [new file with mode: 0644]
tests/base/vectorization_03.output [new file with mode: 0644]

diff --git a/tests/base/vectorization_03.cc b/tests/base/vectorization_03.cc
new file mode 100644 (file)
index 0000000..65e98e8
--- /dev/null
@@ -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 <deal.II/base/vectorization.h>
+
+
+void test()
+{
+  VectorizedArray<double> array[3];
+  for (unsigned int i=0; i<4; ++i)
+    for (unsigned int v=0; v<VectorizedArray<double>::n_array_elements; ++v)
+      array[i][v] = static_cast<double>(rand())/RAND_MAX;
+
+  const VectorizedArray<double> tmp = 2. * array[0] - array[1] - array[2] * std::sin(array[0]);
+
+  for (unsigned int v=0; v<VectorizedArray<double>::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 (file)
index 0000000..c18e432
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::0 0 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.