static enum piglit_result draw(Display *dpy) { GLboolean pass = GL_TRUE; int draw_w = piglit_width / 4; int draw_h = piglit_height / 2; int rgb_x = piglit_width / 8; int rgb_y = piglit_height / 4; int rgba_x = piglit_width * 5 / 8; int rgba_y = piglit_height / 4; /* Clear background to gray */ glClearColor(0.5, 0.5, 0.5, 1.0); glClear(GL_COLOR_BUFFER_BIT); draw_pixmap(rgb_pixmap, rgb_x, rgb_y, draw_w, draw_h); draw_pixmap(rgba_pixmap, rgba_x, rgba_y, draw_w, draw_h); pass &= check_results(GL_FALSE, rgb_x, rgb_y, draw_w, draw_h); pass &= check_results(GL_TRUE, rgba_x, rgba_y, draw_w, draw_h); glXSwapBuffers(dpy, win); return pass ? PIGLIT_PASS : PIGLIT_FAIL; }
void check_data(OCI_Connection *con, OCI_DirPath *dp, boolean gen_conv_error, boolean gen_load_error, boolean force) { int nb_rows = 0; OCI_ImmediateFmt(con, "select count(*) from %m", TABLE_NAME, OCI_ARG_INT, &nb_rows); check_results(con, dp, ((gen_conv_error && force) || gen_load_error) ? (NB_TOTAL - NB_ERROR) : NB_TOTAL, nb_rows, "total rows in database"); OCI_ImmediateFmt(con, "select count(distinct val_int) from %m", TABLE_NAME, OCI_ARG_INT, &nb_rows); check_results(con, dp, ((gen_conv_error && force) || gen_load_error) ? (NB_TOTAL - NB_ERROR) : NB_TOTAL, nb_rows, "distinct rows in database"); }
static bool check_crypt (const char *label, const char *fn, const char *retval, const char *setting, bool expected_to_succeed) { #if ENABLE_FAILURE_TOKENS /* crypt/crypt_r never return null when failure tokens are enabled */ if (!retval) { printf ("FAIL: %s/%s/%s: returned NULL\n", label, setting, fn); return false; } #else if (expected_to_succeed && !retval) { printf ("FAIL: %s/%s/%s: returned NULL\n", label, setting, fn); return false; } else if (!expected_to_succeed && retval) { printf ("FAIL: %s/%s/%s: returned %p, should be NULL\n", label, setting, fn, (const void *)retval); return false; } else if (!expected_to_succeed && !retval) return true; #endif if (!check_results (label, fn, retval, setting, expected_to_succeed)) return false; return true; }
static void terminate (int sig) { time_t t; t = time (0) - t0; if (terminal_fd == -1) return; if (tcsetattr (terminal_fd, TCSAFLUSH, &saved_ti) == -1) { perror ("tcgetattr"); exit (-1); } printf ("\n\nTotal characters: %d\n", totalchars); printf ("Elapsed time: %d seconds\n", t); printf ("Characters per minute: %g\n", t > 0?(float) totalchars / (float) t * 60.0:0); printf ("\n"); check_results (); exit (sig); }
void testbench::end_of_simulation() { if (!_checked_results) { SC_REPORT_INFO(name(), "Simulation ran into deadlock"); check_results(); } }
int main(int argc, char **argv) { test_cigar_to_spans(); test_cigar_to_spans2(); test_next_fragment_paired(); test_next_fragment_single(); return check_results(); }
static void testOneCoincident(skiatest::Reporter* reporter, const SkDLine& line1, const SkDLine& line2) { SkASSERT(ValidLine(line1)); SkASSERT(ValidLine(line2)); SkIntersections ts2; int pts2 = ts2.intersect(line1, line2); REPORTER_ASSERT(reporter, pts2 == 2); REPORTER_ASSERT(reporter, pts2 == ts2.used()); check_results(reporter, line1, line2, ts2); #if 0 SkIntersections ts; int pts = ts.intersect(line1, line2); REPORTER_ASSERT(reporter, pts == pts2); REPORTER_ASSERT(reporter, pts == 2); REPORTER_ASSERT(reporter, pts == ts.used()); check_results(reporter, line1, line2, ts); #endif }
int main() { double start, time; float *a, *b, *c, *c_cpu; int i, j, k; /* bytes to be allocated for one matrix */ const size_t nBytes = SIZE * SIZE * sizeof(float); a = (float*)malloc(nBytes); b = (float*)malloc(nBytes); c = (float*)malloc(nBytes); c_cpu = (float*)malloc(nBytes); // Initialize matrices. mm_cpu_initialize(a, b, c); time = gtod(); start = time; /* Run OpenACC versions of the matrix multiplication */ #ifdef _OPENACC mm_oacc_kernel(a, b, c); printf("mm_oacc_kernel(): %lf sec \n", gtod()-time); time = gtod(); mm_oacc_kernel_with_init(a, b, c); printf("mm_oacc_kernel_with_init(): %lf sec \n", gtod()-time); time = gtod(); mm_oacc_parallel_with_init(a, b, c); printf("mm_oacc_parallel_with_init(): %lf sec \n", gtod()-time); #endif /* Initialize the CPU result matrix */ for(i = 0; i < SIZE; ++i) for(j = 0; j < SIZE; ++j) c_cpu[i*SIZE + j] = 0.0f; time = gtod(); /* Perform the matrix multiplication on the CPU */ mm_cpu_compute(a, b, c_cpu); printf("MM on CPU: %lf sec \n", gtod()-time); /* not necessary here, but if the async clause is used make sure OpenACC tasks are finished */ #pragma acc wait printf("Total runtime: %lf sec \n", gtod()-start); check_results(c, c_cpu); return 0; }
int main(int argc, char *argv[]) { // int fdr, fdw; // int nr, nw, donebytes; int *in, *out; int *golden_out; pthread_t tidr, tidw; double start, stop, elapsed_time; // fdr = open("/dev/xillybus_read_32", O_RDONLY); // fdw = open("/dev/xillybus_write_32", O_WRONLY); /* if ((fdr < 0) || (fdw < 0)) { perror("Failed to open Xillybus device file(s)"); exit(1); } */ in = (int *)malloc((2 * N * N) * sizeof(int)); out = (int *)malloc(N * N * sizeof(int)); golden_out = (int *)malloc(N * N * sizeof(int)); gen_mm_inputs(in, in + N * N, N); start = dtime(); // nw = write(fdw, (void *)in, (2 * N * N) * sizeof(int)); // nr = read(fdr, (void *)out, (N * N) * sizeof(int)); pthread_create(&tidw, NULL, thread_write, out); pthread_create(&tidr, NULL, thread_read, in); pthread_join(tidw, NULL); pthread_join(tidr, NULL); stop = dtime(); elapsed_time = stop - start; printf("Write time: %.3lfms\n", elapsed_time); golden_wrapper(in, golden_out); printf("%d\n", check_results(out, golden_out, N)); free(in); free(out); free(golden_out); // close(fdr); // close(fdw); return 0; }
void testbench::wait_for_end() { // If run() has not finished, we do nothing here if (!testbench_ended) return; // check for completed outputs if (output_comp->get_compare_count() < output_capture_count) {testbench_end_event.notify(1,SC_NS); return;} // If we made it here, all outputs have flushed. Check the results SC_REPORT_INFO(name(), "Simulation completed"); check_results(); sc_stop(); }
int main() { srand(time(0)); std::vector <int> vec; for(int i = 0; i < 100; i++) { vec = get_vals(40); // print_vec(vec); int ind = alg(vec, 0, vec.size()-1); std::cout << check_results(vec, ind) << "\n"; } }
static void testOne(skiatest::Reporter* reporter, const SkDLine& line1, const SkDLine& line2) { SkASSERT(ValidLine(line1)); SkASSERT(ValidLine(line2)); SkIntersections i; int pts = i.intersect(line1, line2); REPORTER_ASSERT(reporter, pts); REPORTER_ASSERT(reporter, pts == i.used()); check_results(reporter, line1, line2, i); if (line1[0] == line1[1] || line2[0] == line2[1]) { return; } if (line1[0].fY == line1[1].fY) { double left = SkTMin(line1[0].fX, line1[1].fX); double right = SkTMax(line1[0].fX, line1[1].fX); SkIntersections ts; ts.horizontal(line2, left, right, line1[0].fY, line1[0].fX != left); check_results(reporter, line2, line1, ts); } if (line2[0].fY == line2[1].fY) { double left = SkTMin(line2[0].fX, line2[1].fX); double right = SkTMax(line2[0].fX, line2[1].fX); SkIntersections ts; ts.horizontal(line1, left, right, line2[0].fY, line2[0].fX != left); check_results(reporter, line1, line2, ts); } if (line1[0].fX == line1[1].fX) { double top = SkTMin(line1[0].fY, line1[1].fY); double bottom = SkTMax(line1[0].fY, line1[1].fY); SkIntersections ts; ts.vertical(line2, top, bottom, line1[0].fX, line1[0].fY != top); check_results(reporter, line2, line1, ts); } if (line2[0].fX == line2[1].fX) { double top = SkTMin(line2[0].fY, line2[1].fY); double bottom = SkTMax(line2[0].fY, line2[1].fY); SkIntersections ts; ts.vertical(line1, top, bottom, line2[0].fX, line2[0].fY != top); check_results(reporter, line1, line2, ts); } }
void run_program() { const size_t DATA_SIZE = 1024; auto count = DATA_SIZE; float input_data[DATA_SIZE]; float results[DATA_SIZE]; initialise_input_data(input_data, DATA_SIZE); cl_device_id device_id; auto err = clGetDeviceIDs(NULL, CL_DEVICE_TYPE_GPU, 1, &device_id, NULL); if (err != CL_SUCCESS) { std::cout << "GPU device not available" << std::endl; return; } auto context = clCreateContext(0, 1, &device_id, NULL, NULL, &err); auto commands = clCreateCommandQueue(context, device_id, 0, &err); auto program = clCreateProgramWithSource(context, 1, (const char **) & KernelSource, NULL, &err); err = clBuildProgram(program, 0, NULL, NULL, NULL, NULL); auto kernel = clCreateKernel(program, "square", &err); auto input = clCreateBuffer(context, CL_MEM_READ_ONLY, sizeof(float) * count, NULL, NULL); auto output = clCreateBuffer(context, CL_MEM_WRITE_ONLY, sizeof(float) * count, NULL, NULL); err = clEnqueueWriteBuffer(commands, input, CL_TRUE, 0, sizeof(float) * count, input_data, 0, NULL, NULL); err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &input); err |= clSetKernelArg(kernel, 1, sizeof(cl_mem), &output); err |= clSetKernelArg(kernel, 2, sizeof(unsigned int), &count); auto local = count; err = clGetKernelWorkGroupInfo(kernel, device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(local), &local, NULL); auto global = count; err = clEnqueueNDRangeKernel(commands, kernel, 1, NULL, &global, &local, 0, NULL, NULL); clFinish(commands); err = clEnqueueReadBuffer( commands, output, CL_TRUE, 0, sizeof(float) * count, results, 0, NULL, NULL ); auto correct = check_results(input_data, results, count); printf("Computed '%lu/%lu' correct values!\n", correct, count); clReleaseMemObject(input); clReleaseMemObject(output); clReleaseProgram(program); clReleaseKernel(kernel); clReleaseCommandQueue(commands); clReleaseContext(context); }
int start_tests (Test::Hello_ptr hello, CORBA::ORB_ptr orb) { int result = 0; if (test != 4) { result += run_string_test (hello); result += run_big_request_test (hello); } result += run_big_reply_test (hello); result += check_results (orb); return result; }
/* * run_check_subtest -- * Run the subtest with the given parameters and check the results. */ static void run_check_subtest(TEST_OPTS *opts, const char *debugger, uint64_t nops, bool close_test, uint64_t *nresultsp) { int estatus, narg; char rarg[20], sarg[20], *subtest_args[MAX_ARGS]; narg = 0; if (debugger != NULL) { subtest_args[narg++] = (char *)debugger; subtest_args[narg++] = (char *)"--"; } subtest_args[narg++] = (char *)opts->progname; /* "subtest" must appear before arguments */ if (close_test) subtest_args[narg++] = (char *)"subtest_close"; else subtest_args[narg++] = (char *)"subtest"; subtest_args[narg++] = (char *)"-h"; subtest_args[narg++] = opts->home; subtest_args[narg++] = (char *)"-v"; /* subtest is always verbose */ subtest_args[narg++] = (char *)"-p"; subtest_args[narg++] = (char *)"-o"; testutil_check(__wt_snprintf(sarg, sizeof(sarg), "%" PRIu64, nops)); subtest_args[narg++] = sarg; /* number of operations */ subtest_args[narg++] = (char *)"-n"; testutil_check(__wt_snprintf( rarg, sizeof(rarg), "%" PRIu64, opts->nrecords)); subtest_args[narg++] = rarg; /* number of records */ subtest_args[narg++] = NULL; testutil_assert(narg <= MAX_ARGS); if (opts->verbose) printf("running a separate process with %" PRIu64 " operations until fail...\n", nops); testutil_clean_work_dir(opts->home); testutil_check(run_process( opts, debugger != NULL ? debugger : opts->progname, subtest_args, &estatus)); if (opts->verbose) printf("process exited %d\n", estatus); /* * Verify results in parent process. */ testutil_check(check_results(opts, nresultsp)); }
void test_boolean_expression_with_newlines() { static const token_expected_results_definition definitions[] = { { "this.fred", token_type::TYPE_IDENTIFIER_VARIABLE, 0, 1 }, { "and", token_type::TYPE_OPERATOR, 0, 2 }, { "other.fred", token_type::TYPE_IDENTIFIER_VARIABLE, 0, 3 }, { "||", token_type::TYPE_OPERATOR, 0, 4 }, { "true", token_type::TYPE_BOOL_TRUE, 0, 5 } }; const token_expected_results_definition *definition_p = definitions; const token_expected_results_definition *definition_end = definition_p + (sizeof(definitions)/sizeof(definitions[0])); check_results(make_test_string(definition_p, definition_end, "\n"), definition_p, definition_end); }
void test_arithmetic_expression() { static const token_expected_results_definition definitions[] = { { "this.fred", token_type::TYPE_IDENTIFIER_VARIABLE, 0, 1 }, { "+", token_type::TYPE_OPERATOR, 0, 1 }, { "other.fred", token_type::TYPE_IDENTIFIER_VARIABLE, 0, 1 }, { "*", token_type::TYPE_OPERATOR, 0, 1 }, { "22", token_type::TYPE_INT, 0, 1 } }; const token_expected_results_definition *definition_p = definitions; const token_expected_results_definition *definition_end = definition_p + (sizeof(definitions)/sizeof(definitions[0])); check_results(make_test_string(definition_p, definition_end, ""), definition_p, definition_end); }
int main(void) { mcapi_endpoint_t recv_endpt; mcapi_endpoint_t send_endpt; mca_status_t status; int rc; mcapi_param_t parms; mcapi_info_t version; mcapi_set_debug_level(6); /* create a node */ mcapi_initialize(DOMAIN,NODE,NULL,&parms,&version,&status); if (status != MCAPI_SUCCESS) { fprintf(stderr,"\nERROR: Failed to initialize: %s\n",mcapi_display_status(status,status_buff,sizeof(status_buff))); return fail; } /* create the endpoints */ send_endpt = mcapi_endpoint_create(1,&status); recv_endpt = mcapi_endpoint_create(2,&status); sender(send_endpt,recv_endpt,0,NUM_MSGS-1); receiver(recv_endpt,0,NUM_MSGS-1); receiver(recv_endpt,NUM_MSGS,(NUM_MSGS*2)-1); sender(send_endpt,recv_endpt,NUM_MSGS,(NUM_MSGS*2)-1); rc = check_results(); mcapi_finalize(&status); if (status != MCAPI_SUCCESS) { fprintf(stderr,"\nERROR: Failed to finalize: %s\n",mcapi_display_status(status,status_buff,sizeof(status_buff))); return fail; } if (rc == 0) { printf(" Test PASSED\n"); } else { printf(" Test FAILED\n"); } return rc; }
void test_parentheses() { static const token_expected_results_definition definitions[] = { { "(", token_type::TYPE_OPEN_PAREN, 0, 1 }, { "(", token_type::TYPE_OPEN_PAREN, 0, 1 }, { "(", token_type::TYPE_OPEN_PAREN, 0, 1 }, { ")", token_type::TYPE_CLOSE_PAREN, 0, 1 }, { "(", token_type::TYPE_OPEN_PAREN, 0, 1 }, { ")", token_type::TYPE_CLOSE_PAREN, 0, 1 }, { ")", token_type::TYPE_CLOSE_PAREN, 0, 1 }, { ")", token_type::TYPE_CLOSE_PAREN, 0, 1 } }; const token_expected_results_definition *definition_p = definitions; const token_expected_results_definition *definition_end = definition_p + (sizeof(definitions)/sizeof(definitions[0])); check_results(make_test_string(definition_p, definition_end, ""), definition_p, definition_end); }
// A wrapper function to send a query and print the output onto stderr // int sendquery(val_context_t * context, const char *desc, char * name, int class_h, int type_h, u_int32_t flags, const int *result_ar, int trusted_only, struct val_response *resp) { int ret_val; struct val_result_chain *results = NULL; int err = 0; struct timeval start; if ((NULL == desc) || (NULL == name) || (NULL == result_ar) || (resp == NULL)) return -1; fprintf(stderr, "%s: ****START**** \n", desc); gettimeofday(&start, NULL); ret_val = val_resolve_and_check(context, name, class_h, type_h, flags, &results); if (ret_val == VAL_NO_ERROR) { ret_val = compose_answer(name, type_h, class_h, results, resp); if (result_ar) err = check_results(context, desc, name, class_h, type_h, result_ar, results, trusted_only, &start); val_free_result_chain(results); } else { fprintf(stderr, "%s: \t", desc); fprintf(stderr, "FAILED: Error in val_resolve_and_check(): %s\n", p_val_err(ret_val)); } results = NULL; return (err != 0); /* 0 success, 1 error */ }
static bool check_crypt_rn (const char *label, const char *fn, const char *retval, const char *output, const char *setting, bool expected_to_succeed) { bool ok = true; if (expected_to_succeed) { if (!retval) { printf ("FAIL: %s/%s/%s: returned NULL\n", label, setting, fn); ok = false; } else if (retval != output) { printf ("FAIL: %s/%s/%s: returned %p but output is %p\n", label, setting, fn, (const void *)retval, (const void *)output); ok = false; } } else { if (retval) { printf ("FAIL: %s/%s/%s: returned %p (output is %p), " "should be NULL\n", label, setting, fn, (const void *)retval, (const void *)output); ok = false; } } if (!check_results (label, fn, output, setting, expected_to_succeed)) ok = false; return ok; }
int main(void) { t_info info; int found; init_info(&info); get_player(&info); while (1) { if (info.turns % info.pnum == 0) { get_input(&info); get_available_coords(&info); found = place_token(&info); if (check_results(&info, found) == 0) return (0); if (info.turns == 0) set_opp_xy(&info); cleanup(&info); } info.turns++; } return (0); }
int32_t main(void) { char *instruction_name = "NLOC.B"; int32_t ret; uint32_t i; struct timeval start, end; double elapsed_time; uint64_t b128_result[TEST_COUNT_TOTAL][2]; uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { { 0x0808080808080808ULL, 0x0808080808080808ULL, }, /* 0 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0101010101010101ULL, 0x0101010101010101ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0202020202020202ULL, 0x0202020202020202ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0301000301000301ULL, 0x0003010003010003ULL, }, { 0x0000020000020000ULL, 0x0200000200000200ULL, }, { 0x0404040404040404ULL, 0x0404040404040404ULL, }, /* 8 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0500000103050000ULL, 0x0103050000010305ULL, }, { 0x0002040000000204ULL, 0x0000000204000000ULL, }, { 0x0600020600020600ULL, 0x0206000206000206ULL, }, { 0x0004000004000004ULL, 0x0000040000040000ULL, }, { 0x0700050003000107ULL, 0x0005000300010700ULL, }, { 0x0006000400020000ULL, 0x0600040002000006ULL, }, { 0x0800080008000800ULL, 0x0800080008000800ULL, }, /* 16 */ { 0x0008000800080008ULL, 0x0008000800080008ULL, }, { 0x0801000300050007ULL, 0x0008010003000500ULL, }, { 0x0000020004000600ULL, 0x0800000200040006ULL, }, { 0x0802000600080200ULL, 0x0600080200060008ULL, }, { 0x0000040008000004ULL, 0x0008000004000800ULL, }, { 0x0803000801000700ULL, 0x0005000803000801ULL, }, { 0x0000060000040008ULL, 0x0200080000060000ULL, }, { 0x0804000804000804ULL, 0x0008040008040008ULL, }, /* 24 */ { 0x0000080000080000ULL, 0x0800000800000800ULL, }, { 0x0805000007000008ULL, 0x0100080300080500ULL, }, { 0x0000080200080400ULL, 0x0006000008000008ULL, }, { 0x0806000008020008ULL, 0x0600000802000806ULL, }, { 0x0000080400000800ULL, 0x0008040000080000ULL, }, { 0x0807000008050000ULL, 0x0803000008010008ULL, }, { 0x0000080600000804ULL, 0x0000080200000800ULL, }, { 0x0808000008080000ULL, 0x0808000008080000ULL, }, /* 32 */ { 0x0000080800000808ULL, 0x0000080800000808ULL, }, { 0x0808010000080300ULL, 0x0008050000080700ULL, }, { 0x0000000802000008ULL, 0x0400000806000008ULL, }, { 0x0808020000080600ULL, 0x0008080200000806ULL, }, { 0x0000000804000008ULL, 0x0800000008040000ULL, }, { 0x0808030000080801ULL, 0x0000080700000008ULL, }, { 0x0000000806000000ULL, 0x0804000008080200ULL, }, { 0x0808040000080804ULL, 0x0000080804000008ULL, }, /* 40 */ { 0x0000000808000000ULL, 0x0808000000080800ULL, }, { 0x0808050000000807ULL, 0x0000000808010000ULL, }, { 0x0000000808020000ULL, 0x0808040000000806ULL, }, { 0x0808060000000808ULL, 0x0200000808060000ULL, }, { 0x0000000808040000ULL, 0x0008080000000808ULL, }, { 0x0808070000000808ULL, 0x0500000008080300ULL, }, { 0x0000000808060000ULL, 0x0008080400000008ULL, }, { 0x0808080000000808ULL, 0x0800000008080800ULL, }, /* 48 */ { 0x0000000808080000ULL, 0x0008080800000008ULL, }, { 0x0808080100000008ULL, 0x0803000000080805ULL, }, { 0x0000000008080200ULL, 0x0000080804000000ULL, }, { 0x0808080200000008ULL, 0x0806000000080808ULL, }, { 0x0000000008080400ULL, 0x0000080808000000ULL, }, { 0x0808080300000008ULL, 0x0808010000000808ULL, }, { 0x0000000008080600ULL, 0x0000000808040000ULL, }, { 0x0808080400000008ULL, 0x0808040000000808ULL, }, /* 56 */ { 0x0000000008080800ULL, 0x0000000808080000ULL, }, { 0x0808080500000000ULL, 0x0808070000000008ULL, }, { 0x0000000008080802ULL, 0x0000000808080400ULL, }, { 0x0808080600000000ULL, 0x0808080200000008ULL, }, { 0x0000000008080804ULL, 0x0000000008080800ULL, }, { 0x0808080700000000ULL, 0x0808080500000000ULL, }, { 0x0000000008080806ULL, 0x0000000008080804ULL, }, { 0x0100030200000000ULL, 0x0000000007000100ULL, }, /* 64 */ { 0x0501000000010200ULL, 0x0004010000000006ULL, }, { 0x0100010101020101ULL, 0x0002020801000000ULL, }, { 0x0000000000000300ULL, 0x0104010201000301ULL, }, { 0x0101000000010000ULL, 0x0100000102020001ULL, }, { 0x0200010108000005ULL, 0x0000000007010000ULL, }, { 0x0100000000020100ULL, 0x0100000001040100ULL, }, { 0x0601000401010101ULL, 0x0106000000000001ULL, }, { 0x0000000200010300ULL, 0x0300030001010000ULL, }, /* 72 */ { 0x0100020000020302ULL, 0x0100010101030100ULL, }, { 0x0103040402020200ULL, 0x0102000000000000ULL, }, { 0x0101040400010001ULL, 0x0201030000010103ULL, }, { 0x0300000301000300ULL, 0x0100010200000200ULL, }, { 0x0100000600000001ULL, 0x0401000100000000ULL, }, { 0x0000000000010401ULL, 0x0300010402000000ULL, }, { 0x0100010104000201ULL, 0x0200020200000003ULL, }, }; gettimeofday(&start, NULL); for (i = 0; i < TEST_COUNT_TOTAL; i++) { if (i < PATTERN_INPUTS_COUNT) { do_msa_NLOC_B(b128_pattern[i], b128_result[i]); } else { do_msa_NLOC_B(b128_random[i - PATTERN_INPUTS_COUNT], b128_result[i]); } } gettimeofday(&end, NULL); elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, &b128_result[0][0], &b128_expect[0][0]); return ret; }
int32_t main(void) { char *instruction_name = "MAX_S.D"; int32_t ret; uint32_t i, j; struct timeval start, end; double elapsed_time; uint64_t b128_result[TEST_COUNT_TOTAL][2]; uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0xffffffffffffffffULL, 0x38e38e38e38e38e3ULL, }, { 0x1c71c71c71c71c71ULL, 0xffffffffffffffffULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0x0000000000000000ULL, 0x38e38e38e38e38e3ULL, }, { 0x1c71c71c71c71c71ULL, 0x0000000000000000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, /* 24 */ { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, { 0x1c71c71c71c71c71ULL, 0xccccccccccccccccULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, /* 40 */ { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0x3333333333333333ULL, 0x38e38e38e38e38e3ULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0xffffffffffffffffULL, 0x38e38e38e38e38e3ULL, }, /* 48 */ { 0x0000000000000000ULL, 0x38e38e38e38e38e3ULL, }, { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, { 0x3333333333333333ULL, 0x38e38e38e38e38e3ULL, }, { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, { 0x1c71c71c71c71c71ULL, 0x38e38e38e38e38e3ULL, }, { 0x1c71c71c71c71c71ULL, 0xffffffffffffffffULL, }, /* 56 */ { 0x1c71c71c71c71c71ULL, 0x0000000000000000ULL, }, { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x1c71c71c71c71c71ULL, 0xccccccccccccccccULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0x1c71c71c71c71c71ULL, 0x38e38e38e38e38e3ULL, }, { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ { 0xfbbe00634d93c708ULL, 0x4b670b5efe7bb00cULL, }, { 0xac5aaeaab9cf8b80ULL, 0x4b670b5efe7bb00cULL, }, { 0x704f164d5e31e24eULL, 0x4b670b5efe7bb00cULL, }, { 0xfbbe00634d93c708ULL, 0x4b670b5efe7bb00cULL, }, { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, { 0xfbbe00634d93c708ULL, 0x27d8c6ffab2b2514ULL, }, { 0x704f164d5e31e24eULL, 0x12f7bb1a153f52fcULL, }, { 0xac5aaeaab9cf8b80ULL, 0x4b670b5efe7bb00cULL, }, /* 72 */ { 0xfbbe00634d93c708ULL, 0x27d8c6ffab2b2514ULL, }, { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, { 0x704f164d5e31e24eULL, 0x27d8c6ffab2b2514ULL, }, { 0x704f164d5e31e24eULL, 0x4b670b5efe7bb00cULL, }, { 0x704f164d5e31e24eULL, 0x12f7bb1a153f52fcULL, }, { 0x704f164d5e31e24eULL, 0x27d8c6ffab2b2514ULL, }, { 0x704f164d5e31e24eULL, 0x8df188d8a942e2a0ULL, }, }; gettimeofday(&start, NULL); for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { do_msa_MAX_S_D(b128_pattern[i], b128_pattern[j], b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); } } for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { do_msa_MAX_S_D(b128_random[i], b128_random[j], b128_result[((PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT)) + RANDOM_INPUTS_SHORT_COUNT * i + j]); } } gettimeofday(&end, NULL); elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, &b128_result[0][0], &b128_expect[0][0]); return ret; }
int32_t main(void) { char *instruction_name = "NLZC.W"; int32_t ret; uint32_t i; struct timeval start, end; double elapsed_time; uint64_t b128_result[TEST_COUNT_TOTAL][2]; uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ { 0x0000002000000020ULL, 0x0000002000000020ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000100000001ULL, 0x0000000100000001ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000200000002ULL, 0x0000000200000002ULL, }, { 0x0000000000000000ULL, 0x0000000200000000ULL, }, { 0x0000000300000001ULL, 0x0000000000000003ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ { 0x0000000400000004ULL, 0x0000000400000004ULL, }, { 0x0000000000000000ULL, 0x0000000000000004ULL, }, { 0x0000000500000003ULL, 0x0000000100000000ULL, }, { 0x0000000000000004ULL, 0x0000000000000000ULL, }, { 0x0000000600000000ULL, 0x0000000200000006ULL, }, { 0x0000000000000000ULL, 0x0000000600000002ULL, }, { 0x0000000700000003ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 16 */ { 0x0000000800000008ULL, 0x0000000800000008ULL, }, { 0x0000000000000004ULL, 0x0000000800000000ULL, }, { 0x0000000900000000ULL, 0x0000000000000003ULL, }, { 0x0000000000000008ULL, 0x0000000000000004ULL, }, { 0x0000000a00000000ULL, 0x0000000600000000ULL, }, { 0x0000000000000000ULL, 0x0000000200000000ULL, }, { 0x0000000b00000001ULL, 0x0000000000000003ULL, }, { 0x0000000000000000ULL, 0x0000000800000000ULL, }, /* 24 */ { 0x0000000c00000004ULL, 0x000000000000000cULL, }, { 0x0000000000000000ULL, 0x0000000000000008ULL, }, { 0x0000000d00000007ULL, 0x0000000100000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000e0000000aULL, 0x0000000600000002ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000f0000000dULL, 0x0000000b00000009ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 32 */ { 0x0000001000000010ULL, 0x0000001000000010ULL, }, { 0x0000000000000002ULL, 0x0000000400000006ULL, }, { 0x0000001100000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000004ULL, 0x000000080000000cULL, }, { 0x0000001200000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000006ULL, 0x0000000c00000012ULL, }, { 0x0000001300000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000008ULL, 0x0000001000000000ULL, }, /* 40 */ { 0x0000001400000000ULL, 0x0000000000000004ULL, }, { 0x000000000000000aULL, 0x0000001400000000ULL, }, { 0x0000001500000000ULL, 0x0000000000000009ULL, }, { 0x000000000000000cULL, 0x0000000000000000ULL, }, { 0x0000001600000000ULL, 0x000000020000000eULL, }, { 0x000000000000000eULL, 0x0000000000000000ULL, }, { 0x0000001700000000ULL, 0x0000000500000013ULL, }, { 0x0000000000000010ULL, 0x0000000000000000ULL, }, /* 48 */ { 0x0000001800000000ULL, 0x0000000800000018ULL, }, { 0x0000000000000012ULL, 0x0000000000000004ULL, }, { 0x0000001900000000ULL, 0x0000000b00000000ULL, }, { 0x0000000000000014ULL, 0x0000000000000008ULL, }, { 0x0000001a00000000ULL, 0x0000000e00000000ULL, }, { 0x0000000000000016ULL, 0x000000000000000cULL, }, { 0x0000001b00000000ULL, 0x0000001100000000ULL, }, { 0x0000000000000018ULL, 0x0000000000000010ULL, }, /* 56 */ { 0x0000001c00000000ULL, 0x0000001400000000ULL, }, { 0x000000000000001aULL, 0x0000000000000014ULL, }, { 0x0000001d00000000ULL, 0x0000001700000000ULL, }, { 0x000000000000001cULL, 0x0000000000000018ULL, }, { 0x0000001e00000000ULL, 0x0000001a00000000ULL, }, { 0x000000000000001eULL, 0x000000000000001cULL, }, { 0x0000001f00000000ULL, 0x0000001d00000000ULL, }, { 0x0000000000000002ULL, 0x0000000100000000ULL, }, /* 64 */ { 0x0000000000000001ULL, 0x0000000300000003ULL, }, { 0x0000000000000000ULL, 0x0000000200000000ULL, }, { 0x0000000100000001ULL, 0x0000000000000000ULL, }, { 0x0000000000000001ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000300000000ULL, }, { 0x0000000000000001ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000003ULL, }, { 0x0000000200000001ULL, 0x0000000000000000ULL, }, /* 72 */ { 0x0000000000000001ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000001ULL, }, { 0x0000000000000002ULL, 0x0000000000000001ULL, }, { 0x0000000000000000ULL, 0x0000000000000001ULL, }, { 0x0000000000000003ULL, 0x0000000000000001ULL, }, { 0x0000000100000002ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000001ULL, }, }; gettimeofday(&start, NULL); for (i = 0; i < TEST_COUNT_TOTAL; i++) { if (i < PATTERN_INPUTS_COUNT) { do_msa_NLZC_W(b128_pattern[i], b128_result[i]); } else { do_msa_NLZC_W(b128_random[i - PATTERN_INPUTS_COUNT], b128_result[i]); } } gettimeofday(&end, NULL); elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, &b128_result[0][0], &b128_expect[0][0]); return ret; }
int32_t main(void) { char *instruction_name = "MULV.B"; int32_t ret; uint32_t i, j; struct timeval start, end; double elapsed_time; uint64_t b128_result[TEST_COUNT_TOTAL][2]; uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { { 0x0101010101010101ULL, 0x0101010101010101ULL, }, /* 0 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x5656565656565656ULL, 0x5656565656565656ULL, }, { 0xababababababababULL, 0xababababababababULL, }, { 0x3434343434343434ULL, 0x3434343434343434ULL, }, { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, }, { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 8 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x5656565656565656ULL, 0x5656565656565656ULL, }, /* 16 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xe4e4e4e4e4e4e4e4ULL, 0xe4e4e4e4e4e4e4e4ULL, }, { 0x7272727272727272ULL, 0x7272727272727272ULL, }, { 0x7878787878787878ULL, 0x7878787878787878ULL, }, { 0xdedededededededeULL, 0xdedededededededeULL, }, { 0xbe4c30be4c30be4cULL, 0x30be4c30be4c30beULL, }, { 0x980a26980a26980aULL, 0x26980a26980a2698ULL, }, { 0xababababababababULL, 0xababababababababULL, }, /* 24 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x7272727272727272ULL, 0x7272727272727272ULL, }, { 0x3939393939393939ULL, 0x3939393939393939ULL, }, { 0xbcbcbcbcbcbcbcbcULL, 0xbcbcbcbcbcbcbcbcULL, }, { 0xefefefefefefefefULL, 0xefefefefefefefefULL, }, { 0x5f26985f26985f26ULL, 0x985f26985f26985fULL, }, { 0x4c85134c85134c85ULL, 0x134c85134c85134cULL, }, { 0x3434343434343434ULL, 0x3434343434343434ULL, }, /* 32 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x7878787878787878ULL, 0x7878787878787878ULL, }, { 0xbcbcbcbcbcbcbcbcULL, 0xbcbcbcbcbcbcbcbcULL, }, { 0x9090909090909090ULL, 0x9090909090909090ULL, }, { 0xa4a4a4a4a4a4a4a4ULL, 0xa4a4a4a4a4a4a4a4ULL, }, { 0xe428a0e428a0e428ULL, 0xa0e428a0e428a0e4ULL, }, { 0x500c94500c94500cULL, 0x94500c94500c9450ULL, }, { 0xcdcdcdcdcdcdcdcdULL, 0xcdcdcdcdcdcdcdcdULL, }, /* 40 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xdedededededededeULL, 0xdedededededededeULL, }, { 0xefefefefefefefefULL, 0xefefefefefefefefULL, }, { 0xa4a4a4a4a4a4a4a4ULL, 0xa4a4a4a4a4a4a4a4ULL, }, { 0x2929292929292929ULL, 0x2929292929292929ULL, }, { 0x394a28394a28394aULL, 0x28394a28394a2839ULL, }, { 0x9483a59483a59483ULL, 0xa59483a59483a594ULL, }, { 0x1d72c81d72c81d72ULL, 0xc81d72c81d72c81dULL, }, /* 48 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xbe4c30be4c30be4cULL, 0x30be4c30be4c30beULL, }, { 0x5f26985f26985f26ULL, 0x985f26985f26985fULL, }, { 0xe428a0e428a0e428ULL, 0xa0e428a0e428a0e4ULL, }, { 0x394a28394a28394aULL, 0x28394a28394a2839ULL, }, { 0x49c44049c44049c4ULL, 0x4049c44049c44049ULL, }, { 0xd4ae88d4ae88d4aeULL, 0x88d4ae88d4ae88d4ULL, }, { 0xe48f39e48f39e48fULL, 0x39e48f39e48f39e4ULL, }, /* 56 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x980a26980a26980aULL, 0x26980a26980a2698ULL, }, { 0x4c85134c85134c85ULL, 0x134c85134c85134cULL, }, { 0x500c94500c94500cULL, 0x94500c94500c9450ULL, }, { 0x9483a59483a59483ULL, 0xa59483a59483a594ULL, }, { 0xd4ae88d4ae88d4aeULL, 0x88d4ae88d4ae88d4ULL, }, { 0x10e1b110e1b110e1ULL, 0xb110e1b110e1b110ULL, }, { 0x40e4a49040843900ULL, 0xf971798404190090ULL, }, /* 64 */ { 0x58ac00e408461300ULL, 0x4661098cd64560d0ULL, }, { 0x60445478e83e2700ULL, 0x6de882a2aaa970f0ULL, }, { 0x80b6c45cb0c20a80ULL, 0x4ff7d850aeb66080ULL, }, { 0x58ac00e408461300ULL, 0x4661098cd64560d0ULL, }, { 0x190400492969b140ULL, 0x445199a4b9814410ULL, }, { 0xa4cc00bea5dd0d00ULL, 0xbe68a2e60795dab0ULL, }, { 0xd0a200c74623ae70ULL, 0xea8758f0dd3e6480ULL, }, { 0x60445478e83e2700ULL, 0x6de882a2aaa970f0ULL, }, /* 72 */ { 0xa4cc00bea5dd0d00ULL, 0xbe68a2e60795dab0ULL, }, { 0x90a444e4b1617900ULL, 0xf140240139395990ULL, }, { 0x40c6f422ee9fb600ULL, 0x7b583028e316aa80ULL, }, { 0x80b6c45cb0c20a80ULL, 0x4ff7d850aeb66080ULL, }, { 0xd0a200c74623ae70ULL, 0xea8758f0dd3e6480ULL, }, }; gettimeofday(&start, NULL); for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { do_msa_MULV_B(b128_pattern[i], b128_pattern[j], b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); } } for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { do_msa_MULV_B(b128_random[i], b128_random[j], b128_result[((PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT)) + RANDOM_INPUTS_SHORT_COUNT * i + j]); } } gettimeofday(&end, NULL); elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, &b128_result[0][0], &b128_expect[0][0]); return ret; }
void test_all_legal_tokens() { static const token_expected_results_definition definitions[] = { { "\"plain string\"", token_type::TYPE_STRING, "plain string", 1}, { "\"this is a \\\"string\\\" with a \\\\ in it\"", token_type::TYPE_STRING, "this is a \"string\" with a \\ in it", 1 }, { "\"\\1\"", token_type::TYPE_STRING, "\\1", 1 }, { "this.fred", token_type::TYPE_IDENTIFIER_VARIABLE, 0, 1 }, { "other.fred", token_type::TYPE_IDENTIFIER_VARIABLE, 0, 1 }, { "fred", token_type::TYPE_IDENTIFIER_VARIABLE, 0, 1 }, { "fred_with_underscores", token_type::TYPE_IDENTIFIER_VARIABLE, 0, 1 }, { "_fred_with_leading_underscore", token_type::TYPE_IDENTIFIER_VARIABLE, 0, 1 }, { "0", token_type::TYPE_INT, 0, 1 }, { "1", token_type::TYPE_INT, 0, 1 }, { "01234567890", token_type::TYPE_INT, 0, 1 }, { "0U", token_type::TYPE_UINT, "0", 1 }, { "1U", token_type::TYPE_UINT, "1", 1 }, { "01234567890U", token_type::TYPE_UINT, "01234567890", 1 }, { "0.0", token_type::TYPE_DOUBLE, "0.0", 1 }, { "1.0", token_type::TYPE_DOUBLE, "1.0", 1 }, { "1.0E+4", token_type::TYPE_DOUBLE, "1.0E+4", 1 }, { "true", token_type::TYPE_BOOL_TRUE, 0, 1 }, { "false", token_type::TYPE_BOOL_FALSE, 0, 1 }, { "(", token_type::TYPE_OPEN_PAREN, 0, 1 }, { ")", token_type::TYPE_CLOSE_PAREN, 0, 1 }, { ",", token_type::TYPE_COMMA, 0, 1 }, { ";", token_type::TYPE_SEMICOLON, 0, 1 }, { "=", token_type::TYPE_OPERATOR, 0, 1 }, { "!=", token_type::TYPE_OPERATOR, 0, 1 }, { ">", token_type::TYPE_OPERATOR, 0, 1 }, { "<", token_type::TYPE_OPERATOR, 0, 1 }, { "<=", token_type::TYPE_OPERATOR, 0, 1 }, { ">=", token_type::TYPE_OPERATOR, 0, 1 }, { "+", token_type::TYPE_OPERATOR, 0, 1 }, { "-", token_type::TYPE_OPERATOR, 0, 1 }, { "*", token_type::TYPE_OPERATOR, 0, 1 }, { "/", token_type::TYPE_OPERATOR, 0, 1 }, { "%", token_type::TYPE_OPERATOR, 0, 1 }, { "mod", token_type::TYPE_OPERATOR, 0, 1 }, { "&&", token_type::TYPE_OPERATOR, 0, 1 }, { "and", token_type::TYPE_OPERATOR, 0, 1 }, { "||", token_type::TYPE_OPERATOR, 0, 1 }, { "or", token_type::TYPE_OPERATOR, 0, 1 }, { "!", token_type::TYPE_OPERATOR, 0, 1 }, { "not", token_type::TYPE_OPERATOR, 0, 1 }, { "&", token_type::TYPE_OPERATOR, 0, 1 }, { "|", token_type::TYPE_OPERATOR, 0, 1 }, { "~", token_type::TYPE_OPERATOR, 0, 1 } }; const token_expected_results_definition *definition_p = definitions; const token_expected_results_definition *definition_end = definition_p + (sizeof(definitions)/sizeof(definitions[0])); check_results(make_test_string(definition_p, definition_end, " "), definition_p, definition_end); }
int32_t main(void) { char *instruction_name = "AVE_U.W"; int32_t ret; uint32_t i, j; struct timeval start, end; double elapsed_time; uint64_t b128_result[TEST_COUNT_TOTAL][2]; uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 0 */ { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, { 0xd5555554d5555554ULL, 0xd5555554d5555554ULL, }, { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, { 0xe6666665e6666665ULL, 0xe6666665e6666665ULL, }, { 0x9999999999999999ULL, 0x9999999999999999ULL, }, { 0xf1c71c71c71c71c6ULL, 0x9c71c71bf1c71c71ULL, }, { 0x8e38e38db8e38e38ULL, 0xe38e38e38e38e38dULL, }, { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, /* 8 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x2aaaaaaa2aaaaaaaULL, 0x2aaaaaaa2aaaaaaaULL, }, { 0x6666666666666666ULL, 0x6666666666666666ULL, }, { 0x1999999919999999ULL, 0x1999999919999999ULL, }, { 0x71c71c71471c71c7ULL, 0x1c71c71c71c71c71ULL, }, { 0x0e38e38e38e38e38ULL, 0x638e38e30e38e38eULL, }, { 0xd5555554d5555554ULL, 0xd5555554d5555554ULL, }, /* 16 */ { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, { 0x6eeeeeee6eeeeeeeULL, 0x6eeeeeee6eeeeeeeULL, }, { 0xc71c71c69c71c71cULL, 0x71c71c71c71c71c6ULL, }, { 0x638e38e38e38e38dULL, 0xb8e38e38638e38e3ULL, }, { 0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL, }, /* 24 */ { 0x2aaaaaaa2aaaaaaaULL, 0x2aaaaaaa2aaaaaaaULL, }, { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, { 0x5555555555555555ULL, 0x5555555555555555ULL, }, { 0x9111111091111110ULL, 0x9111111091111110ULL, }, { 0x4444444444444444ULL, 0x4444444444444444ULL, }, { 0x9c71c71c71c71c71ULL, 0x471c71c69c71c71cULL, }, { 0x38e38e38638e38e3ULL, 0x8e38e38e38e38e38ULL, }, { 0xe6666665e6666665ULL, 0xe6666665e6666665ULL, }, /* 32 */ { 0x6666666666666666ULL, 0x6666666666666666ULL, }, { 0xbbbbbbbbbbbbbbbbULL, 0xbbbbbbbbbbbbbbbbULL, }, { 0x9111111091111110ULL, 0x9111111091111110ULL, }, { 0xccccccccccccccccULL, 0xccccccccccccccccULL, }, { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, { 0xd82d82d7ad82d82dULL, 0x82d82d82d82d82d7ULL, }, { 0x749f49f49f49f49eULL, 0xc9f49f49749f49f4ULL, }, { 0x9999999999999999ULL, 0x9999999999999999ULL, }, /* 40 */ { 0x1999999919999999ULL, 0x1999999919999999ULL, }, { 0x6eeeeeee6eeeeeeeULL, 0x6eeeeeee6eeeeeeeULL, }, { 0x4444444444444444ULL, 0x4444444444444444ULL, }, { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, { 0x3333333333333333ULL, 0x3333333333333333ULL, }, { 0x8b60b60b60b60b60ULL, 0x360b60b58b60b60bULL, }, { 0x27d27d27527d27d2ULL, 0x7d27d27d27d27d27ULL, }, { 0xf1c71c71c71c71c6ULL, 0x9c71c71bf1c71c71ULL, }, /* 48 */ { 0x71c71c71471c71c7ULL, 0x1c71c71c71c71c71ULL, }, { 0xc71c71c69c71c71cULL, 0x71c71c71c71c71c6ULL, }, { 0x9c71c71c71c71c71ULL, 0x471c71c69c71c71cULL, }, { 0xd82d82d7ad82d82dULL, 0x82d82d82d82d82d7ULL, }, { 0x8b60b60b60b60b60ULL, 0x360b60b58b60b60bULL, }, { 0xe38e38e38e38e38eULL, 0x38e38e38e38e38e3ULL, }, { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, { 0x8e38e38db8e38e38ULL, 0xe38e38e38e38e38dULL, }, /* 56 */ { 0x0e38e38e38e38e38ULL, 0x638e38e30e38e38eULL, }, { 0x638e38e38e38e38dULL, 0xb8e38e38638e38e3ULL, }, { 0x38e38e38638e38e3ULL, 0x8e38e38e38e38e38ULL, }, { 0x749f49f49f49f49eULL, 0xc9f49f49749f49f4ULL, }, { 0x27d27d27527d27d2ULL, 0x7d27d27d27d27d27ULL, }, { 0x7fffffff7fffffffULL, 0x7fffffff7fffffffULL, }, { 0x1c71c71c71c71c71ULL, 0xc71c71c71c71c71cULL, }, { 0x886ae6cc28625540ULL, 0x4b670b5efe7bb00cULL, }, /* 64 */ { 0xc21473973afb0e24ULL, 0x2f2f633c89dd8184ULL, }, { 0x9a62cabb7118f060ULL, 0x399fe92ed4d36a90ULL, }, { 0x7c5cfe8c434a1bc7ULL, 0x6cac4a1bd3df4956ULL, }, { 0xc21473973afb0e24ULL, 0x2f2f633c89dd8184ULL, }, { 0xfbbe00634d93c708ULL, 0x12f7bb1a153f52fcULL, }, { 0xd40c578683b1a944ULL, 0x1d68410c60353c08ULL, }, { 0xb6068b5855e2d4abULL, 0x5074a1f95f411aceULL, }, { 0x9a62cabb7118f060ULL, 0x399fe92ed4d36a90ULL, }, /* 72 */ { 0xd40c578683b1a944ULL, 0x1d68410c60353c08ULL, }, { 0xac5aaeaab9cf8b80ULL, 0x27d8c6ffab2b2514ULL, }, { 0x8e54e27b8c00b6e7ULL, 0x5ae527ebaa3703daULL, }, { 0x7c5cfe8c434a1bc7ULL, 0x6cac4a1bd3df4956ULL, }, { 0xb6068b5855e2d4abULL, 0x5074a1f95f411aceULL, }, }; gettimeofday(&start, NULL); for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { do_msa_AVE_U_W(b128_pattern[i], b128_pattern[j], b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); } } for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { do_msa_AVE_U_W(b128_random[i], b128_random[j], b128_result[((PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT)) + RANDOM_INPUTS_SHORT_COUNT * i + j]); } } gettimeofday(&end, NULL); elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, &b128_result[0][0], &b128_expect[0][0]); return ret; }
int32_t main(void) { char *instruction_name = "CLT_U.H"; int32_t ret; uint32_t i, j; struct timeval start, end; double elapsed_time; uint64_t b128_result[TEST_COUNT_TOTAL][2]; uint64_t b128_expect[TEST_COUNT_TOTAL][2] = { { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 0 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 8 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 16 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffff00000000ffffULL, 0x00000000ffff0000ULL, }, { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 24 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, }, { 0x0000ffffffff0000ULL, 0xffffffff0000ffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 32 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffff00000000ffffULL, 0x00000000ffff0000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 40 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0x0000ffffffff0000ULL, 0xffffffff0000ffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 48 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000ffffffff0000ULL, 0xffffffff0000ffffULL, }, { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, }, { 0x0000ffffffff0000ULL, 0xffffffff0000ffffULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000ffff00000000ULL, 0xffff00000000ffffULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, /* 56 */ { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, }, { 0xffff00000000ffffULL, 0x00000000ffff0000ULL, }, { 0xffffffffffffffffULL, 0xffffffffffffffffULL, }, { 0xffff00000000ffffULL, 0x00000000ffff0000ULL, }, { 0xffff0000ffffffffULL, 0x0000ffffffff0000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, /* 64 */ { 0xffff0000ffffffffULL, 0x0000ffff00000000ULL, }, { 0xffff0000ffffffffULL, 0x0000ffff00000000ULL, }, { 0x00000000ffffffffULL, 0xffffffff0000ffffULL, }, { 0x0000ffff00000000ULL, 0xffff0000ffffffffULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x0000ffffffff0000ULL, 0xffffffffffff0000ULL, }, { 0x0000ffffffffffffULL, 0xffff0000ffffffffULL, }, { 0x0000ffff00000000ULL, 0xffff0000ffffffffULL, }, /* 72 */ { 0xffff00000000ffffULL, 0x000000000000ffffULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, { 0x000000000000ffffULL, 0xffff00000000ffffULL, }, { 0xffffffff00000000ULL, 0x00000000ffff0000ULL, }, { 0xffff000000000000ULL, 0x0000ffff00000000ULL, }, { 0xffffffffffff0000ULL, 0x0000ffffffff0000ULL, }, { 0x0000000000000000ULL, 0x0000000000000000ULL, }, }; gettimeofday(&start, NULL); for (i = 0; i < PATTERN_INPUTS_SHORT_COUNT; i++) { for (j = 0; j < PATTERN_INPUTS_SHORT_COUNT; j++) { do_msa_CLT_U_H(b128_pattern[i], b128_pattern[j], b128_result[PATTERN_INPUTS_SHORT_COUNT * i + j]); } } for (i = 0; i < RANDOM_INPUTS_SHORT_COUNT; i++) { for (j = 0; j < RANDOM_INPUTS_SHORT_COUNT; j++) { do_msa_CLT_U_H(b128_random[i], b128_random[j], b128_result[((PATTERN_INPUTS_SHORT_COUNT) * (PATTERN_INPUTS_SHORT_COUNT)) + RANDOM_INPUTS_SHORT_COUNT * i + j]); } } gettimeofday(&end, NULL); elapsed_time = (end.tv_sec - start.tv_sec) * 1000.0; elapsed_time += (end.tv_usec - start.tv_usec) / 1000.0; ret = check_results(instruction_name, TEST_COUNT_TOTAL, elapsed_time, &b128_result[0][0], &b128_expect[0][0]); return ret; }
int main(int argc, char** argv) { mcapi_endpoint_t recv_endpt; mcapi_endpoint_t send_endpt; mca_status_t status; mcapi_request_t request; int i; mcapi_sclchan_recv_hndl_t recv_handle; /* r1 = ep1->ep2 */ mcapi_sclchan_send_hndl_t send_handle; /* r1 = ep1->ep2 */ size_t size; mcapi_param_t parms; mcapi_info_t version; mcapi_set_debug_level(6); /* create a node */ mcapi_initialize(DOMAIN,NODE,NULL,&parms,&version,&status); if (status != MCAPI_SUCCESS) { fprintf(stderr,"\nERROR: Failed to initialize: %s\n",mcapi_display_status(status,status_buff,sizeof(status_buff))); return -1; } /* create the endpoints */ send_endpt = mcapi_endpoint_create(1,&status); recv_endpt = mcapi_endpoint_create(2,&status); /* connect the channel */ /* connect the channel */ do { mcapi_sclchan_connect_i(send_endpt,recv_endpt,&request,&status); //retry if all request handles are in-use } while (status == MCAPI_ERR_REQUEST_LIMIT); mcapi_wait(&request,&size,TIMEOUT,&status); if (status == MCAPI_ERR_CHAN_CONNECTED) { fprintf(stderr,"\nokay, already connected: %s\n",mcapi_display_status(status,status_buff,sizeof(status_buff))); } else if (status != MCAPI_SUCCESS) { fprintf(stderr,"\nERROR: Failed to connect: %s\n",mcapi_display_status(status,status_buff,sizeof(status_buff))); fail(); } /* open the endpoint handles */ do { mcapi_sclchan_send_open_i(&send_handle /*send_handle*/,send_endpt, &request, &status); //retry if all request handles are in-use } while (status == MCAPI_ERR_REQUEST_LIMIT); mcapi_wait(&request,&size,TIMEOUT,&status); if (status != MCAPI_SUCCESS) { fprintf(stderr,"\nERROR: Failed to open send handle: %s\n",mcapi_display_status(status,status_buff,sizeof(status_buff))); fail(); } do { mcapi_sclchan_recv_open_i(&recv_handle /*recv_handle*/,recv_endpt, &request, &status); //retry if all request handles are in-use } while (status == MCAPI_ERR_REQUEST_LIMIT); mcapi_wait(&request,&size,TIMEOUT,&status); if (status != MCAPI_SUCCESS) { fprintf(stderr,"\nERROR: Failed to open recv handle: %s\n",mcapi_display_status(status,status_buff,sizeof(status_buff))); fail(); } /* issue sends */ for (i = 0; i < MCAPI_MAX_QUEUE_ELEMENTS; i++) { if (!sender(send_handle,MCAPI_SUCCESS)) { fail(); } } /* queue should be full */ if (!sender(send_handle,MCAPI_ERR_MEM_LIMIT)) { fail(); } /* issue receives */ for (i = 0; i < MCAPI_MAX_QUEUE_ELEMENTS; i++) { if (!receiver(recv_handle,MCAPI_SUCCESS)) { fail(); } } /* check results */ if (! check_results()) { fail(); } /* close handles */ mcapi_finalize(&status); if (status != MCAPI_SUCCESS) { fprintf(stderr,"\nERROR: Failed to finalize: %s\n",mcapi_display_status(status,status_buff,sizeof(status_buff))); fail(); } printf(" Test PASSED\n"); return 0; }