Ignore:
Timestamp:
Dec 26, 2015, 12:09:11 PM (3 years ago)
Author:
cameron
Message:

Dynamic generation of s2p code

File:
1 edited

Legend:

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

    r4898 r4900  
    125125
    126126Value * IDISA_Builder::simd_if(unsigned fw, Value * cond, Value * a, Value * b) {
    127     Value * aVec = fwCast(fw, a);
    128     Value * bVec = fwCast(fw, b);
    129     return CreateSelect(CreateICmpSLT(cond, mZeroInitializer), aVec, bVec);
     127    if (fw == 1) {
     128        Value * c = bitCast(cond);
     129        return CreateOr(CreateAnd(c, bitCast(a)), CreateAnd(CreateNot(c), bitCast(b)));
     130    }
     131    else {
     132        Value * aVec = fwCast(fw, a);
     133        Value * bVec = fwCast(fw, b);
     134        return CreateSelect(CreateICmpSLT(cond, mZeroInitializer), aVec, bVec);
     135    }
    130136}
    131137
     
    184190    std::vector<Constant*> Idxs;
    185191    for (unsigned i = 0; i < field_count; i++) {
    186         Idxs.push_back(getInt32(2*i));
     192        Idxs.push_back(getInt32(2*i+1));
    187193    }
    188194    return CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs));
     
    195201    std::vector<Constant*> Idxs;
    196202    for (unsigned i = 0; i < field_count; i++) {
    197         Idxs.push_back(getInt32(2*i+1));
     203        Idxs.push_back(getInt32(2*i));
    198204    }
    199205    return CreateShuffleVector(aVec, bVec, ConstantVector::get(Idxs));
Note: See TracChangeset for help on using the changeset viewer.