Ignore:
Timestamp:
Mar 26, 2017, 9:50:43 AM (2 years ago)
Author:
cameron
Message:

Unique names for IDISA builders

Location:
icGREP/icgrep-devel/icgrep/IR_Gen
Files:
10 edited

Legend:

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

    r5371 r5374  
    397397}
    398398
    399 Value * CBuilder::CreateCeilLog2(Value * const value) {
     399Value * CBuilder::CreateCeilLog2(Value * value) {
    400400    IntegerType * ty = cast<IntegerType>(value->getType());
    401401    CreateAssert(value, "CreateCeilLog2: value cannot be zero");
    402     Value * v = CreateSub(value, ConstantInt::get(ty, 1));
    403     Value * m = CreateCall(Intrinsic::getDeclaration(mMod, Intrinsic::ctlz, ty), {v, ConstantInt::getFalse(getContext())});
    404     return CreateSub(ConstantInt::get(m->getType(), ty->getBitWidth()), m);
     402    Value * m = CreateCall(Intrinsic::getDeclaration(mMod, Intrinsic::ctlz, ty), {value, ConstantInt::getFalse(getContext())});
     403    Value * isPowOf2 = CreateICmpEQ(CreateAnd(value, CreateSub(value, ConstantInt::get(ty, 1))), ConstantInt::getNullValue(ty));
     404    m = CreateSub(ConstantInt::get(m->getType(), ty->getBitWidth() - 1), m);
     405    return CreateSelect(isPowOf2, m, CreateAdd(m, ConstantInt::get(m->getType(), 1)));
    405406}
    406407
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_avx_builder.cpp

    r5309 r5374  
    88
    99namespace IDISA {
     10   
     11std::string IDISA_AVX_Builder::getBuilderUniqueName() { return mBitBlockWidth != 256 ? "AVX_" + std::to_string(mBitBlockWidth) : "AVX";}
     12std::string IDISA_AVX2_Builder::getBuilderUniqueName() { return mBitBlockWidth != 256 ? "AVX2_" + std::to_string(mBitBlockWidth) : "AVX2";}
    1013
    1114Value * IDISA_AVX_Builder::hsimd_signmask(unsigned fw, Value * a) {
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_avx_builder.h

    r5238 r5374  
    1919    : IDISA_SSE2_Builder(m, archBitWidth, bitBlockWidth) {
    2020    }
    21 
     21    virtual std::string getBuilderUniqueName() override;
    2222    Value * hsimd_signmask(unsigned fw, Value * a) override;
    2323    ~IDISA_AVX_Builder() {}
     
    3131    : IDISA_AVX_Builder(m, archBitWidth, bitBlockWidth) {
    3232    }
    33 
     33    virtual std::string getBuilderUniqueName() override;
    3434    Value * hsimd_packh(unsigned fw, Value * a, Value * b) override;
    3535    Value * hsimd_packl(unsigned fw, Value * a, Value * b) override;
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_builder.h

    r5350 r5374  
    2323
    2424    virtual ~IDISA_Builder();
     25   
     26    virtual std::string getBuilderUniqueName() = 0;  // A name uniquely identifying builder/bitBlockWidth/stride.
    2527   
    2628    std::string getBitBlockTypeName() const;  // A short string such as v4i64 or i256.
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_i64_builder.cpp

    r5309 r5374  
    88
    99namespace IDISA {
     10   
     11std::string IDISA_I64_Builder::getBuilderUniqueName() { return mBitBlockWidth != 64 ? "C" + std::to_string(mBitBlockWidth) : "C";}
    1012
    1113Value * IDISA_I64_Builder::hsimd_packh(unsigned fw, Value * a, Value * b) {
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_i64_builder.h

    r5350 r5374  
    1919    : IDISA_Builder(m, archBitWidth, bitBlockWidth, stride, SupportsIndirectBr) {
    2020    }
     21    virtual std::string getBuilderUniqueName() override;
    2122
    2223    Value * hsimd_packh(unsigned fw, Value * a, Value * b) override;
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_nvptx_builder.cpp

    r5309 r5374  
    1010
    1111namespace IDISA {
     12   
     13std::string IDISA_NVPTX20_Builder::getBuilderUniqueName() { return "NVPTX20_" + std::to_string(groupThreads);}
    1214
    1315int IDISA_NVPTX20_Builder::getGroupThreads(){
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_nvptx_builder.h

    r5350 r5374  
    2727   
    2828    ~IDISA_NVPTX20_Builder() {}
    29 
     29    virtual std::string getBuilderUniqueName() override;
    3030    int getGroupThreads();
    3131   
     
    6868
    6969    ~IDISA_NVPTX35_Builder() {};
    70 
     70    virtual std::string getBuilderUniqueName() override;
    7171};
    7272#endif   
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_sse_builder.cpp

    r5309 r5374  
    88
    99namespace IDISA {
     10
     11std::string IDISA_SSE_Builder::getBuilderUniqueName() { return mBitBlockWidth != 128 ? "SSE_" + std::to_string(mBitBlockWidth) : "SSE";}
     12std::string IDISA_SSE2_Builder::getBuilderUniqueName() { return mBitBlockWidth != 128 ? "SSE2_" + std::to_string(mBitBlockWidth) : "SSE2";}
    1013
    1114Value * IDISA_SSE2_Builder::hsimd_packh(unsigned fw, Value * a, Value * b) {
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_sse_builder.h

    r5238 r5374  
    2020    : IDISA_Builder(m, archBitWidth, bitBlockWidth, bitBlockWidth) {
    2121    }
    22 
     22    virtual std::string getBuilderUniqueName() override;
    2323    Value * hsimd_signmask(unsigned fw, Value * a) override;
    2424    ~IDISA_SSE_Builder() {}
     
    3232    : IDISA_SSE_Builder(m, archBitWidth, bitBlockWidth) {
    3333    }
    34 
     34    virtual std::string getBuilderUniqueName() override;
    3535    Value * hsimd_signmask(unsigned fw, Value * a) override;
    3636    Value * hsimd_packh(unsigned fw, Value * a, Value * b) override;
Note: See TracChangeset for help on using the changeset viewer.