diff options
author | David Schleef <ds@schleef.org> | 2006-10-01 23:38:12 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2006-10-01 23:38:12 +0000 |
commit | 7272088204c7406a209add33ffadb275008f78c2 (patch) | |
tree | 3102b8a463b4b8e16f47cbc0e4bc7bae67b5d1c2 /examples | |
parent | 36374a87273e4ee08495d1b70ccc7f98ee09e8a5 (diff) | |
download | liboil-7272088204c7406a209add33ffadb275008f78c2.tar.gz |
* examples/memcpy-speed.c:
Check read speed.
* liboil/ref/Makefile.am:
* liboil/ref/sum.c:
new class sum_s16.
* liboil/i386/Makefile.am:
* liboil/i386/sum.c:
* liboil/liboilclasses.h:
* liboil/liboilfuncs-04.h:
* liboil/liboilfuncs.h:
* liboil/liboiltrampolines.c:
update.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/memcpy-speed.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/examples/memcpy-speed.c b/examples/memcpy-speed.c index c74295a..0693aef 100644 --- a/examples/memcpy-speed.c +++ b/examples/memcpy-speed.c @@ -20,9 +20,9 @@ main(int argc, char *argv[]) double cpufreq; OilFunctionClass *klass; OilFunctionImpl *impl; - int use_memset = 0; + int the_class; - //use_memset = 1; + the_class = 2; oil_init (); @@ -33,10 +33,16 @@ main(int argc, char *argv[]) src = ALIGN(s,128); dest = ALIGN(d,128); - if (use_memset) { - klass = oil_class_get ("splat_u32_ns"); - } else { - klass = oil_class_get ("copy_u8"); + switch(the_class) { + case 0: + klass = oil_class_get ("splat_u32_ns"); + break; + case 1: + klass = oil_class_get ("copy_u8"); + break; + case 2: + klass = oil_class_get ("sum_s16"); + break; } for(impl=klass->first_impl;impl;impl=impl->next) { @@ -52,14 +58,22 @@ main(int argc, char *argv[]) for(i=10;i<24;i++){ oil_profile_init (&prof); for(j=0;j<10;j++){ - if (use_memset) { - oil_profile_start(&prof); - oil_splat_u32_ns (dest, src, 1<<(i-2)); - oil_profile_stop(&prof); - } else { - oil_profile_start(&prof); - oil_memcpy (dest, src, 1<<i); - oil_profile_stop(&prof); + switch(the_class) { + case 0: + oil_profile_start(&prof); + oil_splat_u32_ns (dest, src, 1<<(i-2)); + oil_profile_stop(&prof); + break; + case 1: + oil_profile_start(&prof); + oil_memcpy (dest, src, 1<<i); + oil_profile_stop(&prof); + break; + case 2: + oil_profile_start(&prof); + oil_sum_s16 ((int16_t *)dest, (int16_t *)src, 1<<(i-1)); + oil_profile_stop(&prof); + break; } } |