Changeset 6012


Ignore:
Timestamp:
May 4, 2018, 1:44:05 PM (2 weeks ago)
Author:
cameron
Message:

Fix for mvmd_compress

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

Legend:

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

    r5998 r6012  
    420420    CreateAssertZero(CreateURem(size, align), "CreateAlignedMalloc: size must be an integral multiple of alignment.");
    421421    Value * ptr = nullptr;
    422     if (hasAlignedAlloc()) {
     422    if (hasPosixMemalign()) {
     423        Function * f = m->getFunction("posix_memalign");
     424        if (LLVM_UNLIKELY(f == nullptr)) {
     425            FunctionType * const fty = FunctionType::get(getInt32Ty(), {voidPtrTy->getPointerTo(), sizeTy, sizeTy}, false);
     426            f = Function::Create(fty, Function::ExternalLinkage, "posix_memalign", m);
     427            f->setCallingConv(CallingConv::C);
     428        }
     429        Value * handle = CreateAlloca(voidPtrTy);
     430        CallInst * success = CreateCall(f, {handle, align, size});
     431        if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
     432            CreateAssertZero(success, "CreateAlignedMalloc: posix_memalign reported bad allocation");
     433        }
     434        ptr = CreateLoad(handle);
     435    } else if (hasAlignedAlloc()) {
    423436        Function * f = m->getFunction("aligned_alloc");
    424437        if (LLVM_UNLIKELY(f == nullptr)) {
     
    429442        }
    430443        ptr = CreateCall(f, {align, size});
    431     } else if (hasPosixMemalign()) {
    432         Function * f = m->getFunction("posix_memalign");
    433         if (LLVM_UNLIKELY(f == nullptr)) {
    434             FunctionType * const fty = FunctionType::get(getInt32Ty(), {voidPtrTy->getPointerTo(), sizeTy, sizeTy}, false);
    435             f = Function::Create(fty, Function::ExternalLinkage, "posix_memalign", m);
    436             f->setCallingConv(CallingConv::C);
    437         }
    438         Value * handle = CreateAlloca(voidPtrTy);
    439         CallInst * success = CreateCall(f, {handle, align, size});
    440         if (codegen::DebugOptionIsSet(codegen::EnableAsserts)) {
    441             CreateAssertZero(success, "CreateAlignedMalloc: posix_memalign reported bad allocation");
    442         }
    443         ptr = CreateLoad(handle);
    444444    } else {
    445445        report_fatal_error("stdlib.h does not contain either aligned_alloc or posix_memalign");
  • icGREP/icgrep-devel/icgrep/IR_Gen/idisa_avx_builder.cpp

    r6011 r6012  
    312312        }
    313313        Value * compress = CreateCall(shuf32Func, {a, CreateLShr(bdcst, ConstantVector::get({Shifts, 8}))});
    314         Value * selectf = CreateBitCast(CreateSub(CreateShl(getInt32(1), field_count), getInt32(1)), v8xi1Ty);
     314        Value * selectf = CreateBitCast(CreateTrunc(CreateSub(CreateShl(getInt32(1), field_count), getInt32(1)), getInt8Ty()), v8xi1Ty);
    315315        return CreateSelect(selectf, ConstantVector::getNullValue(v8xi32Ty), compress);
    316316    }
Note: See TracChangeset for help on using the changeset viewer.