Commits

Kota UENISHI committed df89b3f

jsx and sse trying

Comments (0)

Files changed (7)

 # LDFLAGS +=
 # INCLUDES +=
 
-.SUBDIRS: omake cerl c c++ ocaml # haskell erlang
+.SUBDIRS: omake c c++ ocaml #cerl haskell erlang
+include build/C.om
+include build/OCaml.om
+
 Check_header_library(xlib, xheader, xfunc) =
   return $(and $(VerboseCheckCHeader $(xheader)), $(VerboseCheckCLib $(xlib), $(xfunc)))
 
 
   dep() =
     CFLAGS += $(this.ldflags)
-    .DEFAULT: $(CProgram $(this.t), $(this.s))
+    .DEFAULT: $(CProgram $(this.target), $(this.source))
 
 CXXProg. = 
   class CXXProg
 
   dep() =
     CXXFLAGS += $(this.ldflags)
-    .DEFAULT: $(CXXProgram $(this.t), $(this.s))
+    .DEFAULT: $(CXXProgram $(this.target), $(this.source))
 
 #
 # The command-line variables are defined *after* the
     $(CXXProg.new checkRandomness.out, checkRandomness, '')
     $(CXXProg.new hdfs_test, hdfs_test, '-I{HADOOP_HOME}/')
 
-DEPS.foreach(prog)
+DEPS.foreach(prog => ...)
     prog.dep()
     export
 
-.DEFAULT: hdfs_test # $(CProgram $(MAIN), $(CFILES))
-	./hdfs_test
+#.DEFAULT: # $(CProgram $(MAIN), $(CFILES))
+#	./hdfs_test
 
 ################################################
 # Uncomment the following section if you want to build a C library
 # If so, define the subdirectory targets and uncomment this section.
 #
 
-# .SUBDIRS:
+.SUBDIRS: simd
 
 ########################################################################
 # C configuration.
     prog.dep()
     export
 
-test: myfsevent
-       ./myfsevent
-
 ################################################
 # Uncomment the following section if you want to build a C library
 # in the current directory.
+.PHONY: all install clean test
+# .SUBDIRS: simd
+
+CFLAGS +=  -mfpmath=sse -msse3
+ASFLAGS +=
+LDFLAGS +=
+INCLUDES +=
+
+DEPS[] = 
+    $(CProg.new napier.out, napier, '')
+
+DEPS.foreach(prog => ...)
+    prog.dep()
+    export
+
+test: napier.out
+       ./napier.out
+
+################################################
+# Uncomment the following section if you want to build a C library
+# in the current directory.
+#
+
+# LIBFILES[] =
+#    file1
+#    file2
+#
+# LIB = libxxx
+#
+# .DEFAULT: $(StaticCLibrary $(LIB), $(LIBFILES))
+#include <stdio.h>
+#include <sys/time.h>
+
+// SSE2
+//#include <emmintrin.h>
+
+// SSE3
+#include <pmmintrin.h>
+
+// SSE4
+// #include <smmintrin.h>
+
+#define E (2.718281828459045235360287471352)
+
+// compute Napier number naturally
+double f0(unsigned long long n){
+  double sum = 1.0;
+  double fact = 1.0;
+  unsigned long long i;
+  for(i=2; i<=n; ++i){
+    sum += 1.0 / fact;
+    fact *= i;
+  }
+  return sum;
+}
+
+double f1(unsigned long long n){
+  double d[4];
+  double f[2] = {1.0, 2.0};
+  d[0] = 1.0 + 1.0 / f[0];
+  d[1] = d[0] + 1.0 / f[1];
+  __m128d sums = _mm_load_pd(d);
+  //__m128d fact = _mm_load_pd(f);
+  unsigned long long i;
+  for(i=1; i<=n; i+=2){
+  }
+  //_mm_store_pd(d, sums);
+  return d[0];
+}
+
+double timer(double (*fun)(unsigned long long), unsigned long long n){
+  struct timeval start;
+  struct timeval end;
+  gettimeofday(&start, NULL);
+  double sum = fun(n);
+  gettimeofday(&end, NULL);
+  double t
+    = (end.tv_sec - start.tv_sec) * 1000.0
+    + (end.tv_usec - start.tv_usec) / 1000.0;
+  printf("(%.2fmsec) ", t);
+  return sum;
+}
+
+int main(){
+
+  printf("(0 msec) const: \t%.20f\n", E);
+  printf("f0: \t%.20f\n", timer(f0, 0xFFFFFFF));
+  printf("f1: \t%.20f\n", timer(f1, 0xFFFFFFF));
+  
+  
+  return 0;
+}
 
 class _Main {
 
+    static function hello() void {
+        alert "hello";
+    }
+
     static function main(args : string[]) : void {
         var document = dom.window.document;