int main() { common cmn(std::cout); conv_recipe(cmn); return 0; }
void program_prog( int argc, char const* argv[]) { common cmn(argc, argv); common_write write(cmn); int num = fem::int0; sub(cmn, num); write(6, star), num + 17; }
void cmn(int res[], int m, int n, int pos=0, int val=0) { if (pos==n) { for (int i=0; i<n; i++) { printf("%d ", res[i]); } printf("\n"); return; } for ( int i=0; i<=m-n,val+i<m; i++) { res[pos] = val+i+1; cmn(res, m, n, pos+1, val+i+1); } }
void program_prog( int argc, char const* argv[]) { common cmn(argc, argv); common_write write(cmn); int num = fem::int0; sub1(num); write(6, star), "num after sub1:", num; int n = 1; sub2(num, n); write(6, star), "num after sub2", num; arr_1d<2, int> nums(fem::fill0); sub1(nums); write(6, star), "nums after sub1:", nums(1), nums(2); n = 2; sub2(nums, n); write(6, star), "nums after sub2:", nums(1), nums(2); sub3(nums, n); write(6, star), "nums after sub3:", nums(1), nums(2); }
static void feat_cmn(feat_t *fcb, mfcc_t **mfc, int32 nfr, int32 beginutt, int32 endutt) { cmn_type_t cmn_type = fcb->cmn; if (!(beginutt && endutt) && cmn_type != CMN_NONE) /* Only cmn_prior in block computation mode. */ cmn_type = CMN_PRIOR; switch (cmn_type) { case CMN_CURRENT: cmn(fcb->cmn_struct, mfc, fcb->varnorm, nfr); break; case CMN_PRIOR: cmn_prior(fcb->cmn_struct, mfc, fcb->varnorm, nfr); if (endutt) cmn_prior_update(fcb->cmn_struct); break; default: ; } cep_dump_dbg(fcb, mfc, nfr, "After CMN"); }
int main() { int arr[N]; cmn(arr, M, N); }
VtableStub* VtableStubs::create_itable_stub(int itable_index) { const int code_length = VtableStub::pd_code_size_limit(false); VtableStub* s = new(code_length) VtableStub(false, itable_index); // Can be NULL if there is no free space in the code cache. if (s == NULL) { return NULL; } ResourceMark rm; CodeBuffer cb(s->entry_point(), code_length); MacroAssembler* masm = new MacroAssembler(&cb); assert(VtableStub::receiver_location() == R0->as_VMReg(), "receiver expected in R0"); // R0-R3 / R0-R7 registers hold the arguments and cannot be spoiled const Register Rclass = AARCH64_ONLY(R9) NOT_AARCH64(R4); const Register Rlength = AARCH64_ONLY(R10) NOT_AARCH64(R5); const Register Rscan = AARCH64_ONLY(R11) NOT_AARCH64(R6); const Register tmp = Rtemp; assert_different_registers(Ricklass, Rclass, Rlength, Rscan, tmp); // Calculate the start of itable (itable goes after vtable) const int scale = exact_log2(vtableEntry::size_in_bytes()); address npe_addr = __ pc(); __ load_klass(Rclass, R0); __ ldr_s32(Rlength, Address(Rclass, Klass::vtable_length_offset())); __ add(Rscan, Rclass, in_bytes(Klass::vtable_start_offset())); __ add(Rscan, Rscan, AsmOperand(Rlength, lsl, scale)); // Search through the itable for an interface equal to incoming Ricklass // itable looks like [intface][offset][intface][offset][intface][offset] const int entry_size = itableOffsetEntry::size() * HeapWordSize; assert(itableOffsetEntry::interface_offset_in_bytes() == 0, "not added for convenience"); Label loop; __ bind(loop); __ ldr(tmp, Address(Rscan, entry_size, post_indexed)); #ifdef AARCH64 Label found; __ cmp(tmp, Ricklass); __ b(found, eq); __ cbnz(tmp, loop); #else __ cmp(tmp, Ricklass); // set ZF and CF if interface is found __ cmn(tmp, 0, ne); // check if tmp == 0 and clear CF if it is __ b(loop, ne); #endif // AARCH64 assert(StubRoutines::throw_IncompatibleClassChangeError_entry() != NULL, "Check initialization order"); #ifdef AARCH64 __ jump(StubRoutines::throw_IncompatibleClassChangeError_entry(), relocInfo::runtime_call_type, tmp); __ bind(found); #else // CF == 0 means we reached the end of itable without finding icklass __ jump(StubRoutines::throw_IncompatibleClassChangeError_entry(), relocInfo::runtime_call_type, noreg, cc); #endif // !AARCH64 // Interface found at previous position of Rscan, now load the method oop __ ldr_s32(tmp, Address(Rscan, itableOffsetEntry::offset_offset_in_bytes() - entry_size)); { const int method_offset = itableMethodEntry::size() * HeapWordSize * itable_index + itableMethodEntry::method_offset_in_bytes(); __ add_slow(Rmethod, Rclass, method_offset); } __ ldr(Rmethod, Address(Rmethod, tmp)); address ame_addr = __ pc(); #ifdef AARCH64 __ ldr(tmp, Address(Rmethod, Method::from_compiled_offset())); __ br(tmp); #else __ ldr(PC, Address(Rmethod, Method::from_compiled_offset())); #endif // AARCH64 masm->flush(); if (PrintMiscellaneous && (WizardMode || Verbose)) { tty->print_cr("itable #%d at " PTR_FORMAT "[%d] left over: %d", itable_index, p2i(s->entry_point()), (int)(s->code_end() - s->entry_point()), (int)(s->code_end() - __ pc())); } guarantee(__ pc() <= s->code_end(), "overflowed buffer"); // FIXME ARM: need correct 'slop' - below is x86 code // shut the door on sizing bugs //int slop = 8; // 32-bit offset is this much larger than a 13-bit one //assert(itable_index > 10 || __ pc() + slop <= s->code_end(), "room for 32-bit offset"); s->set_exception_points(npe_addr, ame_addr); return s; }
static void decode_utt (void *data, char *uttfile, int32 sf, int32 ef, char *uttid) { kb_t *kb; acoustic_t *am; int32 featwin, nfr, min_utt_frames, n_vithist; char cepfile[4096], latfile[4096]; vithist_t *finalhist; int32 i, f; glist_t hyplist; FILE *latfp; printf ("\n"); fflush (stdout); E_INFO("Utterance %s\n", uttid); kb = (kb_t *)data; am = kb->am; featwin = feat_window_size(am->fcb); /* Build complete cepfile name and read cepstrum data; check for min length */ ctl_infile (cepfile, cmd_ln_str("-cepdir"), cmd_ln_str("-cepext"), uttfile); if ((nfr = s2mfc_read (cepfile, sf, ef, featwin, am->mfc, S3_MAX_FRAMES)) < 0) { E_ERROR("%s: MFC read failed\n", uttid); return; } E_INFO("%s: %d frames\n", uttid, nfr-(featwin<<1)); ptmr_reset (kb->tm); ptmr_reset (kb->tm_search); ptmr_start (kb->tm); min_utt_frames = (featwin<<1) + 1; if (nfr < min_utt_frames) { E_ERROR("%s: Utterance shorter than %d frames; ignored\n", uttid, min_utt_frames, nfr); return; } /* CMN/AGC */ if (strcmp (cmd_ln_str("-cmn"), "current") == 0) cmn (am->mfc, nfr, feat_cepsize(am->fcb)); if (strcmp (cmd_ln_str("-agc"), "max") == 0) agc_max (am->mfc, nfr); /* Process utterance */ lextree_vit_start (kb, uttid); for (i = featwin, f = 0; i < nfr-featwin; i++, f++) { am->senscale[f] = acoustic_eval (am, i); ptmr_start (kb->tm_search); lextree_vit_frame (kb, f, uttid); printf (" %d,%d,%d", f, glist_count (kb->vithist[f]), glist_count (kb->lextree_active)); fflush (stdout); ptmr_stop (kb->tm_search); } printf ("\n"); finalhist = lextree_vit_end (kb, f, uttid); hyplist = vithist_backtrace (finalhist, kb->am->senscale); hyp_log (stdout, hyplist, _dict_wordstr, (void *)kb->dict); hyp_myfree (hyplist); printf ("\n"); /* Log the entire Viterbi word lattice */ sprintf (latfile, "%s.lat", uttid); if ((latfp = fopen(latfile, "w")) == NULL) { E_ERROR("fopen(%s,w) failed; using stdout\n", latfile); latfp = stdout; } n_vithist = vithist_log (latfp, kb->vithist, f, _dict_wordstr, (void *)kb->dict); if (latfp != stdout) fclose (latfp); else { printf ("\n"); fflush (stdout); } ptmr_stop (kb->tm); if (f > 0) { printf("TMR(%s): %5d frames; %.1fs CPU, %.2f xRT; %.1fs CPU(search), %.2f xRT; %.1fs Elapsed, %.2f xRT\n", uttid, f, kb->tm->t_cpu, kb->tm->t_cpu * 100.0 / f, kb->tm_search->t_cpu, kb->tm_search->t_cpu * 100.0 / f, kb->tm->t_elapsed, kb->tm->t_elapsed * 100.0 / f); printf("CTR(%s): %5d frames; %d Sen (%.1f/fr); %d HMM (%.1f/fr); %d Words (%.1f/fr)\n", uttid, f, kb->n_sen_eval, ((float64)kb->n_sen_eval) / f, kb->n_hmm_eval, ((float64)kb->n_hmm_eval) / f, n_vithist, ((float64) n_vithist) / f); } /* Cleanup */ glist_free (kb->lextree_active); kb->lextree_active = NULL; for (; f >= -1; --f) { /* I.e., including dummy START_WORD node at frame -1 */ glist_myfree (kb->vithist[f], sizeof(vithist_t)); kb->vithist[f] = NULL; } lm_cache_reset (kb->lm); }