Ignore:
Timestamp:
Jun 9, 2018, 1:51:10 PM (10 months ago)
Author:
cameron
Message:

IDISA_SSSE3 builder; other IDISA operations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_builder.cpp

    r6071 r6076  
    139139Value * IDISA_Builder::simd_ugt(unsigned fw, Value * a, Value * b) {
    140140    if (fw == 1) return simd_and(a, simd_not(b));
     141    if (fw < 8) {
     142        Value * half_ugt = simd_ugt(fw/2, a, b);
     143        Value * half_eq = simd_eq(fw/2, a, b);
     144        Value * ugt_0 = simd_or(simd_srli(fw, half_ugt, fw/2), simd_and(half_ugt, simd_srli(fw, half_eq, fw/2)));
     145        return simd_or(ugt_0, simd_slli(32, ugt_0, fw/2));
     146    }
    141147    if (fw < 8) report_fatal_error("Unsupported field width: ugt " + std::to_string(fw));
    142148    return CreateSExt(CreateICmpUGT(fwCast(fw, a), fwCast(fw, b)), fwVectorType(fw));
     
    235241        Idxs[i] = ConstantInt::get(fwTy, i + field_count);
    236242    }
    237     Value * shuffle = simd_sub(fw, ConstantVector::get({Idxs, field_count}), simd_fill(fw, shift));
    238     Value * rslt = mvmd_shuffle2(fw, fwCast(fw, b), fwCast(fw, a), shuffle);
     243    Value * shuffle_indexes = simd_sub(fw, ConstantVector::get({Idxs, field_count}), simd_fill(fw, shift));
     244    Value * rslt = mvmd_shuffle2(fw, fwCast(fw, b), fwCast(fw, a), shuffle_indexes);
    239245    return rslt;
    240246}
     
    593599}
    594600
    595 Value * IDISA_Builder::mvmd_shuffle(unsigned fw, Value * a, Value * shuffle_table) {
     601Value * IDISA_Builder::mvmd_shuffle(unsigned fw, Value * table, Value * index_vector) {
    596602    report_fatal_error("Unsupported field width: mvmd_shuffle " + std::to_string(fw));
    597603}
    598604   
    599 Value * IDISA_Builder::mvmd_shuffle2(unsigned fw, Value * a, Value *b, Value * shuffle_table) {
     605Value * IDISA_Builder::mvmd_shuffle2(unsigned fw, Value * table0, Value * table1, Value * index_vector) {
    600606    //  Use two shuffles, with selection by the bit value within the shuffle_table.
    601607    const auto field_count = mBitBlockWidth/fw;
    602608    Constant * selectorSplat = ConstantVector::getSplat(field_count, ConstantInt::get(getIntNTy(fw), field_count));
    603     Value * selectMask = simd_eq(fw, simd_and(shuffle_table, selectorSplat), selectorSplat);
    604     Value * tbl = simd_and(shuffle_table, simd_not(selectorSplat));
    605     Value * rslt= simd_or(simd_and(mvmd_shuffle(fw, a, tbl), simd_not(selectMask)), simd_and(mvmd_shuffle(fw, b, tbl), selectMask));
     609    Value * selectMask = simd_eq(fw, simd_and(index_vector, selectorSplat), selectorSplat);
     610    Value * tbl = simd_and(index_vector, simd_not(selectorSplat));
     611    Value * rslt= simd_or(simd_and(mvmd_shuffle(fw, table0, index_vector), simd_not(selectMask)), simd_and(mvmd_shuffle(fw, table1, index_vector), selectMask));
    606612    return rslt;
    607613}
Note: See TracChangeset for help on using the changeset viewer.