Ignore:
Timestamp:
Aug 15, 2014, 1:22:17 PM (5 years ago)
Author:
cameron
Message:

Fix carry increment bug; tag Seq byte ranges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/llvm_gen.cpp

    r4002 r4003  
    10041004
    10051005        //CarryQ - carry in.
    1006         Value* carryq_idx = b.getInt64(mCarryQueueIdx);
    1007         Value* carryq_GEP = b.CreateGEP(mptr_carry_q, carryq_idx);
     1006        Value* carryq_GEP = genNewCarryInPtr();
    10081007        Value* carryq_value = b.CreateLoad(carryq_GEP);
    10091008
     
    10281027        Value* void_1 = b.CreateStore(carryout_2_carry, carryq_GEP);
    10291028
    1030         //Increment the idx for the next advance or scan through.
    1031         mCarryQueueIdx++;
    1032 
    10331029        retVal = result_value;
    10341030    }
     
    10361032    {
    10371033        IRBuilder<> b(mBasicBlock);
    1038 #if 0
    1039         //CarryQ - carry in.
    1040         Value* carryq_idx = b.getInt64(mCarryQueueIdx);
    1041         Value* carryq_GEP = b.CreateGEP(mptr_carry_q, carryq_idx);
    1042         Value* carryq_value = b.CreateLoad(carryq_GEP);
    1043         //Get the input stream.
    1044         Value* strm_value = Generate_PabloE(mstar->getExpr1());
    1045         //Get the character that is to be matched.
    1046         Value* cc_value = Generate_PabloE(mstar->getExpr2());
    1047 
    1048         Value* and_value_1 = b.CreateAnd(cc_value, strm_value, "match_star_and_value_1");
    1049         Value* add_value_1 = b.CreateAdd(and_value_1, cc_value, "match_star_add_value_1");
    1050         Value* add_value_2 = b.CreateAdd(add_value_1, carryq_value, "match_star_add_value_2");
    1051         Value* xor_value_1 = b.CreateXor(add_value_2, mConst_Aggregate_64x2_neg1, "match_star_xor_value_1");
    1052         Value* and_value_2 = b.CreateAnd(cc_value, xor_value_1, "match_star_and_value_2");
    1053         Value* or_value_1 = b.CreateOr(and_value_1, and_value_2, "match_star_or_value_1");
    1054 
    1055         Value* srli_instr_1 = b.CreateLShr(or_value_1, 63);
    1056 
    1057         Value* cast_marker_value_1 = b.CreateBitCast(srli_instr_1, IntegerType::get(mMod->getContext(), 128));
    1058         Value* sll_1_value = b.CreateShl(cast_marker_value_1, 64);
    1059         Value* cast_marker_value_2 = b.CreateBitCast(sll_1_value, m64x2Vect);
    1060 
    1061 
    1062         Value* add_value_3 = b.CreateAdd(cast_marker_value_2, add_value_2, "match_star_add_value_3");
    1063         Value* xor_value_2 = b.CreateXor(add_value_3, mConst_Aggregate_64x2_neg1, "match_star_xor_value_2");
    1064         Value* and_value_3 = b.CreateAnd(cc_value, xor_value_2, "match_star_and_value_3");
    1065         Value* or_value_2  = b.CreateOr(and_value_1, and_value_3, "match_star_or_value_2 ");
    1066         Value* xor_value_3 = b.CreateXor(add_value_3, cc_value, "match_star_xor_value_3");
    1067         Value* result_value = b.CreateOr(xor_value_3, strm_value, "match_star_result_value");
    1068 
    1069         //CarryQ - carry out:
    1070         Value* cast_marker_value_3 = b.CreateBitCast(or_value_2, IntegerType::get(mMod->getContext(), 128));
    1071         Value* srli_2_value = b.CreateLShr(cast_marker_value_3, 127);
    1072         Value* carryout_2_carry = b.CreateBitCast(srli_2_value, m64x2Vect);
    1073 
    1074         Value* void_1 = b.CreateStore(carryout_2_carry, carryq_GEP);
    1075 
    1076         mCarryQueueIdx++;
    1077 
    1078         retVal = result_value;
    1079 #endif
    10801034        //Get the input stream.
    10811035        Value* strm_value = Generate_PabloE(mstar->getExpr1());
     
    10871041    {
    10881042        IRBuilder<> b(mBasicBlock);
    1089 #if 0
    1090         //CarryQ - carry in.
    1091         Value* carryq_idx = b.getInt64(mCarryQueueIdx);
    1092         Value* carryq_GEP = b.CreateGEP(mptr_carry_q, carryq_idx);
    1093         Value* carryq_value = b.CreateLoad(carryq_GEP);
    1094         //Get the input stream.
    1095         Value* strm_value = Generate_PabloE(sthru->getScanFrom());
    1096         //Get the scanthru bit stream.
    1097         Value* scanthru_value = Generate_PabloE(sthru->getScanThru());
    1098 
    1099         Value* and_value_1 = b.CreateAnd(scanthru_value, strm_value, "scanthru_and_value_1");
    1100         Value* add_value_1 = b.CreateAdd(and_value_1, carryq_value, "scanthru_add_value_1");
    1101         Value* add_value_2 = b.CreateAdd(add_value_1, scanthru_value, "scanthru_add_value_2");
    1102 
    1103         Value* srli_instr_1 = b.CreateLShr(and_value_1, 63);
    1104 
    1105         Value* cast_marker_value_1 = b.CreateBitCast(srli_instr_1, IntegerType::get(mMod->getContext(), 128));
    1106         Value* sll_1_value = b.CreateShl(cast_marker_value_1, 64);
    1107         Value* cast_marker_value_2 = b.CreateBitCast(sll_1_value, m64x2Vect);
    1108 
    1109         Value* add_value_3 = b.CreateAdd(cast_marker_value_2, add_value_2, "scanthru_add_value_3");
    1110         Value* xor_value_1  = b.CreateXor(scanthru_value, mConst_Aggregate_64x2_neg1, "scanthru_xor_value_1");
    1111         Value* result_value = b.CreateAnd(add_value_3, xor_value_1, "scanthru_result_value");
    1112 
    1113         //CarryQ - carry out:
    1114         Value* cast_marker_value_3 = b.CreateBitCast(add_value_3, IntegerType::get(mMod->getContext(), 128));
    1115         Value* srli_2_value = b.CreateLShr(cast_marker_value_3, 127);
    1116         Value* carryout_2_carry = b.CreateBitCast(srli_2_value, m64x2Vect);
    1117 
    1118         Value* void_1 = b.CreateStore(carryout_2_carry, carryq_GEP);
    1119 
    1120         mCarryQueueIdx++;
    1121 
    1122         retVal = result_value;
    1123 #endif
    11241043        //Get the input stream.
    11251044        Value* strm_value = Generate_PabloE(sthru->getScanFrom());
     
    11481067   
    11491068    //CarryQ - carry in.
    1150     Value* carryq_idx = b.getInt64(mCarryQueueIdx);
    1151     Value* carryq_GEP = b.CreateGEP(mptr_carry_q, carryq_idx);
     1069    Value* carryq_GEP = genNewCarryInPtr();
    11521070    Value* carryq_value = b.CreateLoad(carryq_GEP);
    11531071
     
    11651083    Value* void_1 = b.CreateStore(carry_out, carryq_GEP);
    11661084   
     1085    return sum;
     1086}
     1087
     1088Value* LLVM_Generator::genNewCarryInPtr() {
     1089    IRBuilder<> b(mBasicBlock);
     1090    Value* carryq_idx = b.getInt64(mCarryQueueIdx);
     1091    Value* carryq_GEP = b.CreateGEP(mptr_carry_q, carryq_idx);
    11671092    mCarryQueueIdx++;
    1168     return sum;
    1169 }
     1093    return carryq_GEP;
     1094}
     1095
    11701096
    11711097
Note: See TracChangeset for help on using the changeset viewer.