unalignedcount.cpp
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 //
00006 // Eigen is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 3 of the License, or (at your option) any later version.
00010 //
00011 // Alternatively, you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License as
00013 // published by the Free Software Foundation; either version 2 of
00014 // the License, or (at your option) any later version.
00015 //
00016 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00017 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00019 // GNU General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License and a copy of the GNU General Public License along with
00023 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00024 
00025 static int nb_load;
00026 static int nb_loadu;
00027 static int nb_store;
00028 static int nb_storeu;
00029 
00030 #define EIGEN_DEBUG_ALIGNED_LOAD    { nb_load++;    }
00031 #define EIGEN_DEBUG_UNALIGNED_LOAD  { nb_loadu++;   }
00032 #define EIGEN_DEBUG_ALIGNED_STORE   { nb_store++;   }
00033 #define EIGEN_DEBUG_UNALIGNED_STORE { nb_storeu++;  }
00034 
00035 #define VERIFY_ALIGNED_UNALIGNED_COUNT(XPR,AL,UL,AS,US) {\
00036     nb_load = nb_loadu = nb_store = nb_storeu = 0; \
00037     XPR; \
00038     if(!(nb_load==AL && nb_loadu==UL && nb_store==AS && nb_storeu==US)) \
00039       std::cerr << " >> " << nb_load << ", " << nb_loadu << ", " << nb_store << ", " << nb_storeu << "\n"; \
00040     VERIFY( (#XPR) && nb_load==AL && nb_loadu==UL && nb_store==AS && nb_storeu==US ); \
00041   }
00042 
00043 
00044 #include "main.h"
00045 
00046 void test_unalignedcount()
00047 {
00048   #ifdef EIGEN_VECTORIZE_SSE
00049   VectorXf a(40), b(40);
00050   VERIFY_ALIGNED_UNALIGNED_COUNT(a += b, 20, 0, 10, 0);
00051   VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) += b.segment(0,40), 10, 10, 10, 0);
00052   VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) -= b.segment(0,40), 10, 10, 10, 0);
00053   VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) *= 3.5, 10, 0, 10, 0);
00054   VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) /= 3.5, 10, 0, 10, 0);
00055   #else
00056   // The following line is to eliminate "variable not used" warnings
00057   nb_load = nb_loadu = nb_store = nb_storeu = 0;
00058   #endif
00059 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:33:35