int main(int argc, char *argv[]) { // debug level verbosity: 0-silent, 1-oneline, 2-more 3-full // char *s; int nfailed = 0; int dbglvl = 1; HTM_ID id; char futyi[50] = "J2000 6 41.4 47.9"; // s = (char *) malloc(1024); if(1){ nfailed += test1(dbglvl); nfailed += test2(dbglvl); nfailed += test3(dbglvl); nfailed += test4(dbglvl); nfailed += itest1(dbglvl); nfailed += itest2(dbglvl); nfailed += itest3(dbglvl); nfailed += itest4(dbglvl); nfailed += itest5(dbglvl); nfailed += itest6(dbglvl); nfailed += itest7(dbglvl); nfailed += itest8(dbglvl); nfailed += itest9(dbglvl); nfailed += itest9(dbglvl); nfailed += itest10(dbglvl); nfailed += itest11(dbglvl); } if(1){ //ckp1(); htmSqlInterface *htm = new htmSqlInterface(6); id = htm->lookupID(futyi); delete htm; nfailed += mtest_lookup(dbglvl); //ckp2(); //s2s1(); } { time_t timer; time_t now, then; long initial = 10000L; long counter = initial; htmSqlInterface *htm = new htmSqlInterface(6); now = time( &timer ); while(counter-- > 0){ // if ((counter % 10000) == 0) // cerr << "Here: " << counter << std::endl; id = htm->lookupID(futyi); } then = time (&timer); std::cout << initial << " iterations in " << then - now << " seconds" << std::endl; std::cout << initial / (double) (then - now) << " per second" << std::endl; std::cout << (1000.0 * (then - now)) / initial << " milliseconds each" << std::endl; } showtest("All tests", nfailed, 1); { double ra, dec; int level; cc_parseVectors(futyi, &level, &ra, &dec); cc_radec2ID(ra, dec); std::cout << "Futyi: (" << level << ") " << ra << ", " << dec << std::endl; } return 0; }
int main (void) { int rnd; mpfr_prec_t p; tests_start_mpfr (); p = (randlimb () % 200) + MPFR_PREC_MIN; RND_LOOP (rnd) { test2a (mpfr_round, "mpfr_round", p); test2a (mpfr_ceil, "mpfr_ceil", p); test2a (mpfr_floor, "mpfr_floor", p); test2a (mpfr_trunc, "mpfr_trunc", p); test2ui (mpfr_add_ui, "mpfr_add_ui", p, (mpfr_rnd_t) rnd); test2ui (mpfr_div_2exp, "mpfr_div_2exp", p, (mpfr_rnd_t) rnd); test2ui (mpfr_div_ui, "mpfr_div_ui", p, (mpfr_rnd_t) rnd); test2ui (mpfr_mul_2exp, "mpfr_mul_2exp", p, (mpfr_rnd_t) rnd); test2ui (mpfr_mul_ui, "mpfr_mul_ui", p, (mpfr_rnd_t) rnd); test2ui (mpfr_pow_ui, "mpfr_pow_ui", p, (mpfr_rnd_t) rnd); test2ui (mpfr_sub_ui, "mpfr_sub_ui", p, (mpfr_rnd_t) rnd); testui2 (mpfr_ui_div, "mpfr_ui_div", p, (mpfr_rnd_t) rnd); testui2 (mpfr_ui_sub, "mpfr_ui_sub", p, (mpfr_rnd_t) rnd); testui2 (mpfr_ui_pow, "mpfr_ui_pow", p, (mpfr_rnd_t) rnd); test2 (mpfr_sqr, "mpfr_sqr", p, (mpfr_rnd_t) rnd); test2 (mpfr_sqrt, "mpfr_sqrt", p, (mpfr_rnd_t) rnd); test2 (mpfr_abs, "mpfr_abs", p, (mpfr_rnd_t) rnd); test2 (mpfr_neg, "mpfr_neg", p, (mpfr_rnd_t) rnd); test2 (mpfr_log, "mpfr_log", p, (mpfr_rnd_t) rnd); test2 (mpfr_log2, "mpfr_log2", p, (mpfr_rnd_t) rnd); test2 (mpfr_log10, "mpfr_log10", p, (mpfr_rnd_t) rnd); test2 (mpfr_log1p, "mpfr_log1p", p, (mpfr_rnd_t) rnd); test2 (mpfr_exp, "mpfr_exp", p, (mpfr_rnd_t) rnd); test2 (mpfr_exp2, "mpfr_exp2", p, (mpfr_rnd_t) rnd); test2 (mpfr_exp10, "mpfr_exp10", p, (mpfr_rnd_t) rnd); test2 (mpfr_expm1, "mpfr_expm1", p, (mpfr_rnd_t) rnd); test2 (mpfr_eint, "mpfr_eint", p, (mpfr_rnd_t) rnd); test2 (mpfr_sinh, "mpfr_sinh", p, (mpfr_rnd_t) rnd); test2 (mpfr_cosh, "mpfr_cosh", p, (mpfr_rnd_t) rnd); test2 (mpfr_tanh, "mpfr_tanh", p, (mpfr_rnd_t) rnd); test2 (mpfr_asinh, "mpfr_asinh", p, (mpfr_rnd_t) rnd); test2 (mpfr_acosh, "mpfr_acosh", p, (mpfr_rnd_t) rnd); test2 (mpfr_atanh, "mpfr_atanh", p, (mpfr_rnd_t) rnd); test2 (mpfr_sech, "mpfr_sech", p, (mpfr_rnd_t) rnd); test2 (mpfr_csch, "mpfr_csch", p, (mpfr_rnd_t) rnd); test2 (mpfr_coth, "mpfr_coth", p, (mpfr_rnd_t) rnd); test2 (mpfr_asin, "mpfr_asin", p, (mpfr_rnd_t) rnd); test2 (mpfr_acos, "mpfr_acos", p, (mpfr_rnd_t) rnd); test2 (mpfr_atan, "mpfr_atan", p, (mpfr_rnd_t) rnd); test2 (mpfr_cos, "mpfr_cos", p, (mpfr_rnd_t) rnd); test2 (mpfr_sin, "mpfr_sin", p, (mpfr_rnd_t) rnd); test2 (mpfr_tan, "mpfr_tan", p, (mpfr_rnd_t) rnd); test2 (mpfr_sec, "mpfr_sec", p, (mpfr_rnd_t) rnd); test2 (mpfr_csc, "mpfr_csc", p, (mpfr_rnd_t) rnd); test2 (mpfr_cot, "mpfr_cot", p, (mpfr_rnd_t) rnd); test2 (mpfr_erf, "mpfr_erf", p, (mpfr_rnd_t) rnd); test2 (mpfr_erfc, "mpfr_erfc", p, (mpfr_rnd_t) rnd); test2 (mpfr_j0, "mpfr_j0", p, (mpfr_rnd_t) rnd); test2 (mpfr_j1, "mpfr_j1", p, (mpfr_rnd_t) rnd); test2 (mpfr_y0, "mpfr_y0", p, (mpfr_rnd_t) rnd); test2 (mpfr_y1, "mpfr_y1", p, (mpfr_rnd_t) rnd); test2 (mpfr_zeta, "mpfr_zeta", p, (mpfr_rnd_t) rnd); test2 (mpfr_gamma, "mpfr_gamma", p, (mpfr_rnd_t) rnd); test2 (mpfr_lngamma, "mpfr_lngamma", p, (mpfr_rnd_t) rnd); test2 (mpfr_rint, "mpfr_rint", p, (mpfr_rnd_t) rnd); test2 (mpfr_rint_ceil, "mpfr_rint_ceil", p, (mpfr_rnd_t) rnd); test2 (mpfr_rint_floor, "mpfr_rint_floor", p, (mpfr_rnd_t) rnd); test2 (mpfr_rint_round, "mpfr_rint_round", p, (mpfr_rnd_t) rnd); test2 (mpfr_rint_trunc, "mpfr_rint_trunc", p, (mpfr_rnd_t) rnd); test2 (mpfr_frac, "mpfr_frac", p, (mpfr_rnd_t) rnd); test3 (mpfr_add, "mpfr_add", p, (mpfr_rnd_t) rnd); test3 (mpfr_sub, "mpfr_sub", p, (mpfr_rnd_t) rnd); test3 (mpfr_mul, "mpfr_mul", p, (mpfr_rnd_t) rnd); test3 (mpfr_div, "mpfr_div", p, (mpfr_rnd_t) rnd); test3 (mpfr_agm, "mpfr_agm", p, (mpfr_rnd_t) rnd); test3 (mpfr_min, "mpfr_min", p, (mpfr_rnd_t) rnd); test3 (mpfr_max, "mpfr_max", p, (mpfr_rnd_t) rnd); test3 (reldiff_wrapper, "mpfr_reldiff", p, (mpfr_rnd_t) rnd); test3 (mpfr_dim, "mpfr_dim", p, (mpfr_rnd_t) rnd); test3 (mpfr_remainder, "mpfr_remainder", p, (mpfr_rnd_t) rnd); test3 (mpfr_pow, "mpfr_pow", p, (mpfr_rnd_t) rnd); pow_int ((mpfr_rnd_t) rnd); test3 (mpfr_atan2, "mpfr_atan2", p, (mpfr_rnd_t) rnd); test3 (mpfr_hypot, "mpfr_hypot", p, (mpfr_rnd_t) rnd); test3a (mpfr_sin_cos, "mpfr_sin_cos", p, (mpfr_rnd_t) rnd); test4 (mpfr_fma, "mpfr_fma", p, (mpfr_rnd_t) rnd); test4 (mpfr_fms, "mpfr_fms", p, (mpfr_rnd_t) rnd); #if MPFR_VERSION >= MPFR_VERSION_NUM(2,4,0) test2 (mpfr_li2, "mpfr_li2", p, (mpfr_rnd_t) rnd); test2 (mpfr_rec_sqrt, "mpfr_rec_sqrt", p, (mpfr_rnd_t) rnd); test3 (mpfr_fmod, "mpfr_fmod", p, (mpfr_rnd_t) rnd); test3a (mpfr_modf, "mpfr_modf", p, (mpfr_rnd_t) rnd); test3a (mpfr_sinh_cosh, "mpfr_sinh_cosh", p, (mpfr_rnd_t) rnd); #endif } tests_end_mpfr (); return 0; }
static void mcd_poll(unsigned long dummy) { int st; if (mcd_error) { if (mcd_error & 0xA5) { printk(KERN_ERR "mcd: I/O error 0x%02x", mcd_error); if (mcd_error & 0x80) printk(" (Door open)"); if (mcd_error & 0x20) printk(" (Disk changed)"); if (mcd_error & 0x04) { printk(" (Read error)"); /* Bitch about the problem. */ /* Time to get fancy! If at 2x speed and 1 error, drop to 1x speed! */ /* Interesting how it STAYS at MCD_RETRY_ATTEMPTS on first error! */ /* But I find that rather HANDY!!! */ /* Neat! it REALLY WORKS on those LOW QUALITY CD's!!! Smile! :) */ /* AJK [06/17/95] */ /* Slap the CD down to single speed! */ if (mcdDouble == 1 && McdTries == MCD_RETRY_ATTEMPTS && MCMD_DATA_READ == MCMD_2X_READ) { MCMD_DATA_READ = MCMD_PLAY_READ; /* Uhhh, Ummmm, muhuh-huh! */ mcd1xhold = SINGLE_HOLD_SECTORS; /* Hey Beavis! */ printk(" Speed now 1x"); /* Pull my finger! */ } } printk("\n"); mcd_invalidate_buffers(); #ifdef WARN_IF_READ_FAILURE if (McdTries == MCD_RETRY_ATTEMPTS) printk(KERN_ERR "mcd: read of block %d failed\n", mcd_next_bn); #endif if (!McdTries--) { /* Nuts! This cd is ready for recycling! */ /* When WAS the last time YOU cleaned it CORRECTLY?! */ printk(KERN_ERR "mcd: read of block %d failed, giving up\n", mcd_next_bn); if (mcd_transfer_is_active) { McdTries = 0; goto ret; } if (current_valid()) end_request(CURRENT, 0); McdTries = MCD_RETRY_ATTEMPTS; } } mcd_error = 0; mcd_state = MCD_S_STOP; } /* Switch back to Double speed if enough GOOD sectors were read! */ /* Are we a double speed with a crappy CD?! */ if (mcdDouble == 1 && McdTries == MCD_RETRY_ATTEMPTS && MCMD_DATA_READ == MCMD_PLAY_READ) { /* We ARE a double speed and we ARE bitching! */ if (mcd1xhold == 0) { /* Okay, Like are we STILL at single speed? *//* We need to switch back to double speed now... */ MCMD_DATA_READ = MCMD_2X_READ; /* Uhhh... BACK You GO! */ printk(KERN_INFO "mcd: Switching back to 2X speed!\n"); /* Tell 'em! */ } else mcd1xhold--; /* No?! Count down the good reads some more... */ /* and try, try again! */ } immediately: switch (mcd_state) { case MCD_S_IDLE: test3(printk("MCD_S_IDLE\n")); goto out; case MCD_S_START: test3(printk("MCD_S_START\n")); outb(MCMD_GET_STATUS, MCDPORT(0)); mcd_state = mcd_mode == 1 ? MCD_S_READ : MCD_S_MODE; McdTimeout = 3000; break; case MCD_S_MODE: test3(printk("MCD_S_MODE\n")); if ((st = mcdStatus()) != -1) { if (st & MST_DSK_CHG) { mcdDiskChanged = 1; tocUpToDate = 0; mcd_invalidate_buffers(); } set_mode_immediately: if ((st & MST_DOOR_OPEN) || !(st & MST_READY)) { mcdDiskChanged = 1; tocUpToDate = 0; if (mcd_transfer_is_active) { mcd_state = MCD_S_START; goto immediately; } printk(KERN_INFO); printk((st & MST_DOOR_OPEN) ? "mcd: door open\n" : "mcd: disk removed\n"); mcd_state = MCD_S_IDLE; while (current_valid()) end_request(CURRENT, 0); goto out; } outb(MCMD_SET_MODE, MCDPORT(0)); outb(1, MCDPORT(0)); mcd_mode = 1; mcd_state = MCD_S_READ; McdTimeout = 3000; } break; case MCD_S_READ: test3(printk("MCD_S_READ\n")); if ((st = mcdStatus()) != -1) { if (st & MST_DSK_CHG) { mcdDiskChanged = 1; tocUpToDate = 0; mcd_invalidate_buffers(); } read_immediately: if ((st & MST_DOOR_OPEN) || !(st & MST_READY)) { mcdDiskChanged = 1; tocUpToDate = 0; if (mcd_transfer_is_active) { mcd_state = MCD_S_START; goto immediately; } printk(KERN_INFO); printk((st & MST_DOOR_OPEN) ? "mcd: door open\n" : "mcd: disk removed\n"); mcd_state = MCD_S_IDLE; while (current_valid()) end_request(CURRENT, 0); goto out; } if (current_valid()) { struct mcd_Play_msf msf; mcd_next_bn = CURRENT->sector / 4; hsg2msf(mcd_next_bn, &msf.start); msf.end.min = ~0; msf.end.sec = ~0; msf.end.frame = ~0; sendMcdCmd(MCMD_DATA_READ, &msf); mcd_state = MCD_S_DATA; McdTimeout = READ_TIMEOUT; } else { mcd_state = MCD_S_STOP; goto immediately; } } break; case MCD_S_DATA: test3(printk("MCD_S_DATA\n")); st = inb(MCDPORT(1)) & (MFL_STATUSorDATA); data_immediately: test5(printk("Status %02x\n", st)) switch (st) { case MFL_DATA: #ifdef WARN_IF_READ_FAILURE if (McdTries == 5) printk(KERN_WARNING "mcd: read of block %d failed\n", mcd_next_bn); #endif if (!McdTries--) { printk(KERN_ERR "mcd: read of block %d failed, giving up\n", mcd_next_bn); if (mcd_transfer_is_active) { McdTries = 0; break; } if (current_valid()) end_request(CURRENT, 0); McdTries = 5; } mcd_state = MCD_S_START; McdTimeout = READ_TIMEOUT; goto immediately; case MFL_STATUSorDATA: break; default: McdTries = 5; if (!current_valid() && mcd_buf_in == mcd_buf_out) { mcd_state = MCD_S_STOP; goto immediately; } mcd_buf_bn[mcd_buf_in] = -1; insb(MCDPORT(0), mcd_buf + 2048 * mcd_buf_in, 2048); mcd_buf_bn[mcd_buf_in] = mcd_next_bn++; if (mcd_buf_out == -1) mcd_buf_out = mcd_buf_in; mcd_buf_in = mcd_buf_in + 1 == MCD_BUF_SIZ ? 0 : mcd_buf_in + 1; if (!mcd_transfer_is_active) { while (current_valid()) { mcd_transfer(); if (CURRENT->nr_sectors == 0) end_request(CURRENT, 1); else break; } } if (current_valid() && (CURRENT->sector / 4 < mcd_next_bn || CURRENT->sector / 4 > mcd_next_bn + 16)) { mcd_state = MCD_S_STOP; goto immediately; } McdTimeout = READ_TIMEOUT; { int count = QUICK_LOOP_COUNT; while (count--) { QUICK_LOOP_DELAY; if ((st = (inb(MCDPORT(1))) & (MFL_STATUSorDATA)) != (MFL_STATUSorDATA)) { test4(printk(" %d ", QUICK_LOOP_COUNT - count)); goto data_immediately; } } test4(printk("ended ")); } break; } break; case MCD_S_STOP: test3(printk("MCD_S_STOP\n")); if (!mitsumi_bug_93_wait) goto do_not_work_around_mitsumi_bug_93_1; McdTimeout = mitsumi_bug_93_wait; mcd_state = 9 + 3 + 1; break; case 9 + 3 + 1: if (McdTimeout) break; do_not_work_around_mitsumi_bug_93_1: outb(MCMD_STOP, MCDPORT(0)); if ((inb(MCDPORT(1)) & MFL_STATUSorDATA) == MFL_STATUS) { int i = 4096; do { inb(MCDPORT(0)); } while ((inb(MCDPORT(1)) & MFL_STATUSorDATA) == MFL_STATUS && --i); outb(MCMD_STOP, MCDPORT(0)); if ((inb(MCDPORT(1)) & MFL_STATUSorDATA) == MFL_STATUS) { i = 4096; do { inb(MCDPORT(0)); } while ((inb(MCDPORT(1)) & MFL_STATUSorDATA) == MFL_STATUS && --i); outb(MCMD_STOP, MCDPORT(0)); } } mcd_state = MCD_S_STOPPING; McdTimeout = 1000; break; case MCD_S_STOPPING: test3(printk("MCD_S_STOPPING\n")); if ((st = mcdStatus()) == -1 && McdTimeout) break; if ((st != -1) && (st & MST_DSK_CHG)) { mcdDiskChanged = 1; tocUpToDate = 0; mcd_invalidate_buffers(); } if (!mitsumi_bug_93_wait) goto do_not_work_around_mitsumi_bug_93_2; McdTimeout = mitsumi_bug_93_wait; mcd_state = 9 + 3 + 2; break; case 9 + 3 + 2: if (McdTimeout) break; st = -1; do_not_work_around_mitsumi_bug_93_2: test3(printk("CURRENT_VALID %d mcd_mode %d\n", current_valid(), mcd_mode)); if (current_valid()) { if (st != -1) { if (mcd_mode == 1) goto read_immediately; else goto set_mode_immediately; } else { mcd_state = MCD_S_START; McdTimeout = 1; } } else { mcd_state = MCD_S_IDLE; goto out; } break; default: printk(KERN_ERR "mcd: invalid state %d\n", mcd_state); goto out; } ret: if (!McdTimeout--) { printk(KERN_WARNING "mcd: timeout in state %d\n", mcd_state); mcd_state = MCD_S_STOP; } mcd_timer.function = mcd_poll; mod_timer(&mcd_timer, jiffies + 1); out: return; }
int main () { v2sf a, b, c, d; int i, j; /* cabs.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {-33, -44}; c = (v2sf) {55, 66}; d = (v2sf) {-77, -88}; i = 0; j = 0; if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* cabs.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {-11, -44}; c = (v2sf) {55, 66}; d = (v2sf) {-77, -88}; i = 1; j = 0; if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* cabs.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {-33, -22}; c = (v2sf) {55, 66}; d = (v2sf) {-77, -88}; i = 1; j = 0; if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* cabs.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {-33, -44}; c = (v2sf) {55, 66}; d = (v2sf) {-55, -88}; i = 1; j = 0; if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* cabs.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {-33, -44}; c = (v2sf) {55, 66}; d = (v2sf) {-77, -66}; i = 1; j = 0; if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* cabs.eq.ps */ a = (v2sf) {11, 22}; b = (v2sf) {-11, -22}; c = (v2sf) {55, 66}; d = (v2sf) {-55, -66}; i = 1; j = 1; if (__builtin_mips_any_cabs_eq_4s(a, b, c, d) != i) abort (); if (__builtin_mips_all_cabs_eq_4s(a, b, c, d) != j) abort (); /* Test all comparisons */ a = (v2sf) {11, 33}; b = (v2sf) {-33, -11}; c = (v2sf) {55, 66}; d = (v2sf) {-55, -88}; i = test0 (a, b, c, d); if (i != 0) abort (); i = test1 (a, b, c, d); if (i != 0) abort (); i = test2 (a, b, c, d); if (i != 0) abort (); i = test3 (a, b, c, d); if (i != 0) abort (); i = test4 (a, b, c, d); if (i != 1) abort (); i = test5 (a, b, c, d); if (i != 0) abort (); i = test6 (a, b, c, d); if (i != 1) abort (); i = test7 (a, b, c, d); if (i != 0) abort (); i = test8 (a, b, c, d); if (i != 1) abort (); i = test9 (a, b, c, d); if (i != 0) abort (); i = test10 (a, b, c, d); if (i != 1) abort (); i = test11 (a, b, c, d); if (i != 0) abort (); i = test12 (a, b, c, d); if (i != 1) abort (); i = test13 (a, b, c, d); if (i != 0) abort (); i = test14 (a, b, c, d); if (i != 1) abort (); i = test15 (a, b, c, d); if (i != 0) abort (); i = test16 (a, b, c, d); if (i != 0) abort (); i = test17 (a, b, c, d); if (i != 0) abort (); i = test18 (a, b, c, d); if (i != 0) abort (); i = test19 (a, b, c, d); if (i != 0) abort (); i = test20 (a, b, c, d); if (i != 1) abort (); i = test21 (a, b, c, d); if (i != 0) abort (); i = test22 (a, b, c, d); if (i != 1) abort (); i = test23 (a, b, c, d); if (i != 0) abort (); i = test24 (a, b, c, d); if (i != 1) abort (); i = test25 (a, b, c, d); if (i != 0) abort (); i = test26 (a, b, c, d); if (i != 1) abort (); i = test27 (a, b, c, d); if (i != 0) abort (); i = test28 (a, b, c, d); if (i != 1) abort (); i = test29 (a, b, c, d); if (i != 0) abort (); i = test30 (a, b, c, d); if (i != 1) abort (); i = test31 (a, b, c, d); if (i != 0) abort (); /* Reversed arguments */ i = test0 (b, a, d, c); if (i != 0) abort (); i = test1 (b, a, d, c); if (i != 0) abort (); i = test2 (b, a, d, c); if (i != 0) abort (); i = test3 (b, a, d, c); if (i != 0) abort (); i = test4 (b, a, d, c); if (i != 1) abort (); i = test5 (b, a, d, c); if (i != 0) abort (); i = test6 (b, a, d, c); if (i != 1) abort (); i = test7 (b, a, d, c); if (i != 0) abort (); i = test8 (b, a, d, c); if (i != 1) abort (); i = test9 (b, a, d, c); if (i != 0) abort (); i = test10 (b, a, d, c); if (i != 1) abort (); i = test11 (b, a, d, c); if (i != 0) abort (); i = test12 (b, a, d, c); if (i != 1) abort (); i = test13 (b, a, d, c); if (i != 0) abort (); i = test14 (b, a, d, c); if (i != 1) abort (); i = test15 (b, a, d, c); if (i != 0) abort (); i = test16 (b, a, d, c); if (i != 0) abort (); i = test17 (b, a, d, c); if (i != 0) abort (); i = test18 (b, a, d, c); if (i != 0) abort (); i = test19 (b, a, d, c); if (i != 0) abort (); i = test20 (b, a, d, c); if (i != 1) abort (); i = test21 (b, a, d, c); if (i != 0) abort (); i = test22 (b, a, d, c); if (i != 1) abort (); i = test23 (b, a, d, c); if (i != 0) abort (); i = test24 (b, a, d, c); if (i != 1) abort (); i = test25 (b, a, d, c); if (i != 0) abort (); i = test26 (b, a, d, c); if (i != 1) abort (); i = test27 (b, a, d, c); if (i != 0) abort (); i = test28 (b, a, d, c); if (i != 1) abort (); i = test29 (b, a, d, c); if (i != 0) abort (); i = test30 (b, a, d, c); if (i != 1) abort (); i = test31 (b, a, d, c); if (i != 0) abort (); #ifndef __FAST_MATH__ /* Test all comparisons */ a = (v2sf) {qnan, qnan}; b = (v2sf) {-33, -11}; c = (v2sf) {qnan, qnan}; d = (v2sf) {-55, -88}; i = test0 (a, b, c, d); if (i != 0) abort (); i = test1 (a, b, c, d); if (i != 0) abort (); i = test2 (a, b, c, d); if (i != 1) abort (); i = test3 (a, b, c, d); if (i != 1) abort (); i = test4 (a, b, c, d); if (i != 0) abort (); i = test5 (a, b, c, d); if (i != 0) abort (); i = test6 (a, b, c, d); if (i != 1) abort (); i = test7 (a, b, c, d); if (i != 1) abort (); i = test8 (a, b, c, d); if (i != 0) abort (); i = test9 (a, b, c, d); if (i != 0) abort (); i = test10 (a, b, c, d); if (i != 1) abort (); i = test11 (a, b, c, d); if (i != 1) abort (); i = test12 (a, b, c, d); if (i != 0) abort (); i = test13 (a, b, c, d); if (i != 0) abort (); i = test14 (a, b, c, d); if (i != 1) abort (); i = test15 (a, b, c, d); if (i != 1) abort (); i = test16 (a, b, c, d); if (i != 0) abort (); i = test17 (a, b, c, d); if (i != 0) abort (); i = test18 (a, b, c, d); if (i != 1) abort (); i = test19 (a, b, c, d); if (i != 1) abort (); i = test20 (a, b, c, d); if (i != 0) abort (); i = test21 (a, b, c, d); if (i != 0) abort (); i = test22 (a, b, c, d); if (i != 1) abort (); i = test23 (a, b, c, d); if (i != 1) abort (); i = test24 (a, b, c, d); if (i != 0) abort (); i = test25 (a, b, c, d); if (i != 0) abort (); i = test26 (a, b, c, d); if (i != 1) abort (); i = test27 (a, b, c, d); if (i != 1) abort (); i = test28 (a, b, c, d); if (i != 0) abort (); i = test29 (a, b, c, d); if (i != 0) abort (); i = test30 (a, b, c, d); if (i != 1) abort (); i = test31 (a, b, c, d); if (i != 1) abort (); #endif printf ("Test Passes\n"); exit (0); }
int main (int argc, char* argv[]) { opal_init(&argc, &argv); test_out = stderr; /* run the tests */ fprintf(test_out, "executing test1\n"); if (test1()) { fprintf(test_out, "Test1 succeeded\n"); } else { fprintf(test_out, "Test1 failed\n"); } fprintf(test_out, "executing test2\n"); if (test2()) { fprintf(test_out, "Test2 succeeded\n"); } else { fprintf(test_out, "Test2 failed\n"); } fprintf(test_out, "executing test3\n"); if (test3()) { fprintf(test_out, "Test3 succeeded\n"); } else { fprintf(test_out, "Test3 failed\n"); } fprintf(test_out, "executing test4\n"); if (test4()) { fprintf(test_out, "Test4 succeeded\n"); } else { fprintf(test_out, "Test4 failed\n"); } fprintf(test_out, "executing test5\n"); if (test5()) { fprintf(test_out, "Test5 succeeded\n"); } else { fprintf(test_out, "Test5 failed\n"); } fprintf(test_out, "executing test6\n"); if (test6()) { fprintf(test_out, "Test6 succeeded\n"); } else { fprintf(test_out, "Test6 failed\n"); } fprintf(test_out, "executing test7\n"); if (test7()) { fprintf(test_out, "Test7 succeeded\n"); } else { fprintf(test_out, "Test7 failed\n"); } fprintf(test_out, "executing test8\n"); if (test8()) { fprintf(test_out, "Test8 succeeded\n"); } else { fprintf(test_out, "Test8 failed\n"); } fprintf(test_out, "executing test9\n"); if (test9()) { fprintf(test_out, "Test9 succeeded\n"); } else { fprintf(test_out, "opal_dss test9 failed\n"); } fprintf(test_out, "executing test11\n"); if (test11()) { fprintf(test_out, "Test11 succeeded\n"); } else { fprintf(test_out, "opal_dss test11 failed\n"); } fprintf(test_out, "executing test12\n"); if (test12()) { fprintf(test_out, "Test12 succeeded\n"); } else { fprintf(test_out, "opal_dss test12 failed\n"); } fprintf(test_out, "executing test13\n"); if (test13()) { fprintf(test_out, "Test13 succeeded\n"); } else { fprintf(test_out, "opal_dss test13 failed\n"); } fclose(test_out); opal_finalize(); return(0); }
NOMIPS16 int main () { v2sf a, b, c, d, e, f; /* Case 1 {diff, diff} */ /* movt.ps */ a = (v2sf) {5, 12}; b = (v2sf) {-7, -6}; c = (v2sf) {33, 123}; d = (v2sf) {8, 78}; e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); f = (v2sf) {33, 123}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* movf.ps */ e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); f = (v2sf) {8, 78}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* Case 2 {same, diff} */ /* movt.ps */ a = (v2sf) {5, 12}; b = (v2sf) {-5, -6}; c = (v2sf) {33, 123}; d = (v2sf) {8, 78}; e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); f = (v2sf) {8, 123}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* movf.ps */ e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); f = (v2sf) {33, 78}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* Case 3 {diff, same} */ /* movt.ps */ a = (v2sf) {5, 12}; b = (v2sf) {-9, -12}; c = (v2sf) {33, 123}; d = (v2sf) {8, 78}; e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); f = (v2sf) {33, 78}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* movf.ps */ e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); f = (v2sf) {8, 123}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* Case 4 {same, same} */ /* movt.ps */ a = (v2sf) {5, 12}; b = (v2sf) {-5, -12}; c = (v2sf) {33, 123}; d = (v2sf) {8, 78}; e = __builtin_mips_movt_cabs_eq_ps (a, b, c, d); f = (v2sf) {8, 78}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* movf.ps */ e = __builtin_mips_movf_cabs_eq_ps (a, b, c, d); f = (v2sf) {33, 123}; if (!__builtin_mips_all_c_eq_ps (e, f)) abort (); /* Test all 16 operators */ a = (v2sf) {-123, 123}; b = (v2sf) {1000, -1000}; c = (v2sf) {-33, 123}; d = (v2sf) {8, -78}; e = test0 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test1 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test2 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test3 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test4 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test5 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test6 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test7 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test8 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test9 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test10 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test11 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test12 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test13 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test14 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test15 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test16 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test17 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test18 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test19 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test20 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test21 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test22 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test23 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test24 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test25 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test26 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test27 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test28 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test29 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test30 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test31 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); /* Reversed arguments */ e = test0 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test1 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test2 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test3 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test4 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test5 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test6 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test7 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test8 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test9 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test10 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test11 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test12 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test13 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test14 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test15 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test16 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test17 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test18 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test19 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test20 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test21 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test22 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test23 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test24 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test25 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test26 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test27 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test28 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test29 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test30 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test31 (b, a, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); #ifndef __FAST_MATH__ /* Test all 16 operators */ a = (v2sf) {qnan, qnan}; b = (v2sf) {1000, -1000}; c = (v2sf) {8, -78}; d = (v2sf) {-33, 123}; e = test0 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test1 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test2 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test3 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test4 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test5 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test6 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test7 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test8 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test9 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test10 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test11 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test12 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test13 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test14 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test15 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test16 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test17 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test18 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test19 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test20 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test21 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test22 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test23 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test24 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test25 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test26 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test27 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test28 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); e = test29 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test30 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, d)) abort (); e = test31 (a, b, c, d); if (!__builtin_mips_all_c_eq_ps (e, c)) abort (); #endif printf ("Test Passes\n"); exit (0); }
int main (int argc, char* argv[]) { int ret = 0; opal_init(&argc, &argv); test_out = stderr; /* run the tests */ fprintf(test_out, "executing test1\n"); if (test1()) { fprintf(test_out, "Test1 succeeded\n"); } else { fprintf(test_out, "Test1 failed\n"); ret = 1; } fprintf(test_out, "executing test2\n"); if (test2()) { fprintf(test_out, "Test2 succeeded\n"); } else { fprintf(test_out, "Test2 failed\n"); ret = 2; } fprintf(test_out, "executing test3\n"); if (test3()) { fprintf(test_out, "Test3 succeeded\n"); } else { fprintf(test_out, "Test3 failed\n"); ret = 3; } fprintf(test_out, "executing test4\n"); if (test4()) { fprintf(test_out, "Test4 succeeded\n"); } else { fprintf(test_out, "Test4 failed\n"); ret = 4; } fprintf(test_out, "executing test5\n"); if (test5()) { fprintf(test_out, "Test5 succeeded\n"); } else { fprintf(test_out, "Test5 failed\n"); ret = 5; } fprintf(test_out, "executing test6\n"); if (test6()) { fprintf(test_out, "Test6 succeeded\n"); } else { fprintf(test_out, "Test6 failed\n"); ret = 6; } fprintf(test_out, "executing test7\n"); if (test7()) { fprintf(test_out, "Test7 succeeded\n"); } else { fprintf(test_out, "Test7 failed\n"); ret = 7; } fprintf(test_out, "executing test8\n"); if (test8()) { fprintf(test_out, "Test8 succeeded\n"); } else { fprintf(test_out, "Test8 failed\n"); ret = 8; } fprintf(test_out, "executing test9\n"); if (test9()) { fprintf(test_out, "Test9 succeeded\n"); } else { fprintf(test_out, "opal_dss test9 failed\n"); ret = 9; } fprintf(test_out, "executing test10\n"); if (test10()) { fprintf(test_out, "Test10 succeeded\n"); } else { fprintf(test_out, "opal_dss test10 failed\n"); ret = 10; } fprintf(test_out, "executing test11\n"); if (test11()) { fprintf(test_out, "Test11 succeeded\n"); } else { fprintf(test_out, "opal_dss test11 failed\n"); ret = 11; } fprintf(test_out, "executing test12\n"); if (test12()) { fprintf(test_out, "Test12 succeeded\n"); } else { fprintf(test_out, "opal_dss test12 failed\n"); ret = 12; } fclose(test_out); opal_finalize(); return ret; }