📄 smith_waterman_altivec.c
字号:
Hup2 = Hup1; // Update highest score encountered this far v_maxscore = vec_max(v_maxscore,H); // PROLOGUE 6 // prefetch next residue k = *p_dbseq++; // Create the actual diagonal score vector // and update the queue of incomplete score vectors v_score = vec_perm(v_score_q1, v_score_load, queue1_to_score); v_score_q1 = vec_perm(v_score_q2, v_score_load, queue2_to_queue1); v_score_q2 = vec_perm(v_score_q3, v_score_load, queue3_to_queue2); v_score_q3 = vec_perm(v_score_q3, v_score_load, queue3_with_load); // prefetch score for next step v_score_load = vec_ld(16*k,query_profile_word); // load values of F and H from previous row (one unit up) Fup = vec_ld(0, p); Hup1 = vec_ld(16, p); p += 16; // move ahead 32 bytes // shift into place so we have complete F and H vectors // that refer to the values one unit up from each cell // that we are currently working on. Fup = vec_sld(Fup,F,14); Hup1 = vec_sld(Hup1,H,14); // do the dynamic programming // update E value E = vec_subs(E,v_gapextend); tmp = vec_subs(H,v_gapopen); E = vec_max(E,tmp); // update F value F = vec_subs(Fup,v_gapextend); tmp = vec_subs(Hup1,v_gapopen); F = vec_max(F,tmp); // add score to H H = vec_adds(Hup2,v_score); H = vec_subs(H,v_bias); // set H to max of H,E,F H = vec_max(H,E); H = vec_max(H,F); // Save value to use for next diagonal H Hup2 = Hup1; // Update highest score encountered this far v_maxscore = vec_max(v_maxscore,H); // PROLOGUE 7 // prefetch next residue k = *p_dbseq++; // Create the actual diagonal score vector // and update the queue of incomplete score vectors v_score = vec_perm(v_score_q1, v_score_load, queue1_to_score); v_score_q1 = vec_perm(v_score_q2, v_score_load, queue2_to_queue1); v_score_q2 = vec_perm(v_score_q3, v_score_load, queue3_to_queue2); v_score_q3 = vec_perm(v_score_q3, v_score_load, queue3_with_load); // prefetch score for next step v_score_load = vec_ld(16*k,query_profile_word); // load values of F and H from previous row (one unit up) Fup = vec_ld(0, p); Hup1 = vec_ld(16, p); p += 16; // move ahead 32 bytes // shift into place so we have complete F and H vectors // that refer to the values one unit up from each cell // that we are currently working on. Fup = vec_sld(Fup,F,14); Hup1 = vec_sld(Hup1,H,14); // do the dynamic programming // update E value E = vec_subs(E,v_gapextend); tmp = vec_subs(H,v_gapopen); E = vec_max(E,tmp); // update F value F = vec_subs(Fup,v_gapextend); tmp = vec_subs(Hup1,v_gapopen); F = vec_max(F,tmp); // add score to H H = vec_adds(Hup2,v_score); H = vec_subs(H,v_bias); // set H to max of H,E,F H = vec_max(H,E); H = vec_max(H,F); // Save value to use for next diagonal H Hup2 = Hup1; // Update highest score encountered this far v_maxscore = vec_max(v_maxscore,H); // PROLOGUE 8 // prefetch next residue k = *p_dbseq++; // Create the actual diagonal score vector // and update the queue of incomplete score vectors v_score = vec_perm(v_score_q1, v_score_load, queue1_to_score); v_score_q1 = vec_perm(v_score_q2, v_score_load, queue2_to_queue1); v_score_q2 = vec_perm(v_score_q3, v_score_load, queue3_to_queue2); v_score_q3 = vec_perm(v_score_q3, v_score_load, queue3_with_load); // prefetch score for next step v_score_load = vec_ld(16*k,query_profile_word); // load values of F and H from previous row (one unit up) Fup = vec_ld(0, p); Hup1 = vec_ld(16, p); p += 16; // move ahead 32 bytes // shift into place so we have complete F and H vectors // that refer to the values one unit up from each cell // that we are currently working on. Fup = vec_sld(Fup,F,14); Hup1 = vec_sld(Hup1,H,14); // do the dynamic programming // update E value E = vec_subs(E,v_gapextend); tmp = vec_subs(H,v_gapopen); E = vec_max(E,tmp); // update F value F = vec_subs(Fup,v_gapextend); tmp = vec_subs(Hup1,v_gapopen); F = vec_max(F,tmp); // add score to H H = vec_adds(Hup2,v_score); H = vec_subs(H,v_bias); // set H to max of H,E,F H = vec_max(H,E); H = vec_max(H,F); // Save value to use for next diagonal H Hup2 = Hup1; // Update highest score encountered this far v_maxscore = vec_max(v_maxscore,H); // reset pointers to the start of the saved data from the last row p = workspace; for(j=8;j<db_length;j+=8) { // STEP 1 // prefetch next residue k = *p_dbseq++; // Create the actual diagonal score vector // and update the queue of incomplete score vectors v_score = vec_perm(v_score_q1, v_score_load, queue1_to_score); v_score_q1 = vec_perm(v_score_q2, v_score_load, queue2_to_queue1); v_score_q2 = vec_perm(v_score_q3, v_score_load, queue3_to_queue2); v_score_q3 = vec_perm(v_score_q3, v_score_load, queue3_with_load); // prefetch score for next step v_score_load = vec_ld(16*k,query_profile_word); // load values of F and H from previous row (one unit up) Fup = vec_ld(256, p); Hup1 = vec_ld(272, p); // save old values of F and H to use on next row vec_st(F, 0, p); vec_st(H, 16, p); p += 16; // move ahead 32 bytes // shift into place so we have complete F and H vectors // that refer to the values one unit up from each cell // that we are currently working on. Fup = vec_sld(Fup,F,14); Hup1 = vec_sld(Hup1,H,14); // do the dynamic programming // update E value E = vec_subs(E,v_gapextend); tmp = vec_subs(H,v_gapopen); E = vec_max(E,tmp); // update F value F = vec_subs(Fup,v_gapextend); tmp = vec_subs(Hup1,v_gapopen); F = vec_max(F,tmp); // add score to H H = vec_adds(Hup2,v_score); H = vec_subs(H,v_bias); // set H to max of H,E,F H = vec_max(H,E); H = vec_max(H,F); // Update highest score encountered this far v_maxscore = vec_max(v_maxscore,H); // STEP 2 // prefetch next residue k = *p_dbseq++; // Create the actual diagonal score vector // and update the queue of incomplete score vectors v_score = vec_perm(v_score_q1, v_score_load, queue1_to_score); v_score_q1 = vec_perm(v_score_q2, v_score_load, queue2_to_queue1); v_score_q2 = vec_perm(v_score_q3, v_score_load, queue3_to_queue2); v_score_q3 = vec_perm(v_score_q3, v_score_load, queue3_with_load); // prefetch score for next step v_score_load = vec_ld(16*k,query_profile_word); // load values of F and H from previous row (one unit up) Fup = vec_ld(256, p); Hup2 = vec_ld(272, p); // save old values of F and H to use on next row vec_st(F, 0, p); vec_st(H, 16, p); p += 16; // move ahead 32 bytes // shift into place so we have complete F and H vectors // that refer to the values one unit up from each cell // that we are currently working on. Fup = vec_sld(Fup,F,14); Hup2 = vec_sld(Hup2,H,14); // do the dynamic programming // update E value E = vec_subs(E,v_gapextend); tmp = vec_subs(H,v_gapopen); E = vec_max(E,tmp); // update F value F = vec_subs(Fup,v_gapextend); tmp = vec_subs(Hup2,v_gapopen); F = vec_max(F,tmp); // add score to H H = vec_adds(Hup1,v_score); H = vec_subs(H,v_bias); // set H to max of H,E,F H = vec_max(H,E); H = vec_max(H,F); // Update highest score encountered this far v_maxscore = vec_max(v_maxscore,H); // STEP 3 // prefetch next residue k = *p_dbseq++; // Create the actual diagonal score vector // and update the queue of incomplete score vectors v_score = vec_perm(v_score_q1, v_score_load, queue1_to_score); v_score_q1 = vec_perm(v_score_q2, v_score_load, queue2_to_queue1); v_score_q2 = vec_perm(v_score_q3, v_score_load, queue3_to_queue2); v_score_q3 = vec_perm(v_score_q3, v_score_load, queue3_with_load); // prefetch score for next step v_score_load = vec_ld(16*k,query_profile_word); // load values of F and H from previous row (one unit up) Fup = vec_ld(256, p); Hup1 = vec_ld(272, p); // save old values of F and H to use on next row vec_st(F, 0, p); vec_st(H, 16, p); p += 16; // move ahead 32 bytes // shift into place so we have complete F and H vectors // that refer to the values one unit up from each cell // that we are currently working on. Fup = vec_sld(Fup,F,14); Hup1 = vec_sld(Hup1,H,14); // do the dynamic programming // update E value E = vec_subs(E,v_gapextend); tmp = vec_subs(H,v_gapopen); E = vec_max(E,tmp); // update F value F = vec_subs(Fup,v_gapextend); tmp = vec_subs(Hup1,v_gapopen); F = vec_max(F,tmp); // add score to H H = vec_adds(Hup2,v_score); H = vec_subs(H,v_bias); // set H to max of H,E,F H = vec_max(H,E); H = vec_max(H,F); // Update highest score encountered this far v_maxscore = vec_max(v_maxscore,H); // STEP 4 // prefetch next residue k = *p_dbseq++; // Create the actual diagonal score vector // and update the queue of incomplete score vectors v_score = vec_perm(v_score_q1, v_score_load, queue1_to_score); v_score_q1 = vec_perm(v_score_q2, v_score_load, queue2_to_queue1); v_score_q2 = vec_perm(v_score_q3, v_score_load, queue3_to_queue2); v_score_q3 = vec_perm(v_score_q3, v_score_load, queue3_with_load); // prefetch score for next step v_score_load = vec_ld(16*k,query_profile_word); // load values of F and H from previous row (one unit up) Fup = vec_ld(256, p); Hup2 = vec_ld(272, p);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -