Changeset 5390 for icGREP/icgrepdevel/icgrep/kernels/interface.cpp
 Timestamp:
 Apr 2, 2017, 4:17:51 PM (2 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

icGREP/icgrepdevel/icgrep/kernels/interface.cpp
r5375 r5390 43 43 44 44 Value * ProcessingRate::CreateRatioCalculation(IDISA::IDISA_Builder * b, Value * principalInputItems, Value * doFinal) const { 45 Type * T = principalInputItems>getType();46 45 if (mKind == ProcessingRate::ProcessingRateKind::Fixed  mKind == ProcessingRate::ProcessingRateKind::Max) { 47 Value * strmItems = (ratio_numerator == 1) ? principalInputItems : b>CreateMul(principalInputItems, ConstantInt::get(T, ratio_numerator)); 48 if (ratio_denominator == 1) return strmItems; 49 return b>CreateUDiv(b>CreateAdd(ConstantInt::get(T, ratio_denominator  1), strmItems), ConstantInt::get(T, ratio_denominator)); 46 if (ratio_numerator == 1) { 47 return principalInputItems; 48 } 49 Type * const T = principalInputItems>getType(); 50 Constant * const numerator = ConstantInt::get(T, ratio_numerator); 51 Constant * const denominator = ConstantInt::get(T, ratio_denominator); 52 Constant * const denominatorLess1 = ConstantInt::get(T, ratio_denominator  1); 53 Value * strmItems = b>CreateMul(principalInputItems, numerator); 54 return b>CreateUDiv(b>CreateAdd(denominatorLess1, strmItems), denominator); 50 55 } 51 56 if (mKind == ProcessingRate::ProcessingRateKind::RoundUp) { 52 Constant * multiple = ConstantInt::get(T, ratio_denominator); 53 Constant * multipleLess1 = ConstantInt::get(T, ratio_denominator  1); 54 return b>CreateMul(b>CreateUDiv(b>CreateAdd(principalInputItems, multipleLess1), multiple), multiple); 57 Type * const T = principalInputItems>getType(); 58 Constant * const denominator = ConstantInt::get(T, ratio_denominator); 59 Constant * const denominatorLess1 = ConstantInt::get(T, ratio_denominator  1); 60 return b>CreateMul(b>CreateUDiv(b>CreateAdd(principalInputItems, denominatorLess1), denominator), denominator); 55 61 } 56 62 if (mKind == ProcessingRate::ProcessingRateKind::Add1) { 57 return b>CreateAdd(principalInputItems, b>CreateZExt(doFinal, principalInputItems>getType())); 58 } 59 return nullptr; 60 } 61 62 Value * ProcessingRate::CreateRatioCalculation(IDISA::IDISA_Builder * b, Value * principalInputItems) const { 63 Type * T = principalInputItems>getType(); 64 if (mKind == ProcessingRate::ProcessingRateKind::Fixed  mKind == ProcessingRate::ProcessingRateKind::Max) { 65 Value * strmItems = (ratio_numerator == 1) ? principalInputItems : b>CreateMul(principalInputItems, ConstantInt::get(T, ratio_numerator)); 66 if (ratio_denominator == 1) return strmItems; 67 return b>CreateUDiv(b>CreateAdd(ConstantInt::get(T, ratio_denominator  1), strmItems), ConstantInt::get(T, ratio_denominator)); 68 } 69 if (mKind == ProcessingRate::ProcessingRateKind::RoundUp) { 70 Constant * multiple = ConstantInt::get(T, ratio_denominator); 71 Constant * multipleLess1 = ConstantInt::get(T, ratio_denominator  1); 72 return b>CreateMul(b>CreateUDiv(b>CreateAdd(principalInputItems, multipleLess1), multiple), multiple); 73 } 74 if (mKind == ProcessingRate::ProcessingRateKind::Add1) { 63 if (doFinal) { 64 Type * const T = principalInputItems>getType(); 65 principalInputItems = b>CreateAdd(principalInputItems, b>CreateZExt(doFinal, T)); 66 } 75 67 return principalInputItems; 76 68 }
Note: See TracChangeset
for help on using the changeset viewer.