source: icGREP/icgrep-devel/icgrep/IDISA/idisa_builder.h @ 4720

Last change on this file since 4720 was 4720, checked in by cameron, 4 years ago

Implementatation of the Pablo Count operation

File size: 2.5 KB
RevLine 
[4651]1#ifndef IDISA_BUILDER_H
2#define IDISA_BUILDER_H
3
4/*
5 *  Copyright (c) 2015 International Characters.
6 *  This software is licensed to the public under the Open Software License 3.0.
7 *  icgrep is a trademark of International Characters.
8 */
9#include <llvm/IR/Module.h>
10#include <llvm/IR/Type.h>
11#include <llvm/IR/Value.h>
12#include <llvm/IR/IRBuilder.h>
13
14using namespace llvm;
15
16namespace IDISA {
17
18class IDISA_Builder {
19public:
[4665]20
21    IDISA_Builder(Type * bitBlockType)
22    : mMod(nullptr)
23    , mLLVMBuilder(nullptr)
24    , mBitBlockType(bitBlockType)
25    , mBitBlockSize(bitBlockType->isIntegerTy() ? cast<IntegerType>(bitBlockType)->getIntegerBitWidth() : cast<VectorType>(bitBlockType)->getBitWidth()) {
26
[4651]27    }
[4665]28
29    void initialize(Module * m, IRBuilder <> * b) {
30        mMod = m;
31        mLLVMBuilder = b;
32    }
[4651]33       
34    Value * simd_add(unsigned fw, Value * a, Value * b);
35    Value * simd_sub(unsigned fw, Value * a, Value * b);
36    Value * simd_mult(unsigned fw, Value * a, Value * b);
37    Value * simd_eq(unsigned fw, Value * a, Value * b);
38    Value * simd_gt(unsigned fw, Value * a, Value * b);
39    Value * simd_ugt(unsigned fw, Value * a, Value * b);
40    Value * simd_lt(unsigned fw, Value * a, Value * b);
41    Value * simd_ult(unsigned fw, Value * a, Value * b);
42    Value * simd_max(unsigned fw, Value * a, Value * b);
43    Value * simd_umax(unsigned fw, Value * a, Value * b);
44    Value * simd_min(unsigned fw, Value * a, Value * b);
45    Value * simd_umin(unsigned fw, Value * a, Value * b);
46   
47    Value * simd_slli(unsigned fw, Value * a, unsigned shift);
48    Value * simd_srli(unsigned fw, Value * a, unsigned shift);
49    Value * simd_srai(unsigned fw, Value * a, unsigned shift);
50   
51    Value * simd_cttz(unsigned fw, Value * a);
[4720]52    Value * simd_popcount(unsigned fw, Value * a);
[4651]53   
[4652]54    Value * esimd_mergeh(unsigned fw, Value * a, Value * b);
55    Value * esimd_mergel(unsigned fw, Value * a, Value * b);
[4653]56   
57    Value * hsimd_packh(unsigned fw, Value * a, Value * b);
58    Value * hsimd_packl(unsigned fw, Value * a, Value * b);
59    Value * hsimd_signmask(unsigned fw, Value * a);
[4652]60
[4697]61   
62    Value * mvmd_extract(unsigned fw, Value * a, unsigned fieldIndex);
[4655]63    Value * mvmd_dslli(unsigned fw, Value * a, Value * b, unsigned shift);
[4662]64   
65    Value * bitblock_any(Value * a);
[4655]66
[4662]67
[4651]68private:
69    Module * mMod;
[4665]70    IRBuilder <> * mLLVMBuilder;
[4651]71    Type * mBitBlockType;
72    unsigned mBitBlockSize;
73   
74    Value * bitBlockCast(Value * a);
75    VectorType * fwVectorType(unsigned fw);
76    Value * fwCast(unsigned fw, Value * a);
77};
78
79}
80#endif // IDISA_BUILDER_H
Note: See TracBrowser for help on using the repository browser.