[llvm-commits] [test-suite] r62072 - in /test-suite/trunk/SingleSource/Benchmarks: C++Bench/ C++Bench/LICENSE_1_0_0.txt C++Bench/Makefile C++Bench/README.txt C++Bench/benchmark_algorithms.h C++Bench/benchmark_results.h C++Bench/benchmark_shared_tests.h C++Bench/benchmark_stdint.hpp C++Bench/benchmark_timer.h C++Bench/functionobjects.cpp C++Bench/loop_unroll.cpp C++Bench/simple_types_constant_folding.cpp C++Bench/simple_types_loop_invariant.cpp C++Bench/stepanov_abstraction.cpp C++Bench/stepanov_vector.cpp Makefile
Owen Anderson
resistor at mac.com
Sun Jan 11 19:05:00 PST 2009
Author: resistor
Date: Sun Jan 11 21:04:59 2009
New Revision: 62072
URL: http://llvm.org/viewvc/llvm-project?rev=62072&view=rev
Log:
Add Adobe's C++ benchmark suite.
Added:
test-suite/trunk/SingleSource/Benchmarks/C++Bench/
test-suite/trunk/SingleSource/Benchmarks/C++Bench/LICENSE_1_0_0.txt (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/Makefile
test-suite/trunk/SingleSource/Benchmarks/C++Bench/README.txt (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_algorithms.h (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_results.h (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_shared_tests.h (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_stdint.hpp (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_timer.h (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/functionobjects.cpp (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/loop_unroll.cpp (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/simple_types_constant_folding.cpp (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/simple_types_loop_invariant.cpp (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/stepanov_abstraction.cpp (with props)
test-suite/trunk/SingleSource/Benchmarks/C++Bench/stepanov_vector.cpp (with props)
Modified:
test-suite/trunk/SingleSource/Benchmarks/Makefile
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/LICENSE_1_0_0.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/LICENSE_1_0_0.txt?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/LICENSE_1_0_0.txt (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/LICENSE_1_0_0.txt Sun Jan 11 21:04:59 2009
@@ -0,0 +1,18 @@
+Copyright (c) 2007-2008 Adobe Systems Incorporated
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/LICENSE_1_0_0.txt
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/Makefile?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/Makefile (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/Makefile Sun Jan 11 21:04:59 2009
@@ -0,0 +1,6 @@
+LEVEL = ../../..
+LDFLAGS += -lm -lstdc++
+LIBS = -lstdc++
+FP_ABSTOLERANCE := 0.01
+
+include $(LEVEL)/SingleSource/Makefile.singlesrc
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/README.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/README.txt?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/README.txt (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/README.txt Sun Jan 11 21:04:59 2009
@@ -0,0 +1,56 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html )
+*/
+
+/******************************************************************************/
+
+Goals:
+
+To help compiler vendors identify places where they may be able to improve
+the performance of the code they generate.
+
+To help developers understand the performance impact of using different
+data types, operations, and C++ langugage features with their
+target compilers and OSes.
+
+/******************************************************************************/
+
+Secondary goals:
+
+To take performance problems found in real world code and turn them
+ into benchmarks for compiler vendors and other developers to learn from.
+
+Keep the benchmark portable to as many compilers and OSes as possible
+ This means keeping things simple and external dependencies minimal
+
+Not to use specialized optimization flags per test
+ No pragmas or other compiler directives are allowed in the source.
+ All source files should use the same compilation flags.
+ Use the common optimization flags (-O, -O1, -O2, -O3, or -Os).
+ If another option improves optimization, then why isn't it on for -O3?
+ If an optimization flag doesn't always improve performance, that is
+ most likely a bug in the optimization code that needs to be fixed.
+ In the real world, developers can't test all permutations of all
+ optimization flags. They expect the standard flags to work.
+
+/******************************************************************************/
+
+**** A note to compiler vendors:
+ Please match the idioms, not the instances.
+ The benchmark code will be changing over time.
+ And we do read your assembly output.
+
+/******************************************************************************/
+
+Building:
+
+Unix users should be able to use "make all" to build and "make report"
+to generate the report. If you wish to use a different compiler, you can
+set that from the make command line, or edit the makefile.
+
+Windows users will need to make sure that the VC environment variables
+are set for their shell (command prompt), then use "nmake -f makefile.nt all"
+and "nmake -f makefile.nt report" from within that shell.
+
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/README.txt
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_algorithms.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/benchmark_algorithms.h?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_algorithms.h (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_algorithms.h Sun Jan 11 21:04:59 2009
@@ -0,0 +1,221 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html)
+
+ Shared source file for algorithms used in multiple benchmark files
+*/
+
+namespace benchmark {
+
+/******************************************************************************/
+
+template <typename Iterator>
+bool is_sorted(Iterator first, Iterator last) {
+ Iterator prev = first;
+ first++;
+ while (first != last) {
+ if ( *first++ < *prev++)
+ return false;
+ }
+ return true;
+}
+
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void fill(Iterator first, Iterator last, T value) {
+ while (first != last) *first++ = value;
+}
+
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void fill_random(Iterator first, Iterator last) {
+ while (first != last) {
+ *first++ = static_cast<T>( rand() );
+ }
+}
+
+/******************************************************************************/
+
+template <class Iterator, class T>
+void fill_descending(Iterator first, Iterator last, unsigned count) {
+ while (first != last) {
+ *first++ = static_cast<T>( --count );
+ }
+}
+
+/******************************************************************************/
+
+template <typename Iterator1, typename Iterator2>
+void copy(Iterator1 firstSource, Iterator1 lastSource, Iterator2 firstDest) {
+ while (firstSource != lastSource) *(firstDest++) = *(firstSource++);
+}
+
+/******************************************************************************/
+
+template <class Iterator, class Swapper>
+void reverse(Iterator begin, Iterator end, Swapper doswap)
+{
+ while (begin != end)
+ {
+ --end;
+ if (begin == end)
+ break;
+ doswap(begin, end);
+ ++begin;
+ }
+}
+
+/******************************************************************************/
+
+// our accumulator function template, using iterators or pointers
+template <typename Iterator, typename Number>
+Number accumulate(Iterator first, Iterator last, Number result) {
+ while (first != last) result = result + *first++;
+ return result;
+}
+
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void insertionSort( Iterator begin, Iterator end )
+{
+ Iterator p = begin;
+ p++;
+
+ while ( p != end ) {
+ T tmp = *p;
+ Iterator j = p;
+ Iterator prev = j;
+
+ for ( ; j != begin && tmp < *--prev; --j ) {
+ *j = *prev;
+ }
+
+ *j = tmp;
+ p++;
+ }
+}
+
+/******************************************************************************/
+
+template<typename Iterator, typename T>
+void quicksort(Iterator begin, Iterator end)
+{
+ if ( (end - begin) > 1 ) {
+
+ T middleValue = *begin;
+ Iterator left = begin;
+ Iterator right = end;
+
+ for(;;) {
+
+ while ( middleValue < *(--right) );
+ if ( !(left < right ) ) break;
+
+ while ( *(left) < middleValue )
+ ++left;
+ if ( !(left < right ) ) break;
+
+ // swap
+ T temp = *right;
+ *right = *left;
+ *left = temp;
+ }
+
+ quicksort<Iterator,T>( begin, right + 1 );
+ quicksort<Iterator,T>( right + 1, end );
+ }
+}
+
+/******************************************************************************/
+
+template<typename Iterator, typename T, class Swapper>
+void quicksort(Iterator begin, Iterator end, Swapper doswap)
+{
+ if ( (end - begin) > 1 ) {
+
+ T middleValue = *begin;
+ Iterator left = begin;
+ Iterator right = end;
+
+ for(;;) {
+
+ while ( middleValue < *(--right) );
+ if ( !(left < right ) ) break;
+
+ while ( *(left) < middleValue )
+ ++left;
+ if ( !(left < right ) ) break;
+
+ // swap
+ doswap( right, left );
+ }
+
+ quicksort<Iterator,T, Swapper>( begin, right + 1, doswap );
+ quicksort<Iterator,T, Swapper>( right + 1, end, doswap );
+ }
+}
+
+/******************************************************************************/
+
+template<typename Iterator, typename T>
+void sift_in(ptrdiff_t count, Iterator begin, ptrdiff_t free_in, T next)
+{
+ ptrdiff_t i;
+ ptrdiff_t free = free_in;
+
+ // sift up the free node
+ for ( i = 2*(free+1); i < count; i += i) {
+ if ( *(begin+(i-1)) < *(begin+i))
+ i++;
+ *(begin + free) = *(begin+(i-1));
+ free = i-1;
+ }
+
+ // special case in sift up if the last inner node has only 1 child
+ if (i == count) {
+ *(begin + free) = *(begin+(i-1));
+ free = i-1;
+ }
+
+ // sift down the new item next
+ i = (free-1)/2;
+ while( (free > free_in) && *(begin+i) < next) {
+ *(begin + free) = *(begin+i);
+ free = i;
+ i = (free-1)/2;
+ }
+
+ *(begin + free) = next;
+}
+
+template<typename Iterator, typename T>
+void heapsort(Iterator begin, Iterator end)
+{
+ ptrdiff_t j;
+ ptrdiff_t count = end - begin;
+
+ // build the heap structure
+ for( j = (count / 2) - 1; j >= 0; --j) {
+ T next = *(begin+j);
+ sift_in< Iterator, T>(count, begin, j, next);
+ }
+
+ // search next by next remaining extremal element
+ for( j = count - 1; j >= 1; --j) {
+ T next = *(begin+j);
+ *(begin+j) = *(begin);
+ sift_in< Iterator, T>(j, begin, 0, next);
+ }
+}
+
+} // end namespace benchmark
+
+using namespace benchmark;
+
+/******************************************************************************/
+/******************************************************************************/
+/******************************************************************************/
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_algorithms.h
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_results.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/benchmark_results.h?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_results.h (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_results.h Sun Jan 11 21:04:59 2009
@@ -0,0 +1,168 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html)
+
+ Source file for shared result reporting used by most of the benchmarks
+*/
+
+/******************************************************************************/
+
+/*
+ Yes, this would be easier with a class or std::vector
+ but it needs to work for both C and C++ code
+*/
+
+/* declarations */
+
+typedef struct one_result {
+ double time;
+ const char *label;
+ } one_result;
+
+extern one_result *results;
+
+void record_result( double time, const char *label );
+
+
+/******************************************************************************/
+
+/* implementation */
+
+#include <stdlib.h>
+#include <math.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+
+one_result *results = NULL;
+int current_test = 0;
+int allocated_results = 0;
+
+void record_result( double time, const char *label ) {
+
+ if ( results == NULL || current_test >= allocated_results) {
+ allocated_results += 10;
+ results = (one_result *) realloc( results, allocated_results*sizeof(one_result) );
+ if (results == NULL) {
+ printf("Could not allocate %d results\n", allocated_results);
+ exit(-1);
+ }
+ }
+
+ results[current_test].time = time;
+ results[current_test].label = label;
+ current_test++;
+}
+
+/******************************************************************************/
+
+const int kShowGMeans = 1;
+const int kDontShowGMeans = 0;
+
+const int kShowPenalty = 1;
+const int kDontShowPenalty = 0;
+
+/******************************************************************************/
+
+/*
+I need to be able to parse the label and absolute time from each entry, correctly
+ BUT this also needs to be human readable for people testing/debugging the code
+ (otherwise I'd use XML and make it really easy (if somewhat slow) to parse)
+ (No, XML does not qualify as human readable)
+
+parse as:
+%i ([ ]*)\"%s\" %f sec %f M %f\r
+
+*/
+void summarize(const char *name, int size, int iterations, int show_gmeans, int show_penalty ) {
+ int i;
+ double millions = ((double)(size) * iterations)/1000000.0;
+ double total_absolute_times = 0.0;
+ double gmean_ratio = 0.0;
+
+
+ /* find longest label so we can adjust formatting
+ 12 = strlen("description")+1 */
+ int longest_label_len = 12;
+ for (i = 0; i < current_test; ++i) {
+ int len = (int)strlen(results[i].label);
+ if (len > longest_label_len)
+ longest_label_len = len;
+ }
+
+ printf("\ntest %*s description absolute operations ratio with\n", longest_label_len-12, " ");
+ printf("number %*s time per second test0\n\n", longest_label_len, " ");
+
+ for (i = 0; i < current_test; ++i)
+ printf("%2i %*s\"%s\" %5.2f sec %5.2f M %.2f\n",
+ i,
+ (int)(longest_label_len - strlen(results[i].label)),
+ "",
+ results[i].label,
+ results[i].time,
+ millions/results[i].time,
+ results[i].time/results[0].time);
+
+ // calculate total time
+ for (i = 0; i < current_test; ++i) {
+ total_absolute_times += results[i].time;
+ }
+
+ // report total time
+ printf("\nTotal absolute time for %s: %.2f sec\n", name, total_absolute_times);
+
+ if ( current_test > 1 && show_penalty ) {
+
+ // calculate gmean of tests compared to baseline
+ for (i = 1; i < current_test; ++i) {
+ gmean_ratio += log(results[i].time/results[0].time);
+ }
+
+ // report gmean of tests as the penalty
+ printf("\n%s Penalty: %.2f\n\n", name, exp(gmean_ratio/(current_test-1)));
+ }
+
+ // reset the test counter so we can run more tests
+ current_test = 0;
+}
+
+/******************************************************************************/
+
+void summarize_simplef( FILE *output, const char *name ) {
+ int i;
+ double total_absolute_times = 0.0;
+
+ /* find longest label so we can adjust formatting
+ 12 = strlen("description")+1 */
+ int longest_label_len = 12;
+ for (i = 0; i < current_test; ++i) {
+ int len = (int)strlen(results[i].label);
+ if (len > longest_label_len)
+ longest_label_len = len;
+ }
+
+ fprintf(output,"\ntest %*s description absolute\n", longest_label_len-12, " ");
+ fprintf(output,"number %*s time\n\n", longest_label_len, " ");
+
+ for (i = 0; i < current_test; ++i)
+ fprintf(output,"%2i %*s\"%s\" %5.2f sec\n",
+ i,
+ (int)(longest_label_len - strlen(results[i].label)),
+ "",
+ results[i].label,
+ results[i].time);
+
+ // calculate total time
+ for (i = 0; i < current_test; ++i) {
+ total_absolute_times += results[i].time;
+ }
+
+ // report total time
+ fprintf(output,"\nTotal absolute time for %s: %.2f sec\n", name, total_absolute_times);
+
+ // reset the test counter so we can run more tests
+ current_test = 0;
+}
+
+/******************************************************************************/
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_results.h
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_shared_tests.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/benchmark_shared_tests.h?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_shared_tests.h (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_shared_tests.h Sun Jan 11 21:04:59 2009
@@ -0,0 +1,758 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html )
+
+
+ Source file for tests shared among several benchmarks
+*/
+
+/******************************************************************************/
+
+template<typename T>
+inline bool tolerance_equal(T &a, T &b) {
+ T diff = a - b;
+ return (abs(diff) < 1.0e-6);
+}
+
+
+template<>
+inline bool tolerance_equal(int32_t &a, int32_t &b) {
+ return (a == b);
+}
+template<>
+inline bool tolerance_equal(uint32_t &a, uint32_t &b) {
+ return (a == b);
+}
+template<>
+inline bool tolerance_equal(uint64_t &a, uint64_t &b) {
+ return (a == b);
+}
+template<>
+inline bool tolerance_equal(int64_t &a, int64_t &b) {
+ return (a == b);
+}
+
+template<>
+inline bool tolerance_equal(double &a, double &b) {
+ double diff = a - b;
+ double reldiff = diff;
+ if (fabs(a) > 1.0e-8)
+ reldiff = diff / a;
+ return (fabs(reldiff) < 1.0e-6);
+}
+
+template<>
+inline bool tolerance_equal(float &a, float &b) {
+ float diff = a - b;
+ double reldiff = diff;
+ if (fabs(a) > 1.0e-4)
+ reldiff = diff / a;
+ return (fabs(reldiff) < 1.0e-3); // single precision divide test is really imprecise
+}
+
+/******************************************************************************/
+
+template <typename T, typename Shifter>
+inline void check_shifted_sum(T result) {
+ T temp = (T)SIZE * Shifter::do_shift((T)init_value);
+ if (!tolerance_equal<T>(result,temp))
+ printf("test %i failed\n", current_test);
+}
+
+template <typename T, typename Shifter>
+inline void check_shifted_sum_CSE(T result) {
+ T temp = (T)0.0;
+ if (!tolerance_equal<T>(result,temp))
+ printf("test %i failed\n", current_test);
+}
+
+template <typename T, typename Shifter>
+inline void check_shifted_variable_sum(T result, T var) {
+ T temp = (T)SIZE * Shifter::do_shift((T)init_value, var);
+ if (!tolerance_equal<T>(result,temp))
+ printf("test %i failed\n", current_test);
+}
+
+template <typename T, typename Shifter>
+inline void check_shifted_variable_sum(T result, T var1, T var2, T var3, T var4) {
+ T temp = (T)SIZE * Shifter::do_shift((T)init_value, var1, var2, var3, var4);
+ if (!tolerance_equal<T>(result,temp))
+ printf("test %i failed\n", current_test);
+}
+
+template <typename T, typename Shifter>
+inline void check_shifted_variable_sum_CSE(T result, T var) {
+ T temp = (T)0.0;
+ if (!tolerance_equal<T>(result,temp))
+ printf("test %i failed\n", current_test);
+}
+
+template <typename T, typename Shifter>
+inline void check_shifted_variable_sum_CSE(T result, T var1, T var2, T var3, T var4) {
+ T temp = (T)0.0;
+ if (!tolerance_equal<T>(result,temp))
+ printf("test %i failed\n", current_test);
+}
+
+
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void fill(Iterator first, Iterator last, T value) {
+ while (first != last) *first++ = value;
+}
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_constant_add {
+ static T do_shift(T input) { return (input + T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiple_constant_add {
+ static T do_shift(T input) { return (input + T(1) + T(2) + T(3) + T(4)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_constant_sub {
+ static T do_shift(T input) { return (input - T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiple_constant_sub {
+ static T do_shift(T input) { return (input - T(1) - T(2) - T(3) - T(4)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_constant_multiply {
+ static T do_shift(T input) { return (input * T(120)); }
+ };
+
+/******************************************************************************/
+
+// this should result in a single multiply
+template <typename T>
+ struct custom_multiple_constant_multiply {
+ static T do_shift(T input) { return (input * T(2) * T(3) * T(4) * T(5)); }
+ };
+
+/******************************************************************************/
+
+// this should result in a single add
+template <typename T>
+ struct custom_multiple_constant_multiply2 {
+ static T do_shift(T input) { return (input + T(2) * T(3) * T(4) * T(5)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_constant_divide {
+ static T do_shift(T input) { return (input / T(5)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiple_constant_divide {
+ static T do_shift(T input) { return ((((input / T(2) ) / T(3) ) / T(4)) / T(5)); }
+ };
+
+/******************************************************************************/
+
+// this more likely to have constants fused than the version above
+template <typename T>
+ struct custom_multiple_constant_divide2 {
+ static T do_shift(T input) { return (input + (((T(120) / T(3) ) / T(4)) / T(5))); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiple_constant_mixed {
+ static T do_shift(T input) { return (input + T(2) - T(3) * T(4) / T(5)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_constant_and {
+ static T do_shift(T input) { return (input & T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiple_constant_and {
+ static T do_shift(T input) { return (input & T(15) & T(30) & T(31) & T(63)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_constant_or {
+ static T do_shift(T input) { return (input | T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiple_constant_or {
+ static T do_shift(T input) { return (input | T(15) | T(30) | T(31) | T(63)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_constant_xor {
+ static T do_shift(T input) { return (input ^ T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiple_constant_xor {
+ static T do_shift(T input) { return (input ^ T(15) ^ T(30) ^ T(31) ^ T(63)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_two {
+ static T do_shift(T input) { return (T(2)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_add_constants {
+ static T do_shift(T input) { return (T(1) + T(2)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_sub_constants {
+ static T do_shift(T input) { return (T(2) - T(1)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiply_constants {
+ static T do_shift(T input) { return (T(2) * T(3)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_divide_constants {
+ static T do_shift(T input) { return (T(20) / T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_mod_constants {
+ static T do_shift(T input) { return (T(23) % T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_and_constants {
+ static T do_shift(T input) { return (T(23) & T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_or_constants {
+ static T do_shift(T input) { return (T(23) | T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_xor_constants {
+ static T do_shift(T input) { return (T(23) ^ T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_equal_constants {
+ static T do_shift(T input) { return (T(23) == T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_notequal_constants {
+ static T do_shift(T input) { return (T(23) != T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_greaterthan_constants {
+ static T do_shift(T input) { return (T(23) > T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_lessthan_constants {
+ static T do_shift(T input) { return (T(23) < T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_greaterthanequal_constants {
+ static T do_shift(T input) { return (T(23) >= T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_lessthanequal_constants {
+ static T do_shift(T input) { return (T(23) <= T(10)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_add_variable {
+ static T do_shift(T input, T v1) { return (input + v1); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_sub_variable {
+ static T do_shift(T input, T v1) { return (input - v1); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiply_variable {
+ static T do_shift(T input, T v1) { return (input * v1); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_divide_variable {
+ static T do_shift(T input, T v1) { return (input / v1); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_add_multiple_variable {
+ static T do_shift(T input, T v1, T v2, T v3, T v4) { return (input + v1 + v2 + v3 + v4); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_sub_multiple_variable {
+ static T do_shift(T input, T v1, T v2, T v3, T v4) { return (input - v1 - v2 - v3 - v4); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiply_multiple_variable {
+ static T do_shift(T input, T v1, T v2, T v3, T v4) { return (input * v1 * v2 * v3 * v4); }
+ };
+
+/******************************************************************************/
+
+// something more likely to be moved out of loops, and a sanity check
+template <typename T>
+ struct custom_multiply_multiple_variable2 {
+ static T do_shift(T input, T v1, T v2, T v3, T v4) { return (input + v1 * v2 * v3 * v4); }
+ };
+
+/******************************************************************************/
+
+// this can NOT have CSE and loop invariant motion applied in integer math
+// and can only be optimized in float if inexact math is allowed
+template <typename T>
+ struct custom_divide_multiple_variable {
+ static T do_shift(T input, T v1, T v2, T v3, T v4) { return ((((input / v1 ) / v2 ) / v3) / v4); }
+ };
+
+/******************************************************************************/
+
+// this can have CSE and loop invariant motion applied in integer math
+// this should be optimizeable without inexact math
+template <typename T>
+ struct custom_divide_multiple_variable2 {
+ static T do_shift(T input, T v1, T v2, T v3, T v4) { return (input + (((v1 / v2 ) / v3) / v4)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_mixed_multiple_variable {
+ static T do_shift(T input, T v1, T v2, T v3, T v4) { return (input + v1 - v2 * v3 / v4); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_variable_and {
+ static T do_shift(T input, T v1) { return (input & v1); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiple_variable_and {
+ static T do_shift(T input, T v1, T v2, T v3, T v4) { return (input & v1 & v2 & v3 & v4); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_variable_or {
+ static T do_shift(T input, T v1) { return (input | v1); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiple_variable_or {
+ static T do_shift(T input, T v1, T v2, T v3, T v4) { return (input | v1 | v2 | v3 | v4); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_variable_xor {
+ static T do_shift(T input, T v1) { return (input ^ v1); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_multiple_variable_xor {
+ static T do_shift(T input, T v1, T v2, T v3, T v4) { return (input ^ v1 ^ v2 ^ v3 ^ v4); }
+ };
+
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_identity {
+ static T do_shift(T input) { return (input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_add_zero {
+ static T do_shift(T input) { return (input + T(0)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_sub_zero {
+ static T do_shift(T input) { return (input - T(0)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_negate {
+ static T do_shift(T input) { return (-input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_negate_twice {
+ static T do_shift(T input) { return (-(-input)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_zero_minus {
+ static T do_shift(T input) { return (T(0) - input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_times_one {
+ static T do_shift(T input) { return (input * T(1)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_divideby_one {
+ static T do_shift(T input) { return (input / T(1)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_algebra_mixed {
+ static T do_shift(T input) { return (-(T(0) - (((input + T(0)) - T(0)) / T(1)))) * T(1); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_zero {
+ static T do_shift(T input) { return T(0); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_times_zero {
+ static T do_shift(T input) { return (input * T(0)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_subtract_self {
+ static T do_shift(T input) { return (input - input); }
+ };
+/******************************************************************************/
+
+template <typename T>
+ struct custom_algebra_mixed_constant {
+ static T do_shift(T input) { return (input - (-(T(0) - (((input + T(0)) / T(1)) - T(0)))) * T(1)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_cse1 {
+ static T do_shift(T v1, T v2, T v3) { return (v1 * (v2 - v3) ); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_and_self {
+ static T do_shift(T input) { return (input & input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_or_self {
+ static T do_shift(T input) { return (input | input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_xor_self {
+ static T do_shift(T input) { return (input ^ input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_or_zero {
+ static T do_shift(T input) { return (input | T(0)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_xor_zero {
+ static T do_shift(T input) { return (input ^ T(0)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_andnot_zero {
+ static T do_shift(T input) { return (input & ~ T(0)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_and_zero {
+ static T do_shift(T input) { return (input & T(0)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_mod_one {
+ static T do_shift(T input) { return (input % T(1)); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_equal_self {
+ static T do_shift(T input) { return (input == input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_notequal_self {
+ static T do_shift(T input) { return (input != input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_greaterthan_self {
+ static T do_shift(T input) { return (input > input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_lessthan_self {
+ static T do_shift(T input) { return (input < input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_greaterthanequal_self {
+ static T do_shift(T input) { return (input >= input); }
+ };
+
+/******************************************************************************/
+
+template <typename T>
+ struct custom_lessthanequal_self {
+ static T do_shift(T input) { return (input <= input); }
+ };
+
+/******************************************************************************/
+
+template <typename T, typename Shifter>
+void test_constant(T* first, int count, const char *label) {
+ int i;
+
+ start_timer();
+
+ for(i = 0; i < iterations; ++i) {
+ T result = 0;
+ for (int n = 0; n < count; ++n) {
+ result += Shifter::do_shift( first[n] );
+ }
+ check_shifted_sum<T, Shifter>(result);
+ }
+
+ record_result( timer(), label );
+}
+
+/******************************************************************************/
+
+template <typename T, typename Shifter>
+void test_variable1(T* first, int count, T v1, const char *label) {
+ int i;
+
+ start_timer();
+
+ for(i = 0; i < iterations; ++i) {
+ T result = 0;
+ for (int n = 0; n < count; ++n) {
+ result += Shifter::do_shift( first[n], v1 );
+ }
+ check_shifted_variable_sum<T, Shifter>(result, v1);
+ }
+
+ record_result( timer(), label );
+}
+
+/******************************************************************************/
+
+template <typename T, typename Shifter>
+void test_variable4(T* first, int count, T v1, T v2, T v3, T v4, const char *label) {
+ int i;
+
+ start_timer();
+
+ for(i = 0; i < iterations; ++i) {
+ T result = 0;
+ for (int n = 0; n < count; ++n) {
+ result += Shifter::do_shift( first[n], v1, v2, v3, v4 );
+ }
+ check_shifted_variable_sum<T, Shifter>(result, v1, v2, v3, v4);
+ }
+
+ record_result( timer(), label );
+}
+
+/******************************************************************************/
+
+template <typename T, typename Shifter>
+void test_CSE_opt(T* first, int count, T v1, const char *label) {
+ int i;
+
+ start_timer();
+
+ for(i = 0; i < iterations; ++i) {
+ T result = 0;
+ T temp = Shifter::do_shift( v1, first[0], first[1] );
+ temp += temp;
+ result += first[0] + temp;
+ result -= first[1] + temp;
+ for (int n = 1; n < count; ++n) {
+ temp = Shifter::do_shift( v1, first[n-1], first[n] );
+ temp += temp;
+ result += first[n-1] + temp;
+ result -= first[n] + temp;
+ }
+ check_shifted_variable_sum_CSE<T, Shifter>(result, v1);
+ }
+
+ record_result( timer(), label );
+}
+
+/******************************************************************************/
+
+template <typename T, typename Shifter>
+void test_CSE(T* first, int count, T v1, const char *label) {
+ int i;
+
+ start_timer();
+
+ for(i = 0; i < iterations; ++i) {
+ T result = 0;
+ result += first[0] + Shifter::do_shift( v1, first[0], first[1] ) + Shifter::do_shift( v1, first[0], first[1] );
+ result -= first[1] + Shifter::do_shift( v1, first[0], first[1] ) + Shifter::do_shift( v1, first[0], first[1] );
+ for (int n = 1; n < count; ++n) {
+ result += first[n-1] + Shifter::do_shift( v1, first[n-1], first[n] ) + Shifter::do_shift( v1, first[n-1], first[n] );
+ result -= first[n] + Shifter::do_shift( v1, first[n-1], first[n] ) + Shifter::do_shift( v1, first[n-1], first[n] );
+ }
+ check_shifted_variable_sum_CSE<T, Shifter>(result, v1);
+ }
+
+ record_result( timer(), label );
+}
+
+/******************************************************************************/
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_shared_tests.h
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_stdint.hpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/benchmark_stdint.hpp?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_stdint.hpp (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_stdint.hpp Sun Jan 11 21:04:59 2009
@@ -0,0 +1,58 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html )
+
+
+ Not all compilers support <cstdint> yet, and some don't even have <stdint.h>
+ So, we have to do our own type definitions.
+*/
+
+
+/******************************************************************************/
+
+#if _MSC_VER
+
+ // for platforms that don't include the C99 header stdint.h
+
+ // if your platform does not include stdint.h, please edit the #if above
+ // to include your platform (and remember that it has to work elsewhere as well)
+
+ template<bool P, typename T, typename E>
+ struct if_;
+
+ template<typename T, typename E>
+ struct if_<true, T, E> { typedef T type; };
+
+ template<typename T, typename E>
+ struct if_<false, T, E>{ typedef E type; };
+
+ typedef signed char int8_t;
+ typedef unsigned char uint8_t;
+
+ typedef signed short int16_t;
+ typedef unsigned short uint16_t;
+
+ typedef if_<sizeof(int) == 4, int, long>::type int32_t;
+ typedef if_<sizeof(unsigned int) == 4, unsigned int, unsigned long>::type uint32_t;
+
+ #if _MSC_VER
+ typedef __int64 int64_t;
+ typedef unsigned __int64 uint64_t;
+ #else
+ typedef long long int64_t;
+ typedef unsigned long long uint64_t;
+ #endif
+
+#else
+
+ // for platforms that do have stdint.h
+
+ // if your platform fails to find this header, please edit the #if above
+ // to include your platform (and remember that it has to work elsewhere as well)
+
+ #include <stdint.h>
+
+#endif
+
+/******************************************************************************/
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_stdint.hpp
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_timer.h
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/benchmark_timer.h?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_timer.h (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_timer.h Sun Jan 11 21:04:59 2009
@@ -0,0 +1,29 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html)
+
+ Shared source file for timing, used by all the benchmarks
+*/
+
+/******************************************************************************/
+
+#include <time.h>
+
+/******************************************************************************/
+
+/* Yes, this would be easier with a class or vector
+ but it needs to work for both C and C++ code
+*/
+
+/* simple timer functions */
+clock_t start_time, end_time;
+
+void start_timer() { start_time = clock(); }
+
+double timer() {
+ end_time = clock();
+ return (end_time - start_time)/ (double)(CLOCKS_PER_SEC);
+}
+
+/******************************************************************************/
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/benchmark_timer.h
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/functionobjects.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/functionobjects.cpp?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/functionobjects.cpp (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/functionobjects.cpp Sun Jan 11 21:04:59 2009
@@ -0,0 +1,367 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html )
+
+
+ This test file started life as
+ ISO/IEC TR 18015:2006(E) Appendix D.4
+
+
+Goals:
+
+ Compare the performance of function pointers, functors, inline functors,
+ standard functors, and native comparison operators
+
+ Also compare the performance of qsort(), quicksort template, and std::sort
+
+
+Assumptions:
+
+ 1) inline functors, standard functors and inlined native
+ comparisons will perform similarly
+
+ 2) using functors is faster than using function pointers
+
+ 3) inline functors are as fast or faster than out of line functors
+
+ 4) a template is at least as fast as a hard coded function of
+ the same algorithm, sometimes faster
+
+ 5) std::sort is faster than qsort()
+
+ 6) std::sort is faster than a naive quicksort template using the same functor
+
+
+Since qsort's comparison function must return int (less than 0, 0, greater than 0)
+ and std::sort's must return a bool, it is not possible to test them with each
+ other's comparator.
+
+*/
+
+
+/******************************************************************************/
+
+#include <functional>
+#include <algorithm>
+#include <cstdlib>
+#include "benchmark_results.h"
+#include "benchmark_timer.h"
+
+using namespace std;
+
+/******************************************************************************/
+
+template <class Iterator>
+void verify_sorted(Iterator first, Iterator last) {
+ Iterator prev = first;
+ first++;
+ while (first != last) {
+ if (*first++ < *prev++) {
+ printf("test %i failed\n", current_test);
+ break;
+ }
+ }
+}
+
+/******************************************************************************/
+// --------- helper functions --------------------------------------------
+
+// qsort passes void * arguments to its comparison function,
+// which must return negative, 0, or positive value
+int
+less_than_function1( const void * lhs, const void * rhs )
+ {
+ if( *(const double *) lhs < *(const double *) rhs ) return -1;
+ if( *(const double *) lhs > *(const double *) rhs ) return 1;
+ return 0;
+ }
+
+// std::sort, on the other hand, needs a comparator that returns true or false
+bool
+less_than_function2( const double lhs, const double rhs )
+ {
+ return( lhs < rhs? true : false );
+ }
+
+// the comparison operator in the following functor is defined out of line
+struct less_than_functor
+{
+ bool operator()( const double& lhs, const double& rhs ) const;
+};
+
+bool
+less_than_functor::operator()( const double& lhs, const double& rhs ) const
+ {
+ return( lhs < rhs? true : false );
+ }
+
+// the comparison operator in the following functor is defined inline
+struct inline_less_than_functor
+{
+ inline bool operator()( const double& lhs, const double& rhs ) const
+ {
+ return( lhs < rhs? true : false );
+ }
+};
+
+/******************************************************************************/
+
+// hard coded comparison function
+template<class Iterator>
+void quicksort(Iterator begin, Iterator end)
+{
+ // this only works for pointers and STL iterators
+ typedef typename iterator_traits<Iterator>::value_type T;
+
+ if ( (end - begin) > 1 ) {
+
+ T middleValue = *begin;
+ Iterator left = begin;
+ Iterator right = end;
+
+ for(;;) {
+
+ while ( middleValue < *(--right) );
+ if ( !(left < right ) ) break;
+
+ while ( *(left) < middleValue )
+ ++left;
+ if ( !(left < right ) ) break;
+
+ // swap
+ T temp = *right;
+ *right = *left;
+ *left = temp;
+ }
+
+ quicksort( begin, right + 1 );
+ quicksort( right + 1, end );
+ }
+}
+
+/******************************************************************************/
+
+// comparison function passed in as a functor
+template<class Iterator, typename Comparator>
+void quicksort(Iterator begin, Iterator end, Comparator compare)
+{
+ // this only works for pointers and STL iterators
+ typedef typename iterator_traits<Iterator>::value_type T;
+
+ if ( (end - begin) > 1 ) {
+
+ T middleValue = *begin;
+ Iterator left = begin;
+ Iterator right = end;
+
+ for(;;) {
+
+ while ( compare( middleValue, *(--right) ) );
+ if ( !(left < right ) ) break;
+ while ( compare( *(left), middleValue ) )
+ ++left;
+ if ( !(left < right ) ) break;
+
+ // swap
+ T temp = *right;
+ *right = *left;
+ *left = temp;
+ }
+
+ quicksort( begin, right + 1, compare );
+ quicksort( right + 1, end, compare );
+ }
+}
+
+/******************************************************************************/
+
+typedef bool comparator_function( const double x, const double y );
+
+// use a pointer to function as a template parameter
+// exact function is known at compile time, and can be inlined
+template<class Iterator, comparator_function compare>
+void quicksort(Iterator begin, Iterator end)
+{
+ // this only works for pointers and STL iterators
+ typedef typename iterator_traits<Iterator>::value_type T;
+
+ if ( (end - begin) > 1 ) {
+
+ T middleValue = *begin;
+ Iterator left = begin;
+ Iterator right = end;
+
+ for(;;) {
+
+ while ( compare( middleValue, *(--right) ) );
+ if ( !(left < right ) ) break;
+ while ( compare( *(left), middleValue ) )
+ ++left;
+ if ( !(left < right ) ) break;
+
+ // swap
+ T temp = *right;
+ *right = *left;
+ *left = temp;
+ }
+
+ quicksort( begin, right + 1, compare );
+ quicksort( right + 1, end, compare );
+ }
+}
+
+/******************************************************************************/
+
+// use a function pointer
+// most compilers will not inline the function argument
+void quicksort_function(double* begin, double* end, comparator_function compare)
+{
+ if ( (end - begin) > 1 ) {
+
+ double middleValue = *begin;
+ double* left = begin;
+ double* right = end;
+
+ for(;;) {
+
+ while ( compare( middleValue, *(--right) ) );
+ if ( !(left < right ) ) break;
+ while ( compare( *(left), middleValue ) )
+ ++left;
+ if ( !(left < right ) ) break;
+
+ // swap
+ double temp = *right;
+ *right = *left;
+ *left = temp;
+ }
+
+ quicksort( begin, right + 1, compare );
+ quicksort( right + 1, end, compare );
+ }
+}
+
+/******************************************************************************/
+
+int main(int argc, char* argv[])
+{
+ int i;
+ int iterations = (1 < argc) ? atoi(argv[1]) : 300; // number of iterations
+ int tablesize = (2 < argc) ? atoi(argv[2]) : 10000; // size of array
+
+
+ // seed the random number generator, so we get repeatable results
+ srand( tablesize + 123 );
+
+
+ // initialize the table to sort
+ double * master_table = new double[tablesize];
+ for( int n = 0; n < tablesize; ++n )
+ {
+ master_table[n] = static_cast<double>( rand() );
+ }
+
+ double * table = new double[tablesize]; // working copy
+
+
+
+ // here is where the timing starts
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ qsort( table, tablesize, sizeof(double), less_than_function1 );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ quicksort_function( table, table + tablesize, less_than_function2 );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ quicksort( table, table + tablesize, less_than_function2 );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ quicksort<double *, less_than_function2 >( table, table + tablesize );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ sort( table, table + tablesize, less_than_function2 );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ quicksort( table, table + tablesize, less_than_functor() );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ sort( table, table + tablesize, less_than_functor() );
+ verify_sorted( table, table + tablesize );
+ copy(master_table, master_table+tablesize, table);
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ quicksort( table, table + tablesize, inline_less_than_functor() );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ sort( table, table + tablesize, inline_less_than_functor() );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ quicksort( table, table + tablesize, less<double>() );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ sort( table, table + tablesize, less<double>() );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy(master_table, master_table+tablesize, table);
+ quicksort( table, table + tablesize );
+ verify_sorted( table, table + tablesize );
+ }
+
+ for (i = 0; i < iterations; ++i)
+ {
+ copy( master_table, master_table+tablesize, table );
+ sort( table, table + tablesize );
+ verify_sorted( table, table + tablesize );
+ }
+
+
+ delete[] table;
+ delete[] master_table;
+
+ return 0;
+}
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/functionobjects.cpp
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/loop_unroll.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/loop_unroll.cpp?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/loop_unroll.cpp (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/loop_unroll.cpp Sun Jan 11 21:04:59 2009
@@ -0,0 +1,340 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html)
+
+
+Goal: Test compiler optimizations related to loop unrolling
+
+Assumptions:
+
+ 1) the compiler will unroll loops to hide instruction latency
+ for() {}
+ while() {}
+ do {} while()
+ goto
+
+ 2) if the compiler unrolls the loop, it should not be slower than the original loop without unrolling
+
+ 3) the compiler should unroll a multi-calculation loop as well as a single calculation loop
+ up to the limit of performance gain for unrolling that loop
+ in other words: no penalty for manually unrolling,
+ as long as the manual unroll is less than or equal to the optimum unroll factor
+
+ 4) The compiler should recognize and unroll all loop styles with the same efficiency
+ in other words: do, while, for, and goto should have identical performance
+
+*/
+
+#include "benchmark_stdint.hpp"
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <stdlib.h>
+#include <math.h>
+#include "benchmark_results.h"
+#include "benchmark_timer.h"
+
+/******************************************************************************/
+
+// this constant may need to be adjusted to give reasonable minimum times
+// For best results, times should be about 1.0 seconds for the minimum test run
+int iterations = 1000;
+
+// 8000 items, or between 8k and 64k of data
+// this is intended to remain within the L2 cache of most common CPUs
+#define SIZE 8000
+
+// initial value for filling our arrays, may be changed from the command line
+double init_value = 1.0;
+
+/******************************************************************************/
+
+#include "benchmark_shared_tests.h"
+
+/******************************************************************************/
+/******************************************************************************/
+
+template <typename T>
+T hash_func2(T seed) {
+ return (914237 * (seed + 12345)) - 13;
+}
+
+template <typename T>
+T complete_hash_func(T seed) {
+ return hash_func2( hash_func2( hash_func2( seed ) ) );
+}
+
+/******************************************************************************/
+
+template <typename T>
+inline void check_sum(T result) {
+ T temp = (T)SIZE * complete_hash_func( (T)init_value );
+ if (!tolerance_equal<T>(result,temp)) printf("test %i failed\n", current_test);
+}
+
+/******************************************************************************/
+
+// this is the heart of our loop unrolling - a class that unrolls itself to generate the inner loop code
+// at least as long as we keep F < 50 (or some compilers won't compile it)
+template< int F, typename T >
+struct loop_inner_body {
+ inline static void do_work(T &result, const T *first, int n) {
+ loop_inner_body<F-1,T>::do_work(result, first, n);
+ T temp = first[ n + (F-1) ];
+ temp = complete_hash_func( temp );
+ result += temp;
+ }
+};
+
+template< typename T >
+struct loop_inner_body<0,T> {
+ inline static void do_work(T &, const T *, int) {
+ }
+};
+
+/******************************************************************************/
+/******************************************************************************/
+
+// F is the unrolling factor
+template <int F, typename T >
+void test_for_loop_unroll_factor(const T* first, int count, const char *label) {
+ int i;
+
+ start_timer();
+
+ for(i = 0; i < iterations; ++i) {
+ T result = 0;
+ int n = 0;
+
+ for (; n < (count - (F-1)); n += F) {
+ loop_inner_body<F,T>::do_work(result,first, n);
+ }
+
+ for (; n < count; ++n) {
+ result += complete_hash_func( first[n] );
+ }
+
+ check_sum<T>(result);
+ }
+
+ record_result( timer(), label );
+}
+
+/******************************************************************************/
+
+// F is the unrolling factor
+template <int F, typename T >
+void test_while_loop_unroll_factor(const T* first, int count, const char *label) {
+ int i;
+
+ start_timer();
+
+ for(i = 0; i < iterations; ++i) {
+ T result = 0;
+ int n = 0;
+
+ while ( n < (count - (F-1)) ) {
+ loop_inner_body<F,T>::do_work(result,first, n);
+ n += F;
+ }
+
+ while ( n < count ) {
+ result += complete_hash_func( first[n] );
+ ++n;
+ }
+
+ check_sum<T>(result);
+ }
+
+ record_result( timer(), label );
+}
+
+/******************************************************************************/
+
+// F is the unrolling factor
+template <int F, typename T >
+void test_do_loop_unroll_factor(const T* first, int count, const char *label) {
+ int i;
+
+ start_timer();
+
+ for(i = 0; i < iterations; ++i) {
+ T result = 0;
+ int n = 0;
+
+ if ((count - n) >= F)
+ do {
+ loop_inner_body<F,T>::do_work(result,first, n);
+ n += F;
+ } while (n < (count - (F-1)));
+
+ if (n < count)
+ do {
+ result += complete_hash_func( first[n] );
+ ++n;
+ } while (n != count);
+
+ check_sum<T>(result);
+ }
+
+ record_result( timer(), label );
+}
+
+/******************************************************************************/
+
+// F is the unrolling factor
+template <int F, typename T >
+void test_goto_loop_unroll_factor(const T* first, int count, const char *label) {
+ int i;
+
+ start_timer();
+
+ for(i = 0; i < iterations; ++i) {
+ T result = 0;
+ int n = 0;
+
+ if ((count - n) >= F) {
+loop2_start:
+ loop_inner_body<F,T>::do_work(result,first, n);
+ n += F;
+
+ if (n < (count - (F-1)))
+ goto loop2_start;
+ }
+
+ if (n < count) {
+loop_start:
+ result += complete_hash_func( first[n] );
+ ++n;
+
+ if (n != count)
+ goto loop_start;
+ }
+
+ check_sum<T>(result);
+ }
+
+ record_result( timer(), label );
+}
+
+/******************************************************************************/
+/******************************************************************************/
+
+// our global arrays of numbers to be operated upon
+
+double dataDouble[SIZE];
+
+int32_t data32[SIZE];
+
+// not elegant, but I need strings to hang around until we print the results
+// and I don't want to pull in STL
+const int UnrollLimit = 32;
+char temp_string[UnrollLimit][100];
+
+/******************************************************************************/
+/******************************************************************************/
+
+// another unrolled loop to create all of our tests
+template< int N, typename T >
+struct for_loop_tests {
+ static void do_test( const T *data, const char *label_base ) {
+ for_loop_tests<N-1, T>::do_test(data, label_base);
+ test_for_loop_unroll_factor<N>( data, SIZE, temp_string[N-1] );
+ }
+};
+
+template<typename T>
+struct for_loop_tests<0,T> {
+ static void do_test( const T *, const char * ) {
+ }
+};
+
+/******************************************************************************/
+
+template< int N, typename T >
+struct while_loop_tests {
+ static void do_test( const T *data, const char *label_base ) {
+ while_loop_tests<N-1, T>::do_test(data, label_base);
+ test_while_loop_unroll_factor<N>( data, SIZE, temp_string[N-1] );
+ }
+};
+
+template<typename T>
+struct while_loop_tests<0,T> {
+ static void do_test( const T *, const char * ) {
+ }
+};
+
+/******************************************************************************/
+
+template< int N, typename T >
+struct do_loop_tests {
+ static void do_test( const T *data, const char *label_base ) {
+ do_loop_tests<N-1, T>::do_test(data, label_base);
+ test_do_loop_unroll_factor<N>( data, SIZE, temp_string[N-1] );
+ }
+};
+
+template<typename T>
+struct do_loop_tests<0,T> {
+ static void do_test( const T *, const char * ) {
+ }
+};
+
+/******************************************************************************/
+
+template< int N, typename T >
+struct goto_loop_tests {
+ static void do_test( const T *data, const char *label_base ) {
+ goto_loop_tests<N-1, T>::do_test(data, label_base);
+ test_goto_loop_unroll_factor<N>( data, SIZE, temp_string[N-1] );
+ }
+};
+
+template<typename T>
+struct goto_loop_tests<0,T> {
+ static void do_test( const T *, const char * ) {
+ }
+};
+
+/******************************************************************************/
+/******************************************************************************/
+
+int main(int argc, char** argv) {
+ if (argc > 1) iterations = atoi(argv[1]);
+ if (argc > 2) init_value = (double) atof(argv[2]);
+
+
+// int32_t
+ ::fill(data32, data32+SIZE, int32_t(init_value));
+
+ for_loop_tests<UnrollLimit, int32_t>::do_test( data32, "int32_t for loop unroll" );
+
+ while_loop_tests<UnrollLimit, int32_t>::do_test( data32, "int32_t while loop unroll" );
+
+ do_loop_tests<UnrollLimit, int32_t>::do_test( data32, "int32_t do loop unroll" );
+
+ goto_loop_tests<UnrollLimit, int32_t>::do_test( data32, "int32_t goto loop unroll" );
+
+
+// double
+ iterations /= 4;
+
+ ::fill(dataDouble, dataDouble+SIZE, double(init_value));
+
+ for_loop_tests<UnrollLimit, double>::do_test( dataDouble, "double for loop unroll" );
+
+ while_loop_tests<UnrollLimit, double>::do_test( dataDouble, "double while loop unroll" );
+
+ do_loop_tests<UnrollLimit, double>::do_test( dataDouble, "double do loop unroll" );
+
+ goto_loop_tests<UnrollLimit, double>::do_test( dataDouble, "double goto loop unroll" );
+
+
+ return 0;
+}
+
+// the end
+/******************************************************************************/
+/******************************************************************************/
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/loop_unroll.cpp
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/simple_types_constant_folding.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/simple_types_constant_folding.cpp?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/simple_types_constant_folding.cpp (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/simple_types_constant_folding.cpp Sun Jan 11 21:04:59 2009
@@ -0,0 +1,559 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html )
+
+
+Goal: Test compiler optimizations related to constant folding of simple language defined types
+
+Assumptions:
+
+ 1) the compiler will combine constant calculations into a single constant for simple types
+ aka constant folding
+ result = A + B ==> result = constant
+ result = A - B ==> result = constant
+ result = A * B ==> result = constant
+ result = A / B ==> result = constant
+ result = A % B ==> result = constant for integer types
+ result = (A == B) ==> result = constant for integer types
+ result = (A != B) ==> result = constant for integer types
+ result = (A > B) ==> result = constant for integer types
+ result = (A < B) ==> result = constant for integer types
+ result = (A >= B) ==> result = constant for integer types
+ result = (A <= B) ==> result = constant for integer types
+ result = (A & B) ==> result = constant for integer types
+ result = (A | B) ==> result = constant for integer types
+ result = (A ^ B) ==> result = constant for integer types
+
+ result = input + A + B + C + D ==> result = input + (A+B+C+D)
+ result = input - A - B - C - D ==> result = input - (A+B+C+D)
+ result = input * A * B * C * D ==> result = input * (A*B*C*D)
+ result = input + A * B * C * D ==> result = input + (A*B*C*D)
+ result = ((((input/A) /B) /C) /D) ==> result = input / (A*B*C*D)
+ result = input + (((A /B) /C) /D) ==> result = input + (A/B/C/D)
+ result = input & A & B & C & D ==> result = input & (A&B&C&D) for integer types
+ result = input | A | B | C | D ==> result = input | (A|B|C|D) for integer types
+ result = input ^ A ^ B ^ C ^ D ==> result = input ^ (A^B^C^D) for integer types
+
+
+NOTE - in some cases, loop invariant code motion might move the constant calculation out of the inner loop
+ making it appear that the constants were folded
+ But in the constant result cases, we want the compiler to recognize the constant and move it out of the loop
+
+*/
+
+/******************************************************************************/
+
+#include "benchmark_stdint.hpp"
+#include <cstddef>
+#include <cstdio>
+#include <ctime>
+#include <cstdlib>
+#include <cmath>
+#include "benchmark_results.h"
+#include "benchmark_timer.h"
+
+/******************************************************************************/
+
+// this constant may need to be adjusted to give reasonable minimum times
+// For best results, times should be about 1.0 seconds for the minimum test run
+int base_iterations = 5000;
+int iterations = base_iterations;
+
+
+// 8000 items, or between 8k and 64k of data
+// this is intended to remain within the L2 cache of most common CPUs
+const int SIZE = 8000;
+
+
+// initial value for filling our arrays, may be changed from the command line
+double init_value = 1.0;
+
+/******************************************************************************/
+
+// our global arrays of numbers to be operated upon
+
+double dataDouble[SIZE];
+float dataFloat[SIZE];
+
+uint64_t data64unsigned[SIZE];
+int64_t data64[SIZE];
+
+uint32_t data32unsigned[SIZE];
+int32_t data32[SIZE];
+
+uint16_t data16unsigned[SIZE];
+int16_t data16[SIZE];
+
+uint8_t data8unsigned[SIZE];
+int8_t data8[SIZE];
+
+/******************************************************************************/
+
+#include "benchmark_shared_tests.h"
+
+/******************************************************************************/
+
+
+int main(int argc, char** argv) {
+
+ if (argc > 1) base_iterations = atoi(argv[1]);
+ if (argc > 2) init_value = (double) atof(argv[2]);
+
+
+
+// int8_t
+ ::fill(data8, data8+SIZE, int8_t(init_value));
+
+ iterations = base_iterations;
+ test_constant<int8_t, custom_two<int8_t> >(data8,SIZE,"int8_t constant");
+ test_constant<int8_t, custom_add_constants<int8_t> >(data8,SIZE,"int8_t add constants");
+ test_constant<int8_t, custom_sub_constants<int8_t> >(data8,SIZE,"int8_t subtract constants");
+ test_constant<int8_t, custom_multiply_constants<int8_t> >(data8,SIZE,"int8_t multiply constants");
+ test_constant<int8_t, custom_divide_constants<int8_t> >(data8,SIZE,"int8_t divide constants");
+ test_constant<int8_t, custom_mod_constants<int8_t> >(data8,SIZE,"int8_t mod constants");
+ test_constant<int8_t, custom_equal_constants<int8_t> >(data8,SIZE,"int8_t equal constants");
+ test_constant<int8_t, custom_notequal_constants<int8_t> >(data8,SIZE,"int8_t notequal constants");
+ test_constant<int8_t, custom_greaterthan_constants<int8_t> >(data8,SIZE,"int8_t greater than constants");
+ test_constant<int8_t, custom_lessthan_constants<int8_t> >(data8,SIZE,"int8_t less than constants");
+ test_constant<int8_t, custom_greaterthanequal_constants<int8_t> >(data8,SIZE,"int8_t greater than equal constants");
+ test_constant<int8_t, custom_lessthanequal_constants<int8_t> >(data8,SIZE,"int8_t less than equal constants");
+ test_constant<int8_t, custom_and_constants<int8_t> >(data8,SIZE,"int8_t and constants");
+ test_constant<int8_t, custom_or_constants<int8_t> >(data8,SIZE,"int8_t or constants");
+ test_constant<int8_t, custom_xor_constants<int8_t> >(data8,SIZE,"int8_t xor constants");
+
+
+
+ iterations = base_iterations / 10;
+ test_constant<int8_t, custom_constant_add<int8_t> >(data8,SIZE,"int8_t constant add");
+ test_constant<int8_t, custom_multiple_constant_add<int8_t> >(data8,SIZE,"int8_t multiple constant adds");
+
+ test_constant<int8_t, custom_constant_sub<int8_t> >(data8,SIZE,"int8_t constant subtract");
+ test_constant<int8_t, custom_multiple_constant_sub<int8_t> >(data8,SIZE,"int8_t multiple constant subtracts");
+
+ test_constant<int8_t, custom_constant_multiply<int8_t> >(data8,SIZE,"int8_t constant multiply");
+ test_constant<int8_t, custom_multiple_constant_multiply<int8_t> >(data8,SIZE,"int8_t multiple constant multiplies");
+ test_constant<int8_t, custom_multiple_constant_multiply2<int8_t> >(data8,SIZE,"int8_t multiple constant multiply2");
+
+ test_constant<int8_t, custom_constant_divide<int8_t> >(data8,SIZE,"int8_t constant divide");
+ test_constant<int8_t, custom_multiple_constant_divide<int8_t> >(data8,SIZE,"int8_t multiple constant divides");
+ test_constant<int8_t, custom_multiple_constant_divide2<int8_t> >(data8,SIZE,"int8_t multiple constant divide2");
+
+ test_constant<int8_t, custom_multiple_constant_mixed<int8_t> >(data8,SIZE,"int8_t multiple constant mixed");
+
+ test_constant<int8_t, custom_constant_and<int8_t> >(data8,SIZE,"int8_t constant and");
+ test_constant<int8_t, custom_multiple_constant_and<int8_t> >(data8,SIZE,"int8_t multiple constant and");
+
+ test_constant<int8_t, custom_constant_or<int8_t> >(data8,SIZE,"int8_t constant or");
+ test_constant<int8_t, custom_multiple_constant_or<int8_t> >(data8,SIZE,"int8_t multiple constant or");
+
+ test_constant<int8_t, custom_constant_xor<int8_t> >(data8,SIZE,"int8_t constant xor");
+ test_constant<int8_t, custom_multiple_constant_xor<int8_t> >(data8,SIZE,"int8_t multiple constant xor");
+
+
+
+// unsigned8
+ ::fill(data8unsigned, data8unsigned+SIZE, uint8_t(init_value));
+
+ iterations = base_iterations;
+ test_constant<uint8_t, custom_two<uint8_t> >(data8unsigned,SIZE,"uint8_t constant");
+ test_constant<uint8_t, custom_add_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t add constants");
+ test_constant<uint8_t, custom_sub_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t subtract constants");
+ test_constant<uint8_t, custom_multiply_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t multiply constants");
+ test_constant<uint8_t, custom_divide_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t divide constants");
+ test_constant<uint8_t, custom_mod_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t mod constants");
+ test_constant<uint8_t, custom_equal_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t equal constants");
+ test_constant<uint8_t, custom_notequal_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t notequal constants");
+ test_constant<uint8_t, custom_greaterthan_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t greater than constants");
+ test_constant<uint8_t, custom_lessthan_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t less than constants");
+ test_constant<uint8_t, custom_greaterthanequal_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t greater than equal constants");
+ test_constant<uint8_t, custom_lessthanequal_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t less than equal constants");
+ test_constant<uint8_t, custom_and_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t and constants");
+ test_constant<uint8_t, custom_or_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t or constants");
+ test_constant<uint8_t, custom_xor_constants<uint8_t> >(data8unsigned,SIZE,"uint8_t xor constants");
+
+
+ iterations = base_iterations / 10;
+ test_constant<uint8_t, custom_constant_add<uint8_t> >(data8unsigned,SIZE,"uint8_t constant add");
+ test_constant<uint8_t, custom_multiple_constant_add<uint8_t> >(data8unsigned,SIZE,"uint8_t multiple constant adds");
+
+ test_constant<uint8_t, custom_constant_sub<uint8_t> >(data8unsigned,SIZE,"uint8_t constant subtract");
+ test_constant<uint8_t, custom_multiple_constant_sub<uint8_t> >(data8unsigned,SIZE,"uint8_t multiple constant subtracts");
+
+ test_constant<uint8_t, custom_constant_multiply<uint8_t> >(data8unsigned,SIZE,"uint8_t constant multiply");
+ test_constant<uint8_t, custom_multiple_constant_multiply<uint8_t> >(data8unsigned,SIZE,"uint8_t multiple constant multiplies");
+ test_constant<uint8_t, custom_multiple_constant_multiply2<uint8_t> >(data8unsigned,SIZE,"uint8_t multiple constant multiply2");
+
+ test_constant<uint8_t, custom_constant_divide<uint8_t> >(data8unsigned,SIZE,"uint8_t constant divide");
+ test_constant<uint8_t, custom_multiple_constant_divide<uint8_t> >(data8unsigned,SIZE,"uint8_t multiple constant divides");
+ test_constant<uint8_t, custom_multiple_constant_divide2<uint8_t> >(data8unsigned,SIZE,"uint8_t multiple constant divide2");
+
+ test_constant<uint8_t, custom_multiple_constant_mixed<uint8_t> >(data8unsigned,SIZE,"uint8_t multiple constant mixed");
+
+ test_constant<uint8_t, custom_constant_and<uint8_t> >(data8unsigned,SIZE,"uint8_t constant and");
+ test_constant<uint8_t, custom_multiple_constant_and<uint8_t> >(data8unsigned,SIZE,"uint8_t multiple constant and");
+
+ test_constant<uint8_t, custom_constant_or<uint8_t> >(data8unsigned,SIZE,"uint8_t constant or");
+ test_constant<uint8_t, custom_multiple_constant_or<uint8_t> >(data8unsigned,SIZE,"uint8_t multiple constant or");
+
+ test_constant<uint8_t, custom_constant_xor<uint8_t> >(data8unsigned,SIZE,"uint8_t constant xor");
+ test_constant<uint8_t, custom_multiple_constant_xor<uint8_t> >(data8unsigned,SIZE,"uint8_t multiple constant xor");
+
+
+// int16_t
+ ::fill(data16, data16+SIZE, int16_t(init_value));
+
+ iterations = base_iterations;
+ test_constant<int16_t, custom_two<int16_t> >(data16,SIZE,"int16_t constant");
+ test_constant<int16_t, custom_add_constants<int16_t> >(data16,SIZE,"int16_t add constants");
+ test_constant<int16_t, custom_sub_constants<int16_t> >(data16,SIZE,"int16_t subtract constants");
+ test_constant<int16_t, custom_multiply_constants<int16_t> >(data16,SIZE,"int16_t multiply constants");
+ test_constant<int16_t, custom_divide_constants<int16_t> >(data16,SIZE,"int16_t divide constants");
+ test_constant<int16_t, custom_mod_constants<int16_t> >(data16,SIZE,"int16_t mod constants");
+ test_constant<int16_t, custom_equal_constants<int16_t> >(data16,SIZE,"int16_t equal constants");
+ test_constant<int16_t, custom_notequal_constants<int16_t> >(data16,SIZE,"int16_t notequal constants");
+ test_constant<int16_t, custom_greaterthan_constants<int16_t> >(data16,SIZE,"int16_t greater than constants");
+ test_constant<int16_t, custom_lessthan_constants<int16_t> >(data16,SIZE,"int16_t less than constants");
+ test_constant<int16_t, custom_greaterthanequal_constants<int16_t> >(data16,SIZE,"int16_t greater than equal constants");
+ test_constant<int16_t, custom_lessthanequal_constants<int16_t> >(data16,SIZE,"int16_t less than equal constants");
+ test_constant<int16_t, custom_and_constants<int16_t> >(data16,SIZE,"int16_t and constants");
+ test_constant<int16_t, custom_or_constants<int16_t> >(data16,SIZE,"int16_t or constants");
+ test_constant<int16_t, custom_xor_constants<int16_t> >(data16,SIZE,"int16_t xor constants");
+
+
+ iterations = base_iterations / 10;
+ test_constant<int16_t, custom_constant_add<int16_t> >(data16,SIZE,"int16_t constant add");
+ test_constant<int16_t, custom_multiple_constant_add<int16_t> >(data16,SIZE,"int16_t multiple constant adds");
+
+ test_constant<int16_t, custom_constant_sub<int16_t> >(data16,SIZE,"int16_t constant subtract");
+ test_constant<int16_t, custom_multiple_constant_sub<int16_t> >(data16,SIZE,"int16_t multiple constant subtracts");
+
+ test_constant<int16_t, custom_constant_multiply<int16_t> >(data16,SIZE,"int16_t constant multiply");
+ test_constant<int16_t, custom_multiple_constant_multiply<int16_t> >(data16,SIZE,"int16_t multiple constant multiplies");
+ test_constant<int16_t, custom_multiple_constant_multiply2<int16_t> >(data16,SIZE,"int16_t multiple constant multiply2");
+
+ test_constant<int16_t, custom_constant_divide<int16_t> >(data16,SIZE,"int16_t constant divide");
+ test_constant<int16_t, custom_multiple_constant_divide<int16_t> >(data16,SIZE,"int16_t multiple constant divides");
+ test_constant<int16_t, custom_multiple_constant_divide2<int16_t> >(data16,SIZE,"int16_t multiple constant divide2");
+
+ test_constant<int16_t, custom_multiple_constant_mixed<int16_t> >(data16,SIZE,"int16_t multiple constant mixed");
+
+ test_constant<int16_t, custom_constant_and<int16_t> >(data16,SIZE,"int16_t constant and");
+ test_constant<int16_t, custom_multiple_constant_and<int16_t> >(data16,SIZE,"int16_t multiple constant and");
+
+ test_constant<int16_t, custom_constant_or<int16_t> >(data16,SIZE,"int16_t constant or");
+ test_constant<int16_t, custom_multiple_constant_or<int16_t> >(data16,SIZE,"int16_t multiple constant or");
+
+ test_constant<int16_t, custom_constant_xor<int16_t> >(data16,SIZE,"int16_t constant xor");
+ test_constant<int16_t, custom_multiple_constant_xor<int16_t> >(data16,SIZE,"int16_t multiple constant xor");
+
+
+// unsigned16
+ ::fill(data16unsigned, data16unsigned+SIZE, uint16_t(init_value));
+
+ iterations = base_iterations;
+ test_constant<uint16_t, custom_two<uint16_t> >(data16unsigned,SIZE,"uint16_t constant");
+ test_constant<uint16_t, custom_add_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t add constants");
+ test_constant<uint16_t, custom_sub_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t subtract constants");
+ test_constant<uint16_t, custom_multiply_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t multiply constants");
+ test_constant<uint16_t, custom_divide_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t divide constants");
+ test_constant<uint16_t, custom_mod_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t mod constants");
+ test_constant<uint16_t, custom_equal_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t equal constants");
+ test_constant<uint16_t, custom_notequal_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t notequal constants");
+ test_constant<uint16_t, custom_greaterthan_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t greater than constants");
+ test_constant<uint16_t, custom_lessthan_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t less than constants");
+ test_constant<uint16_t, custom_greaterthanequal_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t greater than equal constants");
+ test_constant<uint16_t, custom_lessthanequal_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t less than equal constants");
+ test_constant<uint16_t, custom_and_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t and constants");
+ test_constant<uint16_t, custom_or_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t or constants");
+ test_constant<uint16_t, custom_xor_constants<uint16_t> >(data16unsigned,SIZE,"uint16_t xor constants");
+
+
+ iterations = base_iterations / 10;
+ test_constant<uint16_t, custom_constant_add<uint16_t> >(data16unsigned,SIZE,"uint16_t constant add");
+ test_constant<uint16_t, custom_multiple_constant_add<uint16_t> >(data16unsigned,SIZE,"uint16_t multiple constant adds");
+
+ test_constant<uint16_t, custom_constant_sub<uint16_t> >(data16unsigned,SIZE,"uint16_t constant subtract");
+ test_constant<uint16_t, custom_multiple_constant_sub<uint16_t> >(data16unsigned,SIZE,"uint16_t multiple constant subtracts");
+
+ test_constant<uint16_t, custom_constant_multiply<uint16_t> >(data16unsigned,SIZE,"uint16_t constant multiply");
+ test_constant<uint16_t, custom_multiple_constant_multiply<uint16_t> >(data16unsigned,SIZE,"uint16_t multiple constant multiplies");
+ test_constant<uint16_t, custom_multiple_constant_multiply2<uint16_t> >(data16unsigned,SIZE,"uint16_t multiple constant multiply2");
+
+ test_constant<uint16_t, custom_constant_divide<uint16_t> >(data16unsigned,SIZE,"uint16_t constant divide");
+ test_constant<uint16_t, custom_multiple_constant_divide<uint16_t> >(data16unsigned,SIZE,"uint16_t multiple constant divides");
+ test_constant<uint16_t, custom_multiple_constant_divide2<uint16_t> >(data16unsigned,SIZE,"uint16_t multiple constant divide2");
+
+ test_constant<uint16_t, custom_multiple_constant_mixed<uint16_t> >(data16unsigned,SIZE,"uint16_t multiple constant mixed");
+
+ test_constant<uint16_t, custom_constant_and<uint16_t> >(data16unsigned,SIZE,"uint16_t constant and");
+ test_constant<uint16_t, custom_multiple_constant_and<uint16_t> >(data16unsigned,SIZE,"uint16_t multiple constant and");
+
+ test_constant<uint16_t, custom_constant_or<uint16_t> >(data16unsigned,SIZE,"uint16_t constant or");
+ test_constant<uint16_t, custom_multiple_constant_or<uint16_t> >(data16unsigned,SIZE,"uint16_t multiple constant or");
+
+ test_constant<uint16_t, custom_constant_xor<uint16_t> >(data16unsigned,SIZE,"uint16_t constant xor");
+ test_constant<uint16_t, custom_multiple_constant_xor<uint16_t> >(data16unsigned,SIZE,"uint16_t multiple constant xor");
+
+
+// int32_t
+ ::fill(data32, data32+SIZE, int32_t(init_value));
+
+ iterations = base_iterations;
+ test_constant<int32_t, custom_two<int32_t> >(data32,SIZE,"int32_t constant");
+ test_constant<int32_t, custom_add_constants<int32_t> >(data32,SIZE,"int32_t add constants");
+ test_constant<int32_t, custom_sub_constants<int32_t> >(data32,SIZE,"int32_t subtract constants");
+ test_constant<int32_t, custom_multiply_constants<int32_t> >(data32,SIZE,"int32_t multiply constants");
+ test_constant<int32_t, custom_divide_constants<int32_t> >(data32,SIZE,"int32_t divide constants");
+ test_constant<int32_t, custom_mod_constants<int32_t> >(data32,SIZE,"int32_t mod constants");
+ test_constant<int32_t, custom_equal_constants<int32_t> >(data32,SIZE,"int32_t equal constants");
+ test_constant<int32_t, custom_notequal_constants<int32_t> >(data32,SIZE,"int32_t notequal constants");
+ test_constant<int32_t, custom_greaterthan_constants<int32_t> >(data32,SIZE,"int32_t greater than constants");
+ test_constant<int32_t, custom_lessthan_constants<int32_t> >(data32,SIZE,"int32_t less than constants");
+ test_constant<int32_t, custom_greaterthanequal_constants<int32_t> >(data32,SIZE,"int32_t greater than equal constants");
+ test_constant<int32_t, custom_lessthanequal_constants<int32_t> >(data32,SIZE,"int32_t less than equal constants");
+ test_constant<int32_t, custom_and_constants<int32_t> >(data32,SIZE,"int32_t and constants");
+ test_constant<int32_t, custom_or_constants<int32_t> >(data32,SIZE,"int32_t or constants");
+ test_constant<int32_t, custom_xor_constants<int32_t> >(data32,SIZE,"int32_t xor constants");
+
+
+ iterations = base_iterations / 10;
+ test_constant<int32_t, custom_constant_add<int32_t> >(data32,SIZE,"int32_t constant add");
+ test_constant<int32_t, custom_multiple_constant_add<int32_t> >(data32,SIZE,"int32_t multiple constant adds");
+
+ test_constant<int32_t, custom_constant_sub<int32_t> >(data32,SIZE,"int32_t constant subtract");
+ test_constant<int32_t, custom_multiple_constant_sub<int32_t> >(data32,SIZE,"int32_t multiple constant subtracts");
+
+ test_constant<int32_t, custom_constant_multiply<int32_t> >(data32,SIZE,"int32_t constant multiply");
+ test_constant<int32_t, custom_multiple_constant_multiply<int32_t> >(data32,SIZE,"int32_t multiple constant multiplies");
+ test_constant<int32_t, custom_multiple_constant_multiply2<int32_t> >(data32,SIZE,"int32_t multiple constant multiply2");
+
+ test_constant<int32_t, custom_constant_divide<int32_t> >(data32,SIZE,"int32_t constant divide");
+ test_constant<int32_t, custom_multiple_constant_divide<int32_t> >(data32,SIZE,"int32_t multiple constant divides");
+ test_constant<int32_t, custom_multiple_constant_divide2<int32_t> >(data32,SIZE,"int32_t multiple constant divide2");
+
+ test_constant<int32_t, custom_multiple_constant_mixed<int32_t> >(data32,SIZE,"int32_t multiple constant mixed");
+
+ test_constant<int32_t, custom_constant_and<int32_t> >(data32,SIZE,"int32_t constant and");
+ test_constant<int32_t, custom_multiple_constant_and<int32_t> >(data32,SIZE,"int32_t multiple constant and");
+
+ test_constant<int32_t, custom_constant_or<int32_t> >(data32,SIZE,"int32_t constant or");
+ test_constant<int32_t, custom_multiple_constant_or<int32_t> >(data32,SIZE,"int32_t multiple constant or");
+
+ test_constant<int32_t, custom_constant_xor<int32_t> >(data32,SIZE,"int32_t constant xor");
+ test_constant<int32_t, custom_multiple_constant_xor<int32_t> >(data32,SIZE,"int32_t multiple constant xor");
+
+
+
+// unsigned32
+ ::fill(data32unsigned, data32unsigned+SIZE, uint32_t(init_value));
+
+ iterations = base_iterations;
+ test_constant<uint32_t, custom_two<uint32_t> >(data32unsigned,SIZE,"uint32_t constant");
+ test_constant<uint32_t, custom_add_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t add constants");
+ test_constant<uint32_t, custom_sub_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t subtract constants");
+ test_constant<uint32_t, custom_multiply_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t multiply constants");
+ test_constant<uint32_t, custom_divide_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t divide constants");
+ test_constant<uint32_t, custom_mod_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t mod constants");
+ test_constant<uint32_t, custom_equal_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t equal constants");
+ test_constant<uint32_t, custom_notequal_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t notequal constants");
+ test_constant<uint32_t, custom_greaterthan_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t greater than constants");
+ test_constant<uint32_t, custom_lessthan_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t less than constants");
+ test_constant<uint32_t, custom_greaterthanequal_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t greater than equal constants");
+ test_constant<uint32_t, custom_lessthanequal_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t less than equal constants");
+ test_constant<uint32_t, custom_and_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t and constants");
+ test_constant<uint32_t, custom_or_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t or constants");
+ test_constant<uint32_t, custom_xor_constants<uint32_t> >(data32unsigned,SIZE,"uint32_t xor constants");
+
+
+
+ iterations = base_iterations / 10;
+ test_constant<uint32_t, custom_constant_add<uint32_t> >(data32unsigned,SIZE,"uint32_t constant add");
+ test_constant<uint32_t, custom_multiple_constant_add<uint32_t> >(data32unsigned,SIZE,"uint32_t multiple constant adds");
+
+ test_constant<uint32_t, custom_constant_sub<uint32_t> >(data32unsigned,SIZE,"uint32_t constant subtract");
+ test_constant<uint32_t, custom_multiple_constant_sub<uint32_t> >(data32unsigned,SIZE,"uint32_t multiple constant subtracts");
+
+ test_constant<uint32_t, custom_constant_multiply<uint32_t> >(data32unsigned,SIZE,"uint32_t constant multiply");
+ test_constant<uint32_t, custom_multiple_constant_multiply<uint32_t> >(data32unsigned,SIZE,"uint32_t multiple constant multiplies");
+ test_constant<uint32_t, custom_multiple_constant_multiply2<uint32_t> >(data32unsigned,SIZE,"uint32_t multiple constant multiply2");
+
+ test_constant<uint32_t, custom_constant_divide<uint32_t> >(data32unsigned,SIZE,"uint32_t constant divide");
+ test_constant<uint32_t, custom_multiple_constant_divide<uint32_t> >(data32unsigned,SIZE,"uint32_t multiple constant divides");
+ test_constant<uint32_t, custom_multiple_constant_divide2<uint32_t> >(data32unsigned,SIZE,"uint32_t multiple constant divide2");
+
+ test_constant<uint32_t, custom_multiple_constant_mixed<uint32_t> >(data32unsigned,SIZE,"uint32_t multiple constant mixed");
+
+ test_constant<uint32_t, custom_constant_and<uint32_t> >(data32unsigned,SIZE,"uint32_t constant and");
+ test_constant<uint32_t, custom_multiple_constant_and<uint32_t> >(data32unsigned,SIZE,"uint32_t multiple constant and");
+
+ test_constant<uint32_t, custom_constant_or<uint32_t> >(data32unsigned,SIZE,"uint32_t constant or");
+ test_constant<uint32_t, custom_multiple_constant_or<uint32_t> >(data32unsigned,SIZE,"uint32_t multiple constant or");
+
+ test_constant<uint32_t, custom_constant_xor<uint32_t> >(data32unsigned,SIZE,"uint32_t constant xor");
+ test_constant<uint32_t, custom_multiple_constant_xor<uint32_t> >(data32unsigned,SIZE,"uint32_t multiple constant xor");
+
+
+
+// int64_t
+ ::fill(data64, data64+SIZE, int64_t(init_value));
+
+ iterations = base_iterations;
+ test_constant<int64_t, custom_two<int64_t> >(data64,SIZE,"int64_t constant");
+ test_constant<int64_t, custom_add_constants<int64_t> >(data64,SIZE,"int64_t add constants");
+ test_constant<int64_t, custom_sub_constants<int64_t> >(data64,SIZE,"int64_t subtract constants");
+ test_constant<int64_t, custom_multiply_constants<int64_t> >(data64,SIZE,"int64_t multiply constants");
+ test_constant<int64_t, custom_divide_constants<int64_t> >(data64,SIZE,"int64_t divide constants");
+ test_constant<int64_t, custom_mod_constants<int64_t> >(data64,SIZE,"int64_t mod constants");
+ test_constant<int64_t, custom_equal_constants<int64_t> >(data64,SIZE,"int64_t equal constants");
+ test_constant<int64_t, custom_notequal_constants<int64_t> >(data64,SIZE,"int64_t notequal constants");
+ test_constant<int64_t, custom_greaterthan_constants<int64_t> >(data64,SIZE,"int64_t greater than constants");
+ test_constant<int64_t, custom_lessthan_constants<int64_t> >(data64,SIZE,"int64_t less than constants");
+ test_constant<int64_t, custom_greaterthanequal_constants<int64_t> >(data64,SIZE,"int64_t greater than equal constants");
+ test_constant<int64_t, custom_lessthanequal_constants<int64_t> >(data64,SIZE,"int64_t less than equal constants");
+ test_constant<int64_t, custom_and_constants<int64_t> >(data64,SIZE,"int64_t and constants");
+ test_constant<int64_t, custom_or_constants<int64_t> >(data64,SIZE,"int64_t or constants");
+ test_constant<int64_t, custom_xor_constants<int64_t> >(data64,SIZE,"int64_t xor constants");
+
+
+ iterations = base_iterations / 10;
+ test_constant<int64_t, custom_constant_add<int64_t> >(data64,SIZE,"int64_t constant add");
+ test_constant<int64_t, custom_multiple_constant_add<int64_t> >(data64,SIZE,"int64_t multiple constant adds");
+
+ test_constant<int64_t, custom_constant_sub<int64_t> >(data64,SIZE,"int64_t constant subtract");
+ test_constant<int64_t, custom_multiple_constant_sub<int64_t> >(data64,SIZE,"int64_t multiple constant subtracts");
+
+ test_constant<int64_t, custom_constant_multiply<int64_t> >(data64,SIZE,"int64_t constant multiply");
+ test_constant<int64_t, custom_multiple_constant_multiply<int64_t> >(data64,SIZE,"int64_t multiple constant multiplies");
+ test_constant<int64_t, custom_multiple_constant_multiply2<int64_t> >(data64,SIZE,"int64_t multiple constant multiply2");
+
+ test_constant<int64_t, custom_constant_divide<int64_t> >(data64,SIZE,"int64_t constant divide");
+ test_constant<int64_t, custom_multiple_constant_divide<int64_t> >(data64,SIZE,"int64_t multiple constant divides");
+ test_constant<int64_t, custom_multiple_constant_divide2<int64_t> >(data64,SIZE,"int64_t multiple constant divide2");
+
+ test_constant<int64_t, custom_multiple_constant_mixed<int64_t> >(data64,SIZE,"int64_t multiple constant mixed");
+
+ test_constant<int64_t, custom_constant_and<int64_t> >(data64,SIZE,"int64_t constant and");
+ test_constant<int64_t, custom_multiple_constant_and<int64_t> >(data64,SIZE,"int64_t multiple constant and");
+
+ test_constant<int64_t, custom_constant_or<int64_t> >(data64,SIZE,"int64_t constant or");
+ test_constant<int64_t, custom_multiple_constant_or<int64_t> >(data64,SIZE,"int64_t multiple constant or");
+
+ test_constant<int64_t, custom_constant_xor<int64_t> >(data64,SIZE,"int64_t constant xor");
+ test_constant<int64_t, custom_multiple_constant_xor<int64_t> >(data64,SIZE,"int64_t multiple constant xor");
+
+
+// unsigned64
+ ::fill(data64unsigned, data64unsigned+SIZE, uint64_t(init_value));
+
+ iterations = base_iterations;
+ test_constant<uint64_t, custom_two<uint64_t> >(data64unsigned,SIZE,"uint64_t constant");
+ test_constant<uint64_t, custom_add_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t add constants");
+ test_constant<uint64_t, custom_sub_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t subtract constants");
+ test_constant<uint64_t, custom_multiply_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t multiply constants");
+ test_constant<uint64_t, custom_divide_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t divide constants");
+ test_constant<uint64_t, custom_mod_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t mod constants");
+ test_constant<uint64_t, custom_equal_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t equal constants");
+ test_constant<uint64_t, custom_notequal_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t notequal constants");
+ test_constant<uint64_t, custom_greaterthan_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t greater than constants");
+ test_constant<uint64_t, custom_lessthan_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t less than constants");
+ test_constant<uint64_t, custom_greaterthanequal_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t greater than equal constants");
+ test_constant<uint64_t, custom_lessthanequal_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t less than equal constants");
+ test_constant<uint64_t, custom_and_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t and constants");
+ test_constant<uint64_t, custom_or_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t or constants");
+ test_constant<uint64_t, custom_xor_constants<uint64_t> >(data64unsigned,SIZE,"uint64_t xor constants");
+
+
+
+ iterations = base_iterations / 10;
+ test_constant<uint64_t, custom_constant_add<uint64_t> >(data64unsigned,SIZE,"uint64_t constant add");
+ test_constant<uint64_t, custom_multiple_constant_add<uint64_t> >(data64unsigned,SIZE,"uint64_t multiple constant adds");
+
+ test_constant<uint64_t, custom_constant_sub<uint64_t> >(data64unsigned,SIZE,"uint64_t constant subtract");
+ test_constant<uint64_t, custom_multiple_constant_sub<uint64_t> >(data64unsigned,SIZE,"uint64_t multiple constant subtracts");
+
+ test_constant<uint64_t, custom_constant_multiply<uint64_t> >(data64unsigned,SIZE,"uint64_t constant multiply");
+ test_constant<uint64_t, custom_multiple_constant_multiply<uint64_t> >(data64unsigned,SIZE,"uint64_t multiple constant multiplies");
+ test_constant<uint64_t, custom_multiple_constant_multiply2<uint64_t> >(data64unsigned,SIZE,"uint64_t multiple constant multiply2");
+
+ test_constant<uint64_t, custom_constant_divide<uint64_t> >(data64unsigned,SIZE,"uint64_t constant divide");
+ test_constant<uint64_t, custom_multiple_constant_divide<uint64_t> >(data64unsigned,SIZE,"uint64_t multiple constant divides");
+ test_constant<uint64_t, custom_multiple_constant_divide2<uint64_t> >(data64unsigned,SIZE,"uint64_t multiple constant divide2");
+
+ test_constant<uint64_t, custom_multiple_constant_mixed<uint64_t> >(data64unsigned,SIZE,"uint64_t multiple constant mixed");
+
+ test_constant<uint64_t, custom_constant_and<uint64_t> >(data64unsigned,SIZE,"uint64_t constant and");
+ test_constant<uint64_t, custom_multiple_constant_and<uint64_t> >(data64unsigned,SIZE,"uint64_t multiple constant and");
+
+ test_constant<uint64_t, custom_constant_or<uint64_t> >(data64unsigned,SIZE,"uint64_t constant or");
+ test_constant<uint64_t, custom_multiple_constant_or<uint64_t> >(data64unsigned,SIZE,"uint64_t multiple constant or");
+
+ test_constant<uint64_t, custom_constant_xor<uint64_t> >(data64unsigned,SIZE,"uint64_t constant xor");
+ test_constant<uint64_t, custom_multiple_constant_xor<uint64_t> >(data64unsigned,SIZE,"uint64_t multiple constant xor");
+
+
+
+// float
+ ::fill(dataFloat, dataFloat+SIZE, float(init_value));
+
+ iterations = base_iterations;
+ test_constant<float, custom_two<float> >(dataFloat,SIZE,"float constant");
+ test_constant<float, custom_add_constants<float> >(dataFloat,SIZE,"float add constants");
+ test_constant<float, custom_sub_constants<float> >(dataFloat,SIZE,"float subtract constants");
+ test_constant<float, custom_multiply_constants<float> >(dataFloat,SIZE,"float multiply constants");
+ test_constant<float, custom_divide_constants<float> >(dataFloat,SIZE,"float divide constants");
+
+
+ iterations = base_iterations / 10;
+ test_constant<float, custom_constant_add<float> >(dataFloat,SIZE,"float constant add");
+ test_constant<float, custom_multiple_constant_add<float> >(dataFloat,SIZE,"float multiple constant adds");
+
+ test_constant<float, custom_constant_sub<float> >(dataFloat,SIZE,"float constant subtract");
+ test_constant<float, custom_multiple_constant_sub<float> >(dataFloat,SIZE,"float multiple constant subtracts");
+
+ test_constant<float, custom_constant_multiply<float> >(dataFloat,SIZE,"float constant multiply");
+ test_constant<float, custom_multiple_constant_multiply<float> >(dataFloat,SIZE,"float multiple constant multiplies");
+ test_constant<float, custom_multiple_constant_multiply2<float> >(dataFloat,SIZE,"float multiple constant multiply2");
+
+ test_constant<float, custom_constant_divide<float> >(dataFloat,SIZE,"float constant divide");
+ test_constant<float, custom_multiple_constant_divide<float> >(dataFloat,SIZE,"float multiple constant divides");
+ test_constant<float, custom_multiple_constant_divide2<float> >(dataFloat,SIZE,"float multiple constant divide2");
+
+ test_constant<float, custom_multiple_constant_mixed<float> >(dataFloat,SIZE,"float multiple constant mixed");
+
+
+// double
+ ::fill(dataDouble, dataDouble+SIZE, double(init_value));
+
+ iterations = base_iterations;
+ test_constant<double, custom_two<double> >(dataDouble,SIZE,"double constant");
+ test_constant<double, custom_add_constants<double> >(dataDouble,SIZE,"double add constants");
+ test_constant<double, custom_sub_constants<double> >(dataDouble,SIZE,"double subtract constants");
+ test_constant<double, custom_multiply_constants<double> >(dataDouble,SIZE,"double multiply constants");
+ test_constant<double, custom_divide_constants<double> >(dataDouble,SIZE,"double divide constants");
+
+
+ iterations = base_iterations / 10;
+ test_constant<double, custom_constant_add<double> >(dataDouble,SIZE,"double constant add");
+ test_constant<double, custom_multiple_constant_add<double> >(dataDouble,SIZE,"double multiple constant adds");
+
+ test_constant<double, custom_constant_sub<double> >(dataDouble,SIZE,"double constant subtract");
+ test_constant<double, custom_multiple_constant_sub<double> >(dataDouble,SIZE,"double multiple constant subtracts");
+
+ test_constant<double, custom_constant_multiply<double> >(dataDouble,SIZE,"double constant multiply");
+ test_constant<double, custom_multiple_constant_multiply<double> >(dataDouble,SIZE,"double multiple constant multiplies");
+ test_constant<double, custom_multiple_constant_multiply2<double> >(dataDouble,SIZE,"double multiple constant multiply2");
+
+ test_constant<double, custom_constant_divide<double> >(dataDouble,SIZE,"double constant divide");
+ test_constant<double, custom_multiple_constant_divide<double> >(dataDouble,SIZE,"double multiple constant divides");
+ test_constant<double, custom_multiple_constant_divide2<double> >(dataDouble,SIZE,"double multiple constant divide2");
+
+ test_constant<double, custom_multiple_constant_mixed<double> >(dataDouble,SIZE,"double multiple constant mixed");
+
+
+ return 0;
+}
+
+// the end
+/******************************************************************************/
+/******************************************************************************/
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/simple_types_constant_folding.cpp
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/simple_types_loop_invariant.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/simple_types_loop_invariant.cpp?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/simple_types_loop_invariant.cpp (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/simple_types_loop_invariant.cpp Sun Jan 11 21:04:59 2009
@@ -0,0 +1,451 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html )
+
+
+Goal: Test compiler optimizations related to simple language defined types
+
+Assumptions:
+
+ 1) the compiler will move loop invariant calculations on simple types out of a loop
+ aka: loop invariant code motion
+
+ for (i = 0; i < N; ++i) temp = A + B + C + D;
+ result = input[i] + A+B+C+D; ==> for (i = 0; i < N; ++i)
+ result = input[i] + temp;
+
+*/
+
+/******************************************************************************/
+
+#include "benchmark_stdint.hpp"
+#include <cstddef>
+#include <cstdio>
+#include <ctime>
+#include <cstdlib>
+#include <cmath>
+#include "benchmark_results.h"
+#include "benchmark_timer.h"
+
+/******************************************************************************/
+
+// this constant may need to be adjusted to give reasonable minimum times
+// For best results, times should be about 1.0 seconds for the minimum test run
+int iterations = 1000;
+
+
+// 8000 items, or between 8k and 64k of data
+// this is intended to remain within the L2 cache of most common CPUs
+const int SIZE = 8000;
+
+
+// initial value for filling our arrays, may be changed from the command line
+double init_value = 1.0;
+
+/******************************************************************************/
+
+// our global arrays of numbers to be operated upon
+
+double dataDouble[SIZE];
+float dataFloat[SIZE];
+
+uint64_t data64unsigned[SIZE];
+int64_t data64[SIZE];
+
+uint32_t data32unsigned[SIZE];
+int32_t data32[SIZE];
+
+uint16_t data16unsigned[SIZE];
+int16_t data16[SIZE];
+
+uint8_t data8unsigned[SIZE];
+int8_t data8[SIZE];
+
+/******************************************************************************/
+
+#include "benchmark_shared_tests.h"
+
+/******************************************************************************/
+
+// v1 is constant in the function, so we can move the addition or subtraction of it outside the loop entirely
+// converting it to a multiply and a summation of the input array
+// Note that this is always legal for integers
+// it can only be applied to floating point if using inexact math (relaxed IEEE rules)
+template <typename T, typename Shifter>
+void test_hoisted_variable1(T* first, int count, T v1, const char *label) {
+ int i;
+
+ start_timer();
+
+ for(i = 0; i < iterations; ++i) {
+ T result = 0;
+ for (int n = 0; n < count; ++n) {
+ result += first[n];
+ }
+ result += count * v1;
+ check_shifted_variable_sum<T, Shifter>(result, v1);
+ }
+
+ record_result( timer(), label );
+}
+
+/******************************************************************************/
+
+
+int main(int argc, char** argv) {
+ double temp = 1.0;
+
+ if (argc > 1) iterations = atoi(argv[1]);
+ if (argc > 2) init_value = (double) atof(argv[2]);
+ if (argc > 3) temp = (double)atof(argv[3]);
+
+
+// int8_t
+ ::fill(data8, data8+SIZE, int8_t(init_value));
+ int8_t var1int8_1, var1int8_2, var1int8_3, var1int8_4;
+ var1int8_1 = int8_t(temp);
+ var1int8_2 = var1int8_1 * int8_t(2);
+ var1int8_3 = var1int8_1 + int8_t(2);
+ var1int8_4 = var1int8_1 + var1int8_2 / var1int8_3;
+
+ // test moving redundant calcs out of loop
+ test_variable1< int8_t, custom_add_variable<int8_t> > (data8, SIZE, var1int8_1, "int8_t variable add");
+ test_hoisted_variable1< int8_t, custom_add_variable<int8_t> > (data8, SIZE, var1int8_1, "int8_t variable add hoisted");
+ test_variable4< int8_t, custom_add_multiple_variable<int8_t> > (data8, SIZE, var1int8_1, var1int8_2, var1int8_3, var1int8_4, "int8_t multiple variable adds");
+
+ test_variable1< int8_t, custom_sub_variable<int8_t> > (data8, SIZE, var1int8_1, "int8_t variable subtract");
+ test_variable4< int8_t, custom_sub_multiple_variable<int8_t> > (data8, SIZE, var1int8_1, var1int8_2, var1int8_3, var1int8_4, "int8_t multiple variable subtracts");
+
+ test_variable1< int8_t, custom_multiply_variable<int8_t> > (data8, SIZE, var1int8_1, "int8_t variable multiply");
+ test_variable4< int8_t, custom_multiply_multiple_variable<int8_t> > (data8, SIZE, var1int8_1, var1int8_2, var1int8_3, var1int8_4, "int8_t multiple variable multiplies");
+ test_variable4< int8_t, custom_multiply_multiple_variable2<int8_t> > (data8, SIZE, var1int8_1, var1int8_2, var1int8_3, var1int8_4, "int8_t multiple variable multiplies2");
+
+ test_variable1< int8_t, custom_divide_variable<int8_t> > (data8, SIZE, var1int8_1, "int8_t variable divide");
+ test_variable4< int8_t, custom_divide_multiple_variable<int8_t> > (data8, SIZE, var1int8_1, var1int8_2, var1int8_3, var1int8_4, "int8_t multiple variable divides");
+ test_variable4< int8_t, custom_divide_multiple_variable2<int8_t> > (data8, SIZE, var1int8_1, var1int8_2, var1int8_3, var1int8_4, "int8_t multiple variable divides2");
+
+ test_variable4< int8_t, custom_mixed_multiple_variable<int8_t> > (data8, SIZE, var1int8_1, var1int8_2, var1int8_3, var1int8_4, "int8_t multiple variable mixed");
+
+ test_variable1< int8_t, custom_variable_and<int8_t> > (data8, SIZE, var1int8_1, "int8_t variable and");
+ test_variable4< int8_t, custom_multiple_variable_and<int8_t> > (data8, SIZE, var1int8_1, var1int8_2, var1int8_3, var1int8_4, "int8_t multiple variable and");
+
+ test_variable1< int8_t, custom_variable_or<int8_t> > (data8, SIZE, var1int8_1, "int8_t variable or");
+ test_variable4< int8_t, custom_multiple_variable_or<int8_t> > (data8, SIZE, var1int8_1, var1int8_2, var1int8_3, var1int8_4, "int8_t multiple variable or");
+
+ test_variable1< int8_t, custom_variable_xor<int8_t> > (data8, SIZE, var1int8_1, "int8_t variable xor");
+ test_variable4< int8_t, custom_multiple_variable_xor<int8_t> > (data8, SIZE, var1int8_1, var1int8_2, var1int8_3, var1int8_4, "int8_t multiple variable xor");
+
+// unsigned8
+ ::fill(data8unsigned, data8unsigned+SIZE, uint8_t(init_value));
+ uint8_t var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4;
+ var1uint8_1 = uint8_t(temp);
+ var1uint8_2 = var1uint8_1 * uint8_t(2);
+ var1uint8_3 = var1uint8_1 + uint8_t(2);
+ var1uint8_4 = var1uint8_1 + var1uint8_2 / var1uint8_3;
+
+ // test moving redundant calcs out of loop
+ test_variable1< uint8_t, custom_add_variable<uint8_t> > (data8unsigned, SIZE, var1uint8_1, "uint8_t variable add");
+ test_hoisted_variable1< uint8_t, custom_add_variable<uint8_t> > (data8unsigned, SIZE, var1uint8_1, "uint8_t variable add hoisted");
+ test_variable4< uint8_t, custom_add_multiple_variable<uint8_t> > (data8unsigned, SIZE, var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4, "uint8_t multiple variable adds");
+
+ test_variable1< uint8_t, custom_sub_variable<uint8_t> > (data8unsigned, SIZE, var1uint8_1, "uint8_t variable subtract");
+ test_variable4< uint8_t, custom_sub_multiple_variable<uint8_t> > (data8unsigned, SIZE, var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4, "uint8_t multiple variable subtracts");
+
+ test_variable1< uint8_t, custom_multiply_variable<uint8_t> > (data8unsigned, SIZE, var1uint8_1, "uint8_t variable multiply");
+ test_variable4< uint8_t, custom_multiply_multiple_variable<uint8_t> > (data8unsigned, SIZE, var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4, "uint8_t multiple variable multiplies");
+ test_variable4< uint8_t, custom_multiply_multiple_variable2<uint8_t> > (data8unsigned, SIZE, var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4, "uint8_t multiple variable multiplies2");
+
+ test_variable1< uint8_t, custom_divide_variable<uint8_t> > (data8unsigned, SIZE, var1uint8_1, "uint8_t variable divide");
+ test_variable4< uint8_t, custom_divide_multiple_variable<uint8_t> > (data8unsigned, SIZE, var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4, "uint8_t multiple variable divides");
+ test_variable4< uint8_t, custom_divide_multiple_variable2<uint8_t> > (data8unsigned, SIZE, var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4, "uint8_t multiple variable divides2");
+
+ test_variable4< uint8_t, custom_mixed_multiple_variable<uint8_t> > (data8unsigned, SIZE, var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4, "uint8_t multiple variable mixed");
+
+ test_variable1< uint8_t, custom_variable_and<uint8_t> > (data8unsigned, SIZE, var1uint8_1, "uint8_t variable and");
+ test_variable4< uint8_t, custom_multiple_variable_and<uint8_t> > (data8unsigned, SIZE, var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4, "uint8_t multiple variable and");
+
+ test_variable1< uint8_t, custom_variable_or<uint8_t> > (data8unsigned, SIZE, var1uint8_1, "uint8_t variable or");
+ test_variable4< uint8_t, custom_multiple_variable_or<uint8_t> > (data8unsigned, SIZE, var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4, "uint8_t multiple variable or");
+
+ test_variable1< uint8_t, custom_variable_xor<uint8_t> > (data8unsigned, SIZE, var1uint8_1, "uint8_t variable xor");
+ test_variable4< uint8_t, custom_multiple_variable_xor<uint8_t> > (data8unsigned, SIZE, var1uint8_1, var1uint8_2, var1uint8_3, var1uint8_4, "uint8_t multiple variable xor");
+
+
+// int16_t
+ ::fill(data16, data16+SIZE, int16_t(init_value));
+ int16_t var1int16_1, var1int16_2, var1int16_3, var1int16_4;
+ var1int16_1 = int16_t(temp);
+ var1int16_2 = var1int16_1 * int16_t(2);
+ var1int16_3 = var1int16_1 + int16_t(2);
+ var1int16_4 = var1int16_1 + var1int16_2 / var1int16_3;
+
+ // test moving redundant calcs out of loop
+ test_variable1< int16_t, custom_add_variable<int16_t> > (data16, SIZE, var1int16_1, "int16_t variable add");
+ test_hoisted_variable1< int16_t, custom_add_variable<int16_t> > (data16, SIZE, var1int16_1, "int16_t variable add hoisted");
+ test_variable4< int16_t, custom_add_multiple_variable<int16_t> > (data16, SIZE, var1int16_1, var1int16_2, var1int16_3, var1int16_4, "int16_t multiple variable adds");
+
+ test_variable1< int16_t, custom_sub_variable<int16_t> > (data16, SIZE, var1int16_1, "int16_t variable subtract");
+ test_variable4< int16_t, custom_sub_multiple_variable<int16_t> > (data16, SIZE, var1int16_1, var1int16_2, var1int16_3, var1int16_4, "int16_t multiple variable subtracts");
+
+ test_variable1< int16_t, custom_multiply_variable<int16_t> > (data16, SIZE, var1int16_1, "int16_t variable multiply");
+ test_variable4< int16_t, custom_multiply_multiple_variable<int16_t> > (data16, SIZE, var1int16_1, var1int16_2, var1int16_3, var1int16_4, "int16_t multiple variable multiplies");
+ test_variable4< int16_t, custom_multiply_multiple_variable2<int16_t> > (data16, SIZE, var1int16_1, var1int16_2, var1int16_3, var1int16_4, "int16_t multiple variable multiplies2");
+
+ test_variable1< int16_t, custom_divide_variable<int16_t> > (data16, SIZE, var1int16_1, "int16_t variable divide");
+ test_variable4< int16_t, custom_divide_multiple_variable<int16_t> > (data16, SIZE, var1int16_1, var1int16_2, var1int16_3, var1int16_4, "int16_t multiple variable divides");
+ test_variable4< int16_t, custom_divide_multiple_variable2<int16_t> > (data16, SIZE, var1int16_1, var1int16_2, var1int16_3, var1int16_4, "int16_t multiple variable divides2");
+
+ test_variable4< int16_t, custom_mixed_multiple_variable<int16_t> > (data16, SIZE, var1int16_1, var1int16_2, var1int16_3, var1int16_4, "int16_t multiple variable mixed");
+
+ test_variable1< int16_t, custom_variable_and<int16_t> > (data16, SIZE, var1int16_1, "int16_t variable and");
+ test_variable4< int16_t, custom_multiple_variable_and<int16_t> > (data16, SIZE, var1int16_1, var1int16_2, var1int16_3, var1int16_4, "int16_t multiple variable and");
+
+ test_variable1< int16_t, custom_variable_or<int16_t> > (data16, SIZE, var1int16_1, "int16_t variable or");
+ test_variable4< int16_t, custom_multiple_variable_or<int16_t> > (data16, SIZE, var1int16_1, var1int16_2, var1int16_3, var1int16_4, "int16_t multiple variable or");
+
+ test_variable1< int16_t, custom_variable_xor<int16_t> > (data16, SIZE, var1int16_1, "int16_t variable xor");
+ test_variable4< int16_t, custom_multiple_variable_xor<int16_t> > (data16, SIZE, var1int16_1, var1int16_2, var1int16_3, var1int16_4, "int16_t multiple variable xor");
+
+
+// unsigned16
+ ::fill(data16unsigned, data16unsigned+SIZE, uint16_t(init_value));
+ uint16_t var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4;
+ var1uint16_1 = uint16_t(temp);
+ var1uint16_2 = var1uint16_1 * uint16_t(2);
+ var1uint16_3 = var1uint16_1 + uint16_t(2);
+ var1uint16_4 = var1uint16_1 + var1uint16_2 / var1uint16_3;
+
+ // test moving redundant calcs out of loop
+ test_variable1< uint16_t, custom_add_variable<uint16_t> > (data16unsigned, SIZE, var1uint16_1, "uint16_t variable add");
+ test_hoisted_variable1< uint16_t, custom_add_variable<uint16_t> > (data16unsigned, SIZE, var1uint16_1, "uint16_t variable add hoisted");
+ test_variable4< uint16_t, custom_add_multiple_variable<uint16_t> > (data16unsigned, SIZE, var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4, "uint16_t multiple variable adds");
+
+ test_variable1< uint16_t, custom_sub_variable<uint16_t> > (data16unsigned, SIZE, var1uint16_1, "uint16_t variable subtract");
+ test_variable4< uint16_t, custom_sub_multiple_variable<uint16_t> > (data16unsigned, SIZE, var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4, "uint16_t multiple variable subtracts");
+
+ test_variable1< uint16_t, custom_multiply_variable<uint16_t> > (data16unsigned, SIZE, var1uint16_1, "uint16_t variable multiply");
+ test_variable4< uint16_t, custom_multiply_multiple_variable<uint16_t> > (data16unsigned, SIZE, var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4, "uint16_t multiple variable multiplies");
+ test_variable4< uint16_t, custom_multiply_multiple_variable2<uint16_t> > (data16unsigned, SIZE, var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4, "uint16_t multiple variable multiplies2");
+
+ test_variable1< uint16_t, custom_divide_variable<uint16_t> > (data16unsigned, SIZE, var1uint16_1, "uint16_t variable divide");
+ test_variable4< uint16_t, custom_divide_multiple_variable<uint16_t> > (data16unsigned, SIZE, var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4, "uint16_t multiple variable divides");
+ test_variable4< uint16_t, custom_divide_multiple_variable2<uint16_t> > (data16unsigned, SIZE, var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4, "uint16_t multiple variable divides2");
+
+ test_variable4< uint16_t, custom_mixed_multiple_variable<uint16_t> > (data16unsigned, SIZE, var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4, "uint16_t multiple variable mixed");
+
+ test_variable1< uint16_t, custom_variable_and<uint16_t> > (data16unsigned, SIZE, var1uint16_1, "uint16_t variable and");
+ test_variable4< uint16_t, custom_multiple_variable_and<uint16_t> > (data16unsigned, SIZE, var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4, "uint16_t multiple variable and");
+
+ test_variable1< uint16_t, custom_variable_or<uint16_t> > (data16unsigned, SIZE, var1uint16_1, "uint16_t variable or");
+ test_variable4< uint16_t, custom_multiple_variable_or<uint16_t> > (data16unsigned, SIZE, var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4, "uint16_t multiple variable or");
+
+ test_variable1< uint16_t, custom_variable_xor<uint16_t> > (data16unsigned, SIZE, var1uint16_1, "uint16_t variable xor");
+ test_variable4< uint16_t, custom_multiple_variable_xor<uint16_t> > (data16unsigned, SIZE, var1uint16_1, var1uint16_2, var1uint16_3, var1uint16_4, "uint16_t multiple variable xor");
+
+
+// int32_t
+ ::fill(data32, data32+SIZE, int32_t(init_value));
+ int32_t var1int32_1, var1int32_2, var1int32_3, var1int32_4;
+ var1int32_1 = int32_t(temp);
+ var1int32_2 = var1int32_1 * int32_t(2);
+ var1int32_3 = var1int32_1 + int32_t(2);
+ var1int32_4 = var1int32_1 + var1int32_2 / var1int32_3;
+
+ // test moving redundant calcs out of loop
+ test_variable1< int32_t, custom_add_variable<int32_t> > (data32, SIZE, var1int32_1, "int32_t variable add");
+ test_hoisted_variable1< int32_t, custom_add_variable<int32_t> > (data32, SIZE, var1int32_1, "int32_t variable add hoisted");
+ test_variable4< int32_t, custom_add_multiple_variable<int32_t> > (data32, SIZE, var1int32_1, var1int32_2, var1int32_3, var1int32_4, "int32_t multiple variable adds");
+
+ test_variable1< int32_t, custom_sub_variable<int32_t> > (data32, SIZE, var1int32_1, "int32_t variable subtract");
+ test_variable4< int32_t, custom_sub_multiple_variable<int32_t> > (data32, SIZE, var1int32_1, var1int32_2, var1int32_3, var1int32_4, "int32_t multiple variable subtracts");
+
+ test_variable1< int32_t, custom_multiply_variable<int32_t> > (data32, SIZE, var1int32_1, "int32_t variable multiply");
+ test_variable4< int32_t, custom_multiply_multiple_variable<int32_t> > (data32, SIZE, var1int32_1, var1int32_2, var1int32_3, var1int32_4, "int32_t multiple variable multiplies");
+ test_variable4< int32_t, custom_multiply_multiple_variable2<int32_t> > (data32, SIZE, var1int32_1, var1int32_2, var1int32_3, var1int32_4, "int32_t multiple variable multiplies2");
+
+ test_variable1< int32_t, custom_divide_variable<int32_t> > (data32, SIZE, var1int32_1, "int32_t variable divide");
+ test_variable4< int32_t, custom_divide_multiple_variable<int32_t> > (data32, SIZE, var1int32_1, var1int32_2, var1int32_3, var1int32_4, "int32_t multiple variable divides");
+ test_variable4< int32_t, custom_divide_multiple_variable2<int32_t> > (data32, SIZE, var1int32_1, var1int32_2, var1int32_3, var1int32_4, "int32_t multiple variable divides2");
+
+ test_variable4< int32_t, custom_mixed_multiple_variable<int32_t> > (data32, SIZE, var1int32_1, var1int32_2, var1int32_3, var1int32_4, "int32_t multiple variable mixed");
+
+ test_variable1< int32_t, custom_variable_and<int32_t> > (data32, SIZE, var1int32_1, "int32_t variable and");
+ test_variable4< int32_t, custom_multiple_variable_and<int32_t> > (data32, SIZE, var1int32_1, var1int32_2, var1int32_3, var1int32_4, "int32_t multiple variable and");
+
+ test_variable1< int32_t, custom_variable_or<int32_t> > (data32, SIZE, var1int32_1, "int32_t variable or");
+ test_variable4< int32_t, custom_multiple_variable_or<int32_t> > (data32, SIZE, var1int32_1, var1int32_2, var1int32_3, var1int32_4, "int32_t multiple variable or");
+
+ test_variable1< int32_t, custom_variable_xor<int32_t> > (data32, SIZE, var1int32_1, "int32_t variable xor");
+ test_variable4< int32_t, custom_multiple_variable_xor<int32_t> > (data32, SIZE, var1int32_1, var1int32_2, var1int32_3, var1int32_4, "int32_t multiple variable xor");
+
+
+// unsigned32
+ ::fill(data32unsigned, data32unsigned+SIZE, uint32_t(init_value));
+ uint32_t var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4;
+ var1uint32_1 = uint32_t(temp);
+ var1uint32_2 = var1uint32_1 * uint32_t(2);
+ var1uint32_3 = var1uint32_1 + uint32_t(2);
+ var1uint32_4 = var1uint32_1 + var1uint32_2 / var1uint32_3;
+
+ // test moving redundant calcs out of loop
+ test_variable1< uint32_t, custom_add_variable<uint32_t> > (data32unsigned, SIZE, var1uint32_1, "uint32_t variable add");
+ test_hoisted_variable1< uint32_t, custom_add_variable<uint32_t> > (data32unsigned, SIZE, var1uint32_1, "uint32_t variable add hoisted");
+ test_variable4< uint32_t, custom_add_multiple_variable<uint32_t> > (data32unsigned, SIZE, var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4, "uint32_t multiple variable adds");
+
+ test_variable1< uint32_t, custom_sub_variable<uint32_t> > (data32unsigned, SIZE, var1uint32_1, "uint32_t variable subtract");
+ test_variable4< uint32_t, custom_sub_multiple_variable<uint32_t> > (data32unsigned, SIZE, var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4, "uint32_t multiple variable subtracts");
+
+ test_variable1< uint32_t, custom_multiply_variable<uint32_t> > (data32unsigned, SIZE, var1uint32_1, "uint32_t variable multiply");
+ test_variable4< uint32_t, custom_multiply_multiple_variable<uint32_t> > (data32unsigned, SIZE, var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4, "uint32_t multiple variable multiplies");
+ test_variable4< uint32_t, custom_multiply_multiple_variable2<uint32_t> > (data32unsigned, SIZE, var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4, "uint32_t multiple variable multiplies2");
+
+ test_variable1< uint32_t, custom_divide_variable<uint32_t> > (data32unsigned, SIZE, var1uint32_1, "uint32_t variable divide");
+ test_variable4< uint32_t, custom_divide_multiple_variable<uint32_t> > (data32unsigned, SIZE, var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4, "uint32_t multiple variable divides");
+ test_variable4< uint32_t, custom_divide_multiple_variable2<uint32_t> > (data32unsigned, SIZE, var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4, "uint32_t multiple variable divides2");
+
+ test_variable4< uint32_t, custom_mixed_multiple_variable<uint32_t> > (data32unsigned, SIZE, var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4, "uint32_t multiple variable mixed");
+
+ test_variable1< uint32_t, custom_variable_and<uint32_t> > (data32unsigned, SIZE, var1uint32_1, "uint32_t variable and");
+ test_variable4< uint32_t, custom_multiple_variable_and<uint32_t> > (data32unsigned, SIZE, var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4, "uint32_t multiple variable and");
+
+ test_variable1< uint32_t, custom_variable_or<uint32_t> > (data32unsigned, SIZE, var1uint32_1, "uint32_t variable or");
+ test_variable4< uint32_t, custom_multiple_variable_or<uint32_t> > (data32unsigned, SIZE, var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4, "uint32_t multiple variable or");
+
+ test_variable1< uint32_t, custom_variable_xor<uint32_t> > (data32unsigned, SIZE, var1uint32_1, "uint32_t variable xor");
+ test_variable4< uint32_t, custom_multiple_variable_xor<uint32_t> > (data32unsigned, SIZE, var1uint32_1, var1uint32_2, var1uint32_3, var1uint32_4, "uint32_t multiple variable xor");
+
+
+// int64_t
+ ::fill(data64, data64+SIZE, int64_t(init_value));
+ int64_t var1int64_1, var1int64_2, var1int64_3, var1int64_4;
+ var1int64_1 = int64_t(temp);
+ var1int64_2 = var1int64_1 * int64_t(2);
+ var1int64_3 = var1int64_1 + int64_t(2);
+ var1int64_4 = var1int64_1 + var1int64_2 / var1int64_3;
+
+ // test moving redundant calcs out of loop
+ test_variable1< int64_t, custom_add_variable<int64_t> > (data64, SIZE, var1int64_1, "int64_t variable add");
+ test_hoisted_variable1< int64_t, custom_add_variable<int64_t> > (data64, SIZE, var1int64_1, "int64_t variable add hoisted");
+ test_variable4< int64_t, custom_add_multiple_variable<int64_t> > (data64, SIZE, var1int64_1, var1int64_2, var1int64_3, var1int64_4, "int64_t multiple variable adds");
+
+ test_variable1< int64_t, custom_sub_variable<int64_t> > (data64, SIZE, var1int64_1, "int64_t variable subtract");
+ test_variable4< int64_t, custom_sub_multiple_variable<int64_t> > (data64, SIZE, var1int64_1, var1int64_2, var1int64_3, var1int64_4, "int64_t multiple variable subtracts");
+
+ test_variable1< int64_t, custom_multiply_variable<int64_t> > (data64, SIZE, var1int64_1, "int64_t variable multiply");
+ test_variable4< int64_t, custom_multiply_multiple_variable<int64_t> > (data64, SIZE, var1int64_1, var1int64_2, var1int64_3, var1int64_4, "int64_t multiple variable multiplies");
+ test_variable4< int64_t, custom_multiply_multiple_variable2<int64_t> > (data64, SIZE, var1int64_1, var1int64_2, var1int64_3, var1int64_4, "int64_t multiple variable multiplies2");
+
+ test_variable1< int64_t, custom_divide_variable<int64_t> > (data64, SIZE, var1int64_1, "int64_t variable divide");
+ test_variable4< int64_t, custom_divide_multiple_variable<int64_t> > (data64, SIZE, var1int64_1, var1int64_2, var1int64_3, var1int64_4, "int64_t multiple variable divides");
+ test_variable4< int64_t, custom_divide_multiple_variable2<int64_t> > (data64, SIZE, var1int64_1, var1int64_2, var1int64_3, var1int64_4, "int64_t multiple variable divides2");
+
+ test_variable4< int64_t, custom_mixed_multiple_variable<int64_t> > (data64, SIZE, var1int64_1, var1int64_2, var1int64_3, var1int64_4, "int64_t multiple variable mixed");
+
+ test_variable1< int64_t, custom_variable_and<int64_t> > (data64, SIZE, var1int64_1, "int64_t variable and");
+ test_variable4< int64_t, custom_multiple_variable_and<int64_t> > (data64, SIZE, var1int64_1, var1int64_2, var1int64_3, var1int64_4, "int64_t multiple variable and");
+
+ test_variable1< int64_t, custom_variable_or<int64_t> > (data64, SIZE, var1int64_1, "int64_t variable or");
+ test_variable4< int64_t, custom_multiple_variable_or<int64_t> > (data64, SIZE, var1int64_1, var1int64_2, var1int64_3, var1int64_4, "int64_t multiple variable or");
+
+ test_variable1< int64_t, custom_variable_xor<int64_t> > (data64, SIZE, var1int64_1, "int64_t variable xor");
+ test_variable4< int64_t, custom_multiple_variable_xor<int64_t> > (data64, SIZE, var1int64_1, var1int64_2, var1int64_3, var1int64_4, "int64_t multiple variable xor");
+
+
+// unsigned64
+ ::fill(data64unsigned, data64unsigned+SIZE, uint64_t(init_value));
+ uint64_t var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4;
+ var1uint64_1 = uint64_t(temp);
+ var1uint64_2 = var1uint64_1 * uint64_t(2);
+ var1uint64_3 = var1uint64_1 + uint64_t(2);
+ var1uint64_4 = var1uint64_1 + var1uint64_2 / var1uint64_3;
+
+ // test moving redundant calcs out of loop
+ test_variable1< uint64_t, custom_add_variable<uint64_t> > (data64unsigned, SIZE, var1uint64_1, "uint64_t variable add");
+ test_hoisted_variable1< uint64_t, custom_add_variable<uint64_t> > (data64unsigned, SIZE, var1uint64_1, "uint64_t variable add hoisted");
+ test_variable4< uint64_t, custom_add_multiple_variable<uint64_t> > (data64unsigned, SIZE, var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4, "uint64_t multiple variable adds");
+
+ test_variable1< uint64_t, custom_sub_variable<uint64_t> > (data64unsigned, SIZE, var1uint64_1, "uint64_t variable subtract");
+ test_variable4< uint64_t, custom_sub_multiple_variable<uint64_t> > (data64unsigned, SIZE, var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4, "uint64_t multiple variable subtracts");
+
+ test_variable1< uint64_t, custom_multiply_variable<uint64_t> > (data64unsigned, SIZE, var1uint64_1, "uint64_t variable multiply");
+ test_variable4< uint64_t, custom_multiply_multiple_variable<uint64_t> > (data64unsigned, SIZE, var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4, "uint64_t multiple variable multiplies");
+ test_variable4< uint64_t, custom_multiply_multiple_variable2<uint64_t> > (data64unsigned, SIZE, var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4, "uint64_t multiple variable multiplies2");
+
+ test_variable1< uint64_t, custom_divide_variable<uint64_t> > (data64unsigned, SIZE, var1uint64_1, "uint64_t variable divide");
+ test_variable4< uint64_t, custom_divide_multiple_variable<uint64_t> > (data64unsigned, SIZE, var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4, "uint64_t multiple variable divides");
+ test_variable4< uint64_t, custom_divide_multiple_variable2<uint64_t> > (data64unsigned, SIZE, var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4, "uint64_t multiple variable divides2");
+
+ test_variable4< uint64_t, custom_mixed_multiple_variable<uint64_t> > (data64unsigned, SIZE, var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4, "uint64_t multiple variable mixed");
+
+ test_variable1< uint64_t, custom_variable_and<uint64_t> > (data64unsigned, SIZE, var1uint64_1, "uint64_t variable and");
+ test_variable4< uint64_t, custom_multiple_variable_and<uint64_t> > (data64unsigned, SIZE, var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4, "uint64_t multiple variable and");
+
+ test_variable1< uint64_t, custom_variable_or<uint64_t> > (data64unsigned, SIZE, var1uint64_1, "uint64_t variable or");
+ test_variable4< uint64_t, custom_multiple_variable_or<uint64_t> > (data64unsigned, SIZE, var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4, "uint64_t multiple variable or");
+
+ test_variable1< uint64_t, custom_variable_xor<uint64_t> > (data64unsigned, SIZE, var1uint64_1, "uint64_t variable xor");
+ test_variable4< uint64_t, custom_multiple_variable_xor<uint64_t> > (data64unsigned, SIZE, var1uint64_1, var1uint64_2, var1uint64_3, var1uint64_4, "uint64_t multiple variable xor");
+
+
+
+// float
+ ::fill(dataFloat, dataFloat+SIZE, float(init_value));
+ float var1Float_1, var1Float_2, var1Float_3, var1Float_4;
+ var1Float_1 = float(temp);
+ var1Float_2 = var1Float_1 * float(2.0);
+ var1Float_3 = var1Float_1 + float(2.0);
+ var1Float_4 = var1Float_1 + var1Float_2 / var1Float_3;
+
+ // test moving redundant calcs out of loop
+ test_variable1< float, custom_add_variable<float> > (dataFloat, SIZE, var1Float_1, "float variable add");
+ test_hoisted_variable1< float, custom_add_variable<float> > (dataFloat, SIZE, var1Float_1, "float variable add hoisted");
+ test_variable4< float, custom_add_multiple_variable<float> > (dataFloat, SIZE, var1Float_1, var1Float_2, var1Float_3, var1Float_4, "float multiple variable adds");
+
+ test_variable1< float, custom_sub_variable<float> > (dataFloat, SIZE, var1Float_1, "float variable subtract");
+ test_variable4< float, custom_sub_multiple_variable<float> > (dataFloat, SIZE, var1Float_1, var1Float_2, var1Float_3, var1Float_4, "float multiple variable subtracts");
+
+ test_variable1< float, custom_multiply_variable<float> > (dataFloat, SIZE, var1Float_1, "float variable multiply");
+ test_variable4< float, custom_multiply_multiple_variable<float> > (dataFloat, SIZE, var1Float_1, var1Float_2, var1Float_3, var1Float_4, "float multiple variable multiplies");
+ test_variable4< float, custom_multiply_multiple_variable2<float> > (dataFloat, SIZE, var1Float_1, var1Float_2, var1Float_3, var1Float_4, "float multiple variable multiplies2");
+
+ test_variable1< float, custom_divide_variable<float> > (dataFloat, SIZE, var1Float_1, "float variable divide");
+ test_variable4< float, custom_divide_multiple_variable<float> > (dataFloat, SIZE, var1Float_1, var1Float_2, var1Float_3, var1Float_4, "float multiple variable divides");
+ test_variable4< float, custom_divide_multiple_variable2<float> > (dataFloat, SIZE, var1Float_1, var1Float_2, var1Float_3, var1Float_4, "float multiple variable divides2");
+
+ test_variable4< float, custom_mixed_multiple_variable<float> > (dataFloat, SIZE, var1Float_1, var1Float_2, var1Float_3, var1Float_4, "float multiple variable mixed");
+
+
+// double
+ ::fill(dataDouble, dataDouble+SIZE, double(init_value));
+ double var1Double_1, var1Double_2, var1Double_3, var1Double_4;
+ var1Double_1 = double(temp);
+ var1Double_2 = var1Double_1 * double(2.0);
+ var1Double_3 = var1Double_1 + double(2.0);
+ var1Double_4 = var1Double_1 + var1Double_2 / var1Double_3;
+
+ // test moving redundant calcs out of loop
+ test_variable1< double, custom_add_variable<double> > (dataDouble, SIZE, var1Double_1, "double variable add");
+ test_hoisted_variable1< double, custom_add_variable<double> > (dataDouble, SIZE, var1Double_1, "double variable add hoisted");
+ test_variable4< double, custom_add_multiple_variable<double> > (dataDouble, SIZE, var1Double_1, var1Double_2, var1Double_3, var1Double_4, "double multiple variable adds");
+
+ test_variable1< double, custom_sub_variable<double> > (dataDouble, SIZE, var1Double_1, "double variable subtract");
+ test_variable4< double, custom_sub_multiple_variable<double> > (dataDouble, SIZE, var1Double_1, var1Double_2, var1Double_3, var1Double_4, "double multiple variable subtracts");
+
+ test_variable1< double, custom_multiply_variable<double> > (dataDouble, SIZE, var1Double_1, "double variable multiply");
+ test_variable4< double, custom_multiply_multiple_variable<double> > (dataDouble, SIZE, var1Double_1, var1Double_2, var1Double_3, var1Double_4, "double multiple variable multiplies");
+ test_variable4< double, custom_multiply_multiple_variable2<double> > (dataDouble, SIZE, var1Double_1, var1Double_2, var1Double_3, var1Double_4, "double multiple variable multiplies2");
+
+ test_variable1< double, custom_divide_variable<double> > (dataDouble, SIZE, var1Double_1, "double variable divide");
+ test_variable4< double, custom_divide_multiple_variable<double> > (dataDouble, SIZE, var1Double_1, var1Double_2, var1Double_3, var1Double_4, "double multiple variable divides");
+ test_variable4< double, custom_divide_multiple_variable2<double> > (dataDouble, SIZE, var1Double_1, var1Double_2, var1Double_3, var1Double_4, "double multiple variable divides2");
+
+ test_variable4< double, custom_mixed_multiple_variable<double> > (dataDouble, SIZE, var1Double_1, var1Double_2, var1Double_3, var1Double_4, "double multiple variable mixed");
+
+
+ return 0;
+}
+
+// the end
+/******************************************************************************/
+/******************************************************************************/
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/simple_types_loop_invariant.cpp
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/stepanov_abstraction.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/stepanov_abstraction.cpp?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/stepanov_abstraction.cpp (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/stepanov_abstraction.cpp Sun Jan 11 21:04:59 2009
@@ -0,0 +1,373 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html )
+
+
+Goal: examine any change in performance when adding abstraction to simple data types
+ in other words: what happens when adding {} around a type.
+
+
+Assumptions:
+
+ 1) A value wrapped in a struct or class should not perform worse than a raw value
+
+ 2) A value recursively wrapped in a struct or class should not perform worse than the raw value
+
+
+History:
+ Alex Stepanov created the abstraction penalty benchmark.
+ Recently, Alex suggested that I take ownership of his benchmark and extend it.
+
+ The original accumulation tests used to show large penalties for using abstraction,
+ but compilers have improved. I have added three sorting tests with non-trivial
+ value and pointer usage that show some compilers still have more
+ opportunities for optimization.
+
+ Chris Cox
+ February 2008
+
+*/
+
+#include <cstddef>
+#include <cstdio>
+#include <ctime>
+#include <cmath>
+#include <cstdlib>
+#include "benchmark_results.h"
+#include "benchmark_timer.h"
+#include "benchmark_algorithms.h"
+
+/******************************************************************************/
+
+// a value wrapped in a struct, recursively
+
+template <typename T>
+struct ValueWrapper {
+ T value;
+ ValueWrapper() {}
+ template<typename TT>
+ inline operator TT () const { return (TT)value; }
+ template<typename TT>
+ ValueWrapper(const TT& x) : value(x) {}
+ T& operator*() const { return *value; }
+};
+
+template <typename T>
+inline ValueWrapper<T> operator+(const ValueWrapper<T>& x, const ValueWrapper<T>& y) {
+ return ValueWrapper<T>(x.value + y.value);
+}
+
+template <typename T>
+inline bool operator<(const ValueWrapper<T>& x, const ValueWrapper<T>& y) {
+ return (x.value < y.value);
+}
+
+/******************************************************************************/
+
+typedef ValueWrapper<double> DoubleValueWrapper;
+typedef ValueWrapper< ValueWrapper< ValueWrapper< ValueWrapper< ValueWrapper< ValueWrapper< ValueWrapper< ValueWrapper< ValueWrapper< ValueWrapper<double> > > > > > > > > > DoubleValueWrapper10;
+
+/******************************************************************************/
+
+// a pointer wrapped in a struct, aka an iterator
+
+template<typename T>
+struct PointerWrapper {
+ T* current;
+ PointerWrapper() {}
+ PointerWrapper(T* x) : current(x) {}
+ T& operator*() const { return *current; }
+};
+
+// really a distance between pointers, which must return ptrdiff_t
+// because (ptr - ptr) --> ptrdiff_t
+template <typename T>
+inline ptrdiff_t operator-(PointerWrapper<T>& xx, PointerWrapper<T>& yy) {
+ return (ptrdiff_t)( xx.current - yy.current );
+}
+
+template <typename T>
+inline PointerWrapper<T>& operator++(PointerWrapper<T> &xx) {
+ ++xx.current;
+ return xx;
+}
+
+template <typename T>
+inline PointerWrapper<T>& operator--(PointerWrapper<T> &xx) {
+ --xx.current;
+ return xx;
+}
+
+template <typename T>
+inline PointerWrapper<T> operator++(PointerWrapper<T> &xx, int) {
+ PointerWrapper<T> tmp = xx;
+ ++xx;
+ return tmp;
+}
+
+template <typename T>
+inline PointerWrapper<T> operator--(PointerWrapper<T> &xx, int) {
+ PointerWrapper<T> tmp = xx;
+ --xx;
+ return tmp;
+}
+
+template <typename T>
+inline PointerWrapper<T> operator-(PointerWrapper<T> &xx, ptrdiff_t inc) {
+ PointerWrapper<T> tmp = xx;
+ tmp.current -= inc;
+ return tmp;
+}
+
+template <typename T>
+inline PointerWrapper<T> operator+(PointerWrapper<T> &xx, ptrdiff_t inc) {
+ PointerWrapper<T> tmp = xx;
+ tmp.current += inc;
+ return tmp;
+}
+
+template <typename T>
+inline PointerWrapper<T>& operator+=(PointerWrapper<T> &xx, ptrdiff_t inc) {
+ xx.current += inc;
+ return xx;
+}
+
+template <typename T>
+inline PointerWrapper<T>& operator-=(PointerWrapper<T> &xx, ptrdiff_t inc) {
+ xx.current -= inc;
+ return xx;
+}
+
+template <typename T>
+inline bool operator<(const PointerWrapper<T>& x, const PointerWrapper<T>& y) {
+ return (x.current < y.current);
+}
+
+template <typename T>
+inline bool operator==(const PointerWrapper<T>& x, const PointerWrapper<T>& y) {
+ return (x.current == y.current);
+}
+
+template <typename T>
+inline bool operator!=(const PointerWrapper<T>& x, const PointerWrapper<T>& y) {
+ return (x.current != y.current);
+}
+
+/******************************************************************************/
+
+typedef PointerWrapper<double> double_pointer;
+typedef PointerWrapper<DoubleValueWrapper> doubleValueWrapper_pointer;
+typedef PointerWrapper<DoubleValueWrapper10> doubleValueWrapper10_pointer;
+
+/******************************************************************************/
+/******************************************************************************/
+
+// this constant may need to be adjusted to give reasonable minimum times
+// For best results, times should be about 1.0 seconds for the minimum test run
+int iterations = 200000;
+
+// 2000 items, or about 16k of data
+// this is intended to remain within the L2 cache of most common CPUs
+const int SIZE = 2000;
+
+// initial value for filling our arrays, may be changed from the command line
+double init_value = 3.0;
+
+/******************************************************************************/
+/******************************************************************************/
+
+inline void check_sum(double result) {
+ if (result != SIZE * init_value) printf("test %i failed\n", current_test);
+}
+
+/******************************************************************************/
+
+template <typename Iterator>
+void verify_sorted(Iterator first, Iterator last) {
+ if (!is_sorted(first,last))
+ printf("sort test %i failed\n", current_test);
+}
+
+/******************************************************************************/
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void test_accumulate(Iterator first, Iterator last, T zero, const char *label) {
+ int i;
+
+
+ for(i = 0; i < iterations; ++i)
+ check_sum( double( accumulate(first, last, zero) ) );
+
+}
+
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void test_insertion_sort(Iterator firstSource, Iterator lastSource, Iterator firstDest,
+ Iterator lastDest, T zero, const char *label) {
+ int i;
+
+ for(i = 0; i < iterations; ++i) {
+ ::copy(firstSource, lastSource, firstDest);
+ insertionSort< Iterator, T>( firstDest, lastDest );
+ verify_sorted( firstDest, lastDest );
+ }
+
+}
+
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void test_quicksort(Iterator firstSource, Iterator lastSource, Iterator firstDest,
+ Iterator lastDest, T zero, const char *label) {
+ int i;
+
+
+ for(i = 0; i < iterations; ++i) {
+ ::copy(firstSource, lastSource, firstDest);
+ quicksort< Iterator, T>( firstDest, lastDest );
+ verify_sorted( firstDest, lastDest );
+ }
+
+}
+
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void test_heap_sort(Iterator firstSource, Iterator lastSource, Iterator firstDest,
+ Iterator lastDest, T zero, const char *label) {
+ int i;
+
+
+ for(i = 0; i < iterations; ++i) {
+ ::copy(firstSource, lastSource, firstDest);
+ heapsort< Iterator, T>( firstDest, lastDest );
+ verify_sorted( firstDest, lastDest );
+ }
+
+}
+
+/******************************************************************************/
+/******************************************************************************/
+
+// our global arrays of numbers to be summed
+
+double data[SIZE];
+DoubleValueWrapper VData[SIZE];
+DoubleValueWrapper10 V10Data[SIZE];
+
+double dataMaster[SIZE];
+DoubleValueWrapper VDataMaster[SIZE];
+DoubleValueWrapper10 V10DataMaster[SIZE];
+
+/******************************************************************************/
+
+// declaration of our iterator types and begin/end pairs
+typedef double* dp;
+dp dpb = data;
+dp dpe = data + SIZE;
+dp dMpb = dataMaster;
+dp dMpe = dataMaster + SIZE;
+
+typedef DoubleValueWrapper* DVp;
+DVp DVpb = VData;
+DVp DVpe = VData + SIZE;
+DVp DVMpb = VDataMaster;
+DVp DVMpe = VDataMaster + SIZE;
+
+typedef DoubleValueWrapper10* DV10p;
+DV10p DV10pb = V10Data;
+DV10p DV10pe = V10Data + SIZE;
+DV10p DV10Mpb = V10DataMaster;
+DV10p DV10Mpe = V10DataMaster + SIZE;
+
+typedef double_pointer dP;
+dP dPb(dpb);
+dP dPe(dpe);
+dP dMPb(dMpb);
+dP dMPe(dMpe);
+
+typedef doubleValueWrapper_pointer DVP;
+DVP DVPb(DVpb);
+DVP DVPe(DVpe);
+DVP DVMPb(DVMpb);
+DVP DVMPe(DVMpe);
+
+typedef doubleValueWrapper10_pointer DV10P;
+DV10P DV10Pb(DV10pb);
+DV10P DV10Pe(DV10pe);
+DV10P DV10MPb(DV10Mpb);
+DV10P DV10MPe(DV10Mpe);
+
+/******************************************************************************/
+/******************************************************************************/
+
+int main(int argc, char** argv) {
+
+ double dZero = 0.0;
+ DoubleValueWrapper DVZero = 0.0;
+ DoubleValueWrapper10 DV10Zero = DoubleValueWrapper10(0.0);
+
+ if (argc > 1) iterations = atoi(argv[1]);
+ if (argc > 2) init_value = (double) atof(argv[2]);
+
+ // seed the random number generator so we get repeatable results
+ srand( (int)init_value + 123 );
+
+
+ fill(dpb, dpe, double(init_value));
+ fill(DVpb, DVpe, DoubleValueWrapper(init_value));
+ fill(DV10pb, DV10pe, DoubleValueWrapper10(init_value));
+
+ test_accumulate(dpb, dpe, dZero, "double pointer");
+ test_accumulate(dPb, dPe, dZero, "double pointer_class");
+ test_accumulate(DVpb, DVpe, DVZero, "DoubleValueWrapper pointer");
+ test_accumulate(DVPb, DVPe, DVZero, "DoubleValueWrapper pointer_class");
+ test_accumulate(DV10pb, DV10pe, DV10Zero, "DoubleValueWrapper10 pointer");
+ test_accumulate(DV10Pb, DV10Pe, DV10Zero, "DoubleValueWrapper10 pointer_class");
+
+
+ // the sorting tests are much slower than the accumulation tests - O(N^2)
+ iterations = iterations / 2000;
+
+ // fill one set of random numbers
+ fill_random<double *, double>( dMpb, dMpe );
+ // copy to the other sets, so we have the same numbers
+ ::copy( dMpb, dMpe, DVMpb );
+ ::copy( dMpb, dMpe, DV10Mpb );
+
+ test_insertion_sort(dMpb, dMpe, dpb, dpe, dZero, "insertion_sort double pointer");
+ test_insertion_sort(dMPb, dMPe, dPb, dPe, dZero, "insertion_sort double pointer_class");
+ test_insertion_sort(DVMpb, DVMpe, DVpb, DVpe, DVZero, "insertion_sort DoubleValueWrapper pointer");
+ test_insertion_sort(DVMPb, DVMPe, DVPb, DVPe, DVZero, "insertion_sort DoubleValueWrapper pointer_class");
+ test_insertion_sort(DV10Mpb, DV10Mpe, DV10pb, DV10pe, DV10Zero, "insertion_sort DoubleValueWrapper10 pointer");
+ test_insertion_sort(DV10MPb, DV10MPe, DV10Pb, DV10Pe, DV10Zero, "insertion_sort DoubleValueWrapper10 pointer_class");
+
+
+ // these are slightly faster - O(NLog2(N))
+ iterations = iterations * 8;
+
+ test_quicksort(dMpb, dMpe, dpb, dpe, dZero, "quicksort double pointer");
+ test_quicksort(dMPb, dMPe, dPb, dPe, dZero, "quicksort double pointer_class");
+ test_quicksort(DVMpb, DVMpe, DVpb, DVpe, DVZero, "quicksort DoubleValueWrapper pointer");
+ test_quicksort(DVMPb, DVMPe, DVPb, DVPe, DVZero, "quicksort DoubleValueWrapper pointer_class");
+ test_quicksort(DV10Mpb, DV10Mpe, DV10pb, DV10pe, DV10Zero, "quicksort DoubleValueWrapper10 pointer");
+ test_quicksort(DV10MPb, DV10MPe, DV10Pb, DV10Pe, DV10Zero, "quicksort DoubleValueWrapper10 pointer_class");
+
+
+ test_heap_sort(dMpb, dMpe, dpb, dpe, dZero, "heap_sort double pointer");
+ test_heap_sort(dMPb, dMPe, dPb, dPe, dZero, "heap_sort double pointer_class");
+ test_heap_sort(DVMpb, DVMpe, DVpb, DVpe, DVZero, "heap_sort DoubleValueWrapper pointer");
+ test_heap_sort(DVMPb, DVMPe, DVPb, DVPe, DVZero, "heap_sort DoubleValueWrapper pointer_class");
+ test_heap_sort(DV10Mpb, DV10Mpe, DV10pb, DV10pe, DV10Zero, "heap_sort DoubleValueWrapper10 pointer");
+ test_heap_sort(DV10MPb, DV10MPe, DV10Pb, DV10Pe, DV10Zero, "heap_sort DoubleValueWrapper10 pointer_class");
+
+
+ return 0;
+}
+
+// the end
+/******************************************************************************/
+/******************************************************************************/
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/stepanov_abstraction.cpp
------------------------------------------------------------------------------
svn:executable = *
Added: test-suite/trunk/SingleSource/Benchmarks/C++Bench/stepanov_vector.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/C%2B%2BBench/stepanov_vector.cpp?rev=62072&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/C++Bench/stepanov_vector.cpp (added)
+++ test-suite/trunk/SingleSource/Benchmarks/C++Bench/stepanov_vector.cpp Sun Jan 11 21:04:59 2009
@@ -0,0 +1,268 @@
+/*
+ Copyright 2007-2008 Adobe Systems Incorporated
+ Distributed under the MIT License (see accompanying file LICENSE_1_0_0.txt
+ or a copy at http://stlab.adobe.com/licenses.html )
+
+
+Goal: examine any change in performance when moving from pointers to vector iterators
+
+
+Assumptions:
+ 1) Vector iterators should not perform worse than raw pointers.
+
+ Programmers should never be tempted to write
+ std::sort( &*vec.begin(), &*( vec.begin() + vec.size() ) )
+ instead of
+ std::sort( vec.begin(), vec.end() )
+
+HIstory:
+ This is an extension to Alex Stepanov's original abstraction penalty benchmark
+ to test the compiler vendor implementation of vector iterators.
+
+*/
+
+#include <cstddef>
+#include <cstdio>
+#include <ctime>
+#include <cmath>
+#include <cstdlib>
+#include <vector>
+#include "benchmark_results.h"
+#include "benchmark_timer.h"
+#include "benchmark_algorithms.h"
+
+/******************************************************************************/
+/******************************************************************************/
+
+// this constant may need to be adjusted to give reasonable minimum times
+// For best results, times should be about 1.0 seconds for the minimum test run
+int iterations = 60000;
+
+// 2000 items, or about 16k of data
+// this is intended to remain within the L2 cache of most common CPUs
+const int SIZE = 2000;
+
+// initial value for filling our arrays, may be changed from the command line
+double init_value = 3.0;
+
+/******************************************************************************/
+/******************************************************************************/
+
+inline void check_sum(double result) {
+ if (result != SIZE * init_value) printf("test %i failed\n", current_test);
+}
+
+/******************************************************************************/
+
+template <typename Iterator>
+void verify_sorted(Iterator first, Iterator last) {
+ if (!is_sorted(first,last))
+ printf("sort test %i failed\n", current_test);
+}
+
+/******************************************************************************/
+
+// a template using the accumulate template and iterators
+
+template <typename Iterator, typename T>
+void test_accumulate(Iterator first, Iterator last, T zero, const char *label) {
+ int i;
+
+
+ for(i = 0; i < iterations; ++i)
+ check_sum( double( accumulate(first, last, zero) ) );
+
+}
+
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void test_insertion_sort(Iterator firstSource, Iterator lastSource, Iterator firstDest,
+ Iterator lastDest, T zero, const char *label) {
+ int i;
+
+
+ for(i = 0; i < iterations; ++i) {
+ ::copy(firstSource, lastSource, firstDest);
+ insertionSort< Iterator, T>( firstDest, lastDest );
+ verify_sorted( firstDest, lastDest );
+ }
+
+}
+
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void test_quicksort(Iterator firstSource, Iterator lastSource, Iterator firstDest,
+ Iterator lastDest, T zero, const char *label) {
+ int i;
+
+
+ for(i = 0; i < iterations; ++i) {
+ ::copy(firstSource, lastSource, firstDest);
+ quicksort< Iterator, T>( firstDest, lastDest );
+ verify_sorted( firstDest, lastDest );
+ }
+
+}
+
+/******************************************************************************/
+
+template <typename Iterator, typename T>
+void test_heap_sort(Iterator firstSource, Iterator lastSource, Iterator firstDest,
+ Iterator lastDest, T zero, const char *label) {
+ int i;
+
+
+ for(i = 0; i < iterations; ++i) {
+ ::copy(firstSource, lastSource, firstDest);
+ heapsort< Iterator, T>( firstDest, lastDest );
+ verify_sorted( firstDest, lastDest );
+ }
+
+}
+
+/******************************************************************************/
+/******************************************************************************/
+
+// our global arrays of numbers to be summed
+
+double data[SIZE];
+double dataMaster[SIZE];
+
+/******************************************************************************/
+
+// declaration of our iterator types and begin/end pairs
+typedef double* dp;
+dp dpb = data;
+dp dpe = data + SIZE;
+dp dMpb = dataMaster;
+dp dMpe = dataMaster + SIZE;
+
+typedef std::reverse_iterator<dp> rdp;
+rdp rdpb(dpe);
+rdp rdpe(dpb);
+rdp rdMpb(dMpe);
+rdp rdMpe(dMpb);
+
+typedef std::reverse_iterator<rdp> rrdp;
+rrdp rrdpb(rdpe);
+rrdp rrdpe(rdpb);
+rrdp rrdMpb(rdMpe);
+rrdp rrdMpe(rdMpb);
+
+typedef std::vector<double>::iterator vdp;
+
+typedef std::vector<double>::reverse_iterator rvdp;
+typedef std::reverse_iterator< vdp > rtvdp;
+
+typedef std::reverse_iterator<rvdp> rtrvdp;
+typedef std::reverse_iterator< rtvdp > rtrtvdp;
+
+
+/******************************************************************************/
+/******************************************************************************/
+
+
+int main(int argc, char** argv) {
+
+ double dZero = 0.0;
+
+ if (argc > 1) iterations = atoi(argv[1]);
+ if (argc > 2) init_value = (double) atof(argv[2]);
+
+ // seed the random number generator so we get repeatable results
+ srand( (int)init_value + 123 );
+
+
+ ::fill(dpb, dpe, double(init_value));
+
+ std::vector<double> vec_data;
+ vec_data.resize(SIZE);
+
+ ::fill(vec_data.begin(), vec_data.end(), double(init_value));
+
+ rtvdp rtvdpb(vec_data.end());
+ rtvdp rtvdpe(vec_data.begin());
+
+ rtrvdp rtrvdpb(vec_data.rend());
+ rtrvdp rtrvdpe(vec_data.rbegin());
+
+ rtrtvdp rtrtvdpb(rtvdpe);
+ rtrtvdp rtrtvdpe(rtvdpb);
+
+ test_accumulate(dpb, dpe, dZero, "double pointer verify2");
+ test_accumulate(vec_data.begin(), vec_data.end(), dZero, "double vector iterator");
+ test_accumulate(rdpb, rdpe, dZero, "double pointer reverse");
+ test_accumulate(vec_data.rbegin(), vec_data.rend(), dZero, "double vector reverse_iterator");
+ test_accumulate(rtvdpb, rtvdpe, dZero, "double vector iterator reverse");
+ test_accumulate(rrdpb, rrdpe, dZero, "double pointer reverse reverse");
+ test_accumulate(rtrvdpb, rtrvdpe, dZero, "double vector reverse_iterator reverse");
+ test_accumulate(rtrtvdpb, rtrtvdpe, dZero, "double vector iterator reverse reverse");
+
+
+
+
+ // the sorting tests are much slower than the accumulation tests - O(N^2)
+ iterations = iterations / 1000;
+
+ std::vector<double> vec_dataMaster;
+ vec_dataMaster.resize(SIZE);
+
+ // fill one set of random numbers
+ fill_random<double *, double>( dMpb, dMpe );
+
+ // copy to the other sets, so we have the same numbers
+ ::copy( dMpb, dMpe, vec_dataMaster.begin() );
+
+ rtvdp rtvdMpb(vec_dataMaster.end());
+ rtvdp rtvdMpe(vec_dataMaster.begin());
+
+ rtrvdp rtrvdMpb(vec_dataMaster.rend());
+ rtrvdp rtrvdMpe(vec_dataMaster.rbegin());
+
+ rtrtvdp rtrtvdMpb(rtvdMpe);
+ rtrtvdp rtrtvdMpe(rtvdMpb);
+
+ test_insertion_sort(dMpb, dMpe, dpb, dpe, dZero, "insertion_sort double pointer verify2");
+ test_insertion_sort(vec_dataMaster.begin(), vec_dataMaster.end(), vec_data.begin(), vec_data.end(), dZero, "insertion_sort double vector iterator");
+ test_insertion_sort(rdMpb, rdMpe, rdpb, rdpe, dZero, "insertion_sort double pointer reverse");
+ test_insertion_sort(vec_dataMaster.rbegin(), vec_dataMaster.rend(), vec_data.rbegin(), vec_data.rend(), dZero, "insertion_sort double vector reverse_iterator");
+ test_insertion_sort(rtvdMpb, rtvdMpe, rtvdpb, rtvdpe, dZero, "insertion_sort double vector iterator reverse");
+ test_insertion_sort(rrdMpb, rrdMpe, rrdpb, rrdpe, dZero, "insertion_sort double pointer reverse reverse");
+ test_insertion_sort(rtrvdMpb, rtrvdMpe, rtrvdpb, rtrvdpe, dZero, "insertion_sort double vector reverse_iterator reverse");
+ test_insertion_sort(rtrtvdMpb, rtrtvdMpe, rtrtvdpb, rtrtvdpe, dZero, "insertion_sort double vector iterator reverse reverse");
+
+
+ // these are slightly faster - O(NLog2(N))
+ iterations = iterations * 8;
+
+ test_quicksort(dMpb, dMpe, dpb, dpe, dZero, "quicksort double pointer verify2");
+ test_quicksort(vec_dataMaster.begin(), vec_dataMaster.end(), vec_data.begin(), vec_data.end(), dZero, "quicksort double vector iterator");
+ test_quicksort(rdMpb, rdMpe, rdpb, rdpe, dZero, "quicksort double pointer reverse");
+ test_quicksort(vec_dataMaster.rbegin(), vec_dataMaster.rend(), vec_data.rbegin(), vec_data.rend(), dZero, "quicksort double vector reverse_iterator");
+ test_quicksort(rtvdMpb, rtvdMpe, rtvdpb, rtvdpe, dZero, "quicksort double vector iterator reverse");
+ test_quicksort(rrdMpb, rrdMpe, rrdpb, rrdpe, dZero, "quicksort double pointer reverse reverse");
+ test_quicksort(rtrvdMpb, rtrvdMpe, rtrvdpb, rtrvdpe, dZero, "quicksort double vector reverse_iterator reverse");
+ test_quicksort(rtrtvdMpb, rtrtvdMpe, rtrtvdpb, rtrtvdpe, dZero, "quicksort double vector iterator reverse reverse");
+
+
+
+ test_heap_sort(dMpb, dMpe, dpb, dpe, dZero, "heap_sort double pointer verify2");
+ test_heap_sort(vec_dataMaster.begin(), vec_dataMaster.end(), vec_data.begin(), vec_data.end(), dZero, "heap_sort double vector iterator");
+ test_heap_sort(rdMpb, rdMpe, rdpb, rdpe, dZero, "heap_sort double pointer reverse");
+ test_heap_sort(vec_dataMaster.rbegin(), vec_dataMaster.rend(), vec_data.rbegin(), vec_data.rend(), dZero, "heap_sort double vector reverse_iterator");
+ test_heap_sort(rtvdMpb, rtvdMpe, rtvdpb, rtvdpe, dZero, "heap_sort double vector iterator reverse");
+ test_heap_sort(rrdMpb, rrdMpe, rrdpb, rrdpe, dZero, "heap_sort double pointer reverse reverse");
+ test_heap_sort(rtrvdMpb, rtrvdMpe, rtrvdpb, rtrvdpe, dZero, "heap_sort double vector reverse_iterator reverse");
+ test_heap_sort(rtrtvdMpb, rtrtvdMpe, rtrtvdpb, rtrtvdpe, dZero, "heap_sort double vector iterator reverse reverse");
+
+
+
+
+ return 0;
+}
+
+// the end
+/******************************************************************************/
+/******************************************************************************/
Propchange: test-suite/trunk/SingleSource/Benchmarks/C++Bench/stepanov_vector.cpp
------------------------------------------------------------------------------
svn:executable = *
Modified: test-suite/trunk/SingleSource/Benchmarks/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Benchmarks/Makefile?rev=62072&r1=62071&r2=62072&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/Benchmarks/Makefile (original)
+++ test-suite/trunk/SingleSource/Benchmarks/Makefile Sun Jan 11 21:04:59 2009
@@ -1,6 +1,6 @@
LEVEL = ../..
PARALLEL_DIRS=Dhrystone CoyoteBench Shootout Shootout-C++ Stanford McGill \
- Misc Misc-C++ BenchmarkGame
+ Misc Misc-C++ BenchmarkGame C++Bench
# Misc-C++-EH - someday when EH is supported in llvm-gcc we should
# re-enable this test. It always fails and its very slow
# (100MB Bytecode) so we disable it for now.
More information about the llvm-commits
mailing list