Ignore:
Timestamp:
May 19, 2018, 1:48:24 PM (17 months ago)
Author:
cameron
Message:

IDISA testing

File:
1 edited

Legend:

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

    r6024 r6050  
    152152    return std::pair<Value *, Value *>(shiftout, shifted);
    153153}
     154   
     155Value * IDISA_SSE2_Builder::mvmd_shuffle(unsigned fw, Value * a, Value * shuffle_table) {
     156    if ((mBitBlockWidth == 128) && (fw == 64)) {
     157        // First create a vector with exchanged values of the 2 fields.
     158        Constant * idx[2] = {ConstantInt::get(getInt32Ty(), 1), ConstantInt::get(getInt32Ty(), 0)};
     159        Value * exchanged = CreateShuffleVector(a, UndefValue::get(fwVectorType(fw)), ConstantVector::get({idx, 2}));
     160        // bits that change if we the value in a needs to be exchanged.
     161        Value * changed = simd_xor(a, exchanged);
     162        // Now create a mask to select between original and exchanged values.
     163        Constant * xchg[2] = {ConstantInt::get(getInt64Ty(), 1), ConstantInt::get(getInt64Ty(), 0)};
     164        Value * exchange_mask = simd_eq(fw, shuffle_table, ConstantVector::get({xchg, 2}));
     165        Value * rslt = simd_xor(simd_and(changed, exchange_mask), a);
     166        return rslt;
     167    }
     168    return IDISA_Builder::mvmd_shuffle(fw, a, shuffle_table);
     169}
    154170
    155171Value * IDISA_SSE_Builder::mvmd_compress(unsigned fw, Value * a, Value * selector) {
Note: See TracChangeset for help on using the changeset viewer.