int main (int argc, char *argv[]) { OrcProgram **programs; OrcCompileResult cres; int n, i; orc_init (); orc_test_init (); /* 1 - unix */ n = orc_parse (txt_unix, &programs); for (i = 0; i < n; i++) { if (verbose) printf ("%s\n", programs[i]->name); orc_test_compare_output_full (programs[i], 0); cres = orc_program_compile (programs[i]); if (ORC_COMPILE_RESULT_IS_FATAL (cres)) { fprintf (stderr, "compile error: %d\n", cres); error = TRUE; } orc_program_free (programs[i]); } if (error || n == 0) return 1; /* 2 - windows */ n = orc_parse (txt_win32, &programs); for (i = 0; i < n; i++) { if (verbose) printf ("%s\n", programs[i]->name); orc_test_compare_output_full (programs[i], 0); cres = orc_program_compile (programs[i]); if (ORC_COMPILE_RESULT_IS_FATAL (cres)) { fprintf (stderr, "compile error: %d\n", cres); error = TRUE; } orc_program_free (programs[i]); } if (error || n == 0) return 1; return 0; }
int main (int argc, char *argv[]) { char *code; int n; int i; OrcProgram **programs; const char *filename = NULL; orc_init (); orc_test_init (); if (argc >= 2) { filename = argv[1]; } if (filename == NULL) { filename = getenv ("testfile"); } if (filename == NULL) { filename = "test.orc"; } code = read_file (filename); if (!code) { printf("perf_parse <file.orc>\n"); exit(1); } n = orc_parse (code, &programs); free (code); for(i=0;i<n;i++){ double perf_mmx; double perf_sse; perf_mmx = orc_test_performance_full (programs[i], 0, "mmx"); perf_sse = orc_test_performance_full (programs[i], 0, "sse"); printf("%g %g\n", perf_mmx, perf_sse); orc_program_free (programs[i]); } free (programs); if (error) return 1; return 0; }
int main (int argc, char *argv[]) { char *code; int n; int i; OrcProgram **programs; const char *filename = NULL; orc_init (); orc_test_init (); if (argc >= 2) { filename = argv[1]; } if (filename == NULL) { filename = getenv ("testfile"); } if (filename == NULL) { filename = "test.orc"; } code = read_file (filename); if (!code) { printf("compile_parse_test <file.orc>\n"); exit(1); } n = orc_parse (code, &programs); for(i=0;i<n;i++){ OrcTestResult ret; printf("%s:\n", programs[i]->name); ret = orc_test_gcc_compile_neon (programs[i]); if (ret == ORC_TEST_FAILED) { error = TRUE; } } if (error) return 1; return 0; }
int main (int argc, char *argv[]) { char *code; int n; int i; OrcProgram **programs; const char *filename = NULL; orc_init (); orc_test_init (); if (argc >= 2) { filename = argv[1]; } if (filename == NULL) { filename = getenv ("testfile"); } if (filename == NULL) { filename = "test.orc"; } code = read_file (filename); if (!code) { printf("exec_parse <file.orc>\n"); exit(1); } n = orc_parse (code, &programs); for(i=0;i<n;i++){ if (verbose) printf("%s\n", programs[i]->name); orc_test_compare_output_full (programs[i], 0); } if (error) return 1; return 0; }
int main (int argc, char *argv[]) { char *code; int n; int i; OrcProgram **programs; const char *filename = NULL; double sum; orc_init (); orc_test_init (); filename = "bench10.orc"; code = read_file (filename); if (!code) { printf("benchmorc needs bench10.orc file in current directory\n"); exit(1); } n = orc_parse (code, &programs); free (code); #if 0 sum = 0; for(i=0;i<n;i++){ double perf; double weight; perf = orc_test_performance_full (programs[i], 0, NULL); if (perf == 0) { weight = 0; } else { weight = 1.0/perf/281.0; sum++; } printf(" %g, /* %s */\n", weight, programs[i]->name); } printf("sum = %g\n", sum); #else sum = 0; for(i=0;i<n;i++){ double perf; double weight; perf = orc_test_performance_full (programs[i], 0, NULL); /* weight = weights_ginger[i]; */ weight = weights_feathers[i]; /* weight = weights_n900[i]; */ sum += weight * perf; orc_program_free (programs[i]); } free (programs); printf("score %g\n", 100.0/sum); #endif if (error) return 1; return 0; }
int main (int argc, char *argv[]) { int i; OrcProgram **programs; const char *filename = NULL; orc_init (); orc_test_init (); for(i=1;i<argc;i++){ if (strcmp(argv[i], "--help") == 0) { printf("Usage:\n"); printf(" orc-bugreport [file.orc]\n"); printf("\n"); printf("Options:\n"); printf(" --help Show help options\n"); printf(" --verbose Increase debugging messages\n"); printf("\n"); printf("Environment Variables:\n"); printf(" ORC_DEBUG=<LEVEL> Set debugging level\n"); printf(" ORC_CODE=[KEYWORDS,...] Modify code generation\n"); printf(" General keywords:\n"); printf(" backup Always use backup function\n"); printf(" debug Generate debuggable code (useful for backtraces on i386)\n"); printf(" SSE keywords:\n"); printf(" -sse2 Disable SSE2\n"); printf(" -sse3 Disable SSE3\n"); printf(" -ssse3 Disable SSEE3\n"); printf(" -sse41 Disable SSE4.1\n"); printf(" -sse42 Disable SSE4.2\n"); printf(" -sse4a Disable SSE4a\n"); printf(" -sse5 Disable SSE5\n"); printf("\n"); exit (0); } filename = argv[i]; } printf("Orc " VERSION " - integrated testing tool\n"); printf("Active backend: %s\n", orc_target_get_name(orc_target_get_default())); { int level1, level2, level3; orc_get_data_cache_sizes(&level1, &level2, &level3); printf("L1 cache: %d\n", level1); printf("L2 cache: %d\n", level2); printf("L3 cache: %d\n", level3); } { int family, model, stepping; orc_get_cpu_family_model_stepping (&family, &model, &stepping); printf("Family/Model/Stepping: %d/%d/%d\n", family, model, stepping); printf("CPU name: %s\n", orc_get_cpu_name ()); } { int i; int flags = orc_target_get_default_flags (orc_target_get_default()); printf("Compiler options: "); for(i=0;i<32;i++){ if (flags & (1<<i)) { printf("%s ", orc_target_get_flag_name (orc_target_get_default(), i)); } } printf("\n"); } if (filename) { int n; int ret; char *code; code = read_file (filename); if (!code) { printf("orc-bugreport: could not read file %s\n", filename); exit(1); } printf("Parsing %s\n", filename); n = orc_parse (code, &programs); for(i=0;i<n;i++){ ret = orc_test_compare_output_full (programs[i], 0); if (!ret) { printf("FAIL: %s\n", programs[i]->name); error = TRUE; } } } else { printf("Opcode test:\n"); test_opcodes(); } if (error) { printf("Errors detected. Please send entire output to [email protected].\n"); return 1; } else { printf("No errors detected.\n"); return 0; } }
int main (int argc, char *argv[]) { char *code; int n = 0; int i; OrcProgram **programs; const char *filename = NULL; orc_init (); orc_test_init (); for(i=1;i<argc;i++){ if (strcmp("-x", argv[i]) == 0) { format = FORMAT_HEX; } else if (strcmp("-s", argv[i]) == 0) { format = FORMAT_SIGNED; } else if (strcmp("-u", argv[i]) == 0) { format = FORMAT_UNSIGNED; } else if (strcmp("-f", argv[i]) == 0) { format = FORMAT_FLOAT; } else if (strcmp("-n", argv[i]) == 0) { if (i + 1 < argc) { array_n = strtol (argv[i+1], NULL, 0); i++; } } else { filename = argv[i]; } } if (filename == NULL) { filename = getenv ("testfile"); } if (filename == NULL) { filename = "test.orc"; } code = read_file (filename); if (code) { n = orc_parse (code, &programs); } else { OrcStaticOpcode *opcode; opcode = orc_opcode_find_by_name (filename); if (opcode) { programs = malloc(sizeof(void *)); programs[0] = orc_test_get_program_for_opcode (opcode); n = 1; } else { printf("show_parse [-fsux] (<file.orc>|opcode)\n"); exit(1); } } for(i=0;i<n;i++){ show (programs[i]); } if (error) return 1; return 0; }