sl@0: #!/usr/bin/perl sl@0: # sl@0: sl@0: sl@0: sl@0: print < sl@0: * All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR sl@0: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED sl@0: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, sl@0: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES sl@0: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR sl@0: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, sl@0: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING sl@0: * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE sl@0: * POSSIBILITY OF SUCH DAMAGE. sl@0: */ sl@0: sl@0: #ifdef HAVE_CONFIG_H sl@0: #include "config.h" sl@0: #endif sl@0: sl@0: #include sl@0: sl@0: #include sl@0: #include sl@0: sl@0: EOF sl@0: ; sl@0: sl@0: sl@0: sub binary_pointer sl@0: { sl@0: my $kernel = shift; sl@0: my $precision = shift; sl@0: my $type = "oil_type_$precision"; sl@0: my $operator = shift; sl@0: sl@0: print < "+", sl@0: "subtract" => "-", sl@0: "multiply" => "*", sl@0: "divide" => "/" sl@0: ); sl@0: sl@0: my @types = ( "f32", "f64" ); sl@0: sl@0: while ( ($name, $op) = each %binary_operators ) { sl@0: foreach $prec (@types) { sl@0: binary_pointer($name, $prec, $op); sl@0: binary_unroll2($name, $prec, $op); sl@0: binary_unroll4a($name, $prec, $op); sl@0: binary_unroll4b($name, $prec, $op); sl@0: binary_unroll4c($name, $prec, $op); sl@0: } sl@0: } sl@0: sl@0: exit 0; sl@0: sl@0: binary_pointer("subtract", "f32", "-"); sl@0: binary_unroll2("subtract", "f32", "-"); sl@0: binary_unroll4a("subtract", "f32", "-"); sl@0: binary_unroll4b("subtract", "f32", "-"); sl@0: binary_unroll4c("subtract", "f32", "-"); sl@0: sl@0: binary_pointer("add", "f32", "+"); sl@0: binary_unroll2("add", "f32", "+"); sl@0: binary_unroll4a("add", "f32", "+"); sl@0: binary_unroll4b("add", "f32", "+"); sl@0: binary_unroll4c("add", "f32", "+"); sl@0: sl@0: binary_pointer("multiply", "f32", "*"); sl@0: binary_unroll2("multiply", "f32", "*"); sl@0: binary_unroll4a("multiply", "f32", "*"); sl@0: binary_unroll4b("multiply", "f32", "*"); sl@0: binary_unroll4c("multiply", "f32", "*"); sl@0: sl@0: binary_pointer("divide", "f32", "/"); sl@0: binary_unroll2("divide", "f32", "/"); sl@0: binary_unroll4a("divide", "f32", "/"); sl@0: binary_unroll4b("divide", "f32", "/"); sl@0: binary_unroll4c("divide", "f32", "/"); sl@0: sl@0: binary_pointer("subtract", "f64", "-"); sl@0: binary_unroll2("subtract", "f64", "-"); sl@0: binary_unroll4a("subtract", "f64", "-"); sl@0: binary_unroll4b("subtract", "f64", "-"); sl@0: binary_unroll4c("subtract", "f64", "-"); sl@0: sl@0: binary_pointer("add", "f64", "+"); sl@0: binary_unroll2("add", "f64", "+"); sl@0: binary_unroll4a("add", "f64", "+"); sl@0: binary_unroll4b("add", "f64", "+"); sl@0: binary_unroll4c("add", "f64", "+"); sl@0: sl@0: binary_pointer("multiply", "f64", "*"); sl@0: binary_unroll2("multiply", "f64", "*"); sl@0: binary_unroll4a("multiply", "f64", "*"); sl@0: binary_unroll4b("multiply", "f64", "*"); sl@0: binary_unroll4c("multiply", "f64", "*"); sl@0: sl@0: binary_pointer("divide", "f64", "/"); sl@0: binary_unroll2("divide", "f64", "/"); sl@0: binary_unroll4a("divide", "f64", "/"); sl@0: binary_unroll4b("divide", "f64", "/"); sl@0: binary_unroll4c("divide", "f64", "/"); sl@0: sl@0: $blah = " sl@0: static void sl@0: subtract_f32_ref (float *dest, float *src1, float *src2, int n) sl@0: { sl@0: int i; sl@0: sl@0: for(i=0;i src2[i]) ? src1[i] : src2[i]; sl@0: } sl@0: } sl@0: OIL_DEFINE_IMPL_REF (maximum_f32_ref, maximum_f32); sl@0: sl@0: static void sl@0: negative_f32_ref (float *dest, float *src1, int n) sl@0: { sl@0: int i; sl@0: sl@0: for(i=0;i