i965g: Move bootstrap code to targets
[mesa.git] / src / gallium / drivers / llvmpipe / lp_test_main.c
index f07fa256f16d3d4a199d525a6e699253ff54aaad..7bbbc61d4c270c13bc2012d15a6a80c34b603f07 100644 (file)
  */
 
 
-#include "lp_bld_const.h"
+#include "util/u_cpu_detect.h"
+
+#include "gallivm/lp_bld_const.h"
+#include "gallivm/lp_bld_init.h"
 #include "lp_test.h"
 
 
+#ifdef PIPE_CC_MSVC
+static INLINE double
+round(double x)
+{
+   if (x >= 0.0)
+      return floor(x + 0.5);
+   else
+      return ceil(x - 0.5);
+}
+#endif
+
+
 void
 dump_type(FILE *fp,
           struct lp_type type)
@@ -355,20 +370,22 @@ int main(int argc, char **argv)
    unsigned long n = 1000;
    unsigned i;
    boolean success;
+   boolean single = FALSE;
 
    for(i = 1; i < argc; ++i) {
       if(strcmp(argv[i], "-v") == 0)
          ++verbose;
+      else if(strcmp(argv[i], "-s") == 0)
+         single = TRUE;
       else if(strcmp(argv[i], "-o") == 0)
          fp = fopen(argv[++i], "wt");
       else
          n = atoi(argv[i]);
    }
 
-#ifdef LLVM_NATIVE_ARCH
-   LLVMLinkInJIT();
-   LLVMInitializeNativeTarget();
-#endif
+   lp_build_init();
+
+   util_cpu_detect();
 
    if(fp) {
       /* Warm up the caches */
@@ -377,7 +394,9 @@ int main(int argc, char **argv)
       write_tsv_header(fp);
    }
       
-   if(n)
+   if (single)
+      success = test_single(verbose, fp);
+   else if (n)
       success = test_some(verbose, fp, n);
    else
       success = test_all(verbose, fp);