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

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

packh, packl, signmask

File size: 2.2 KB
Line 
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:
20    IDISA_Builder(Module * m, IRBuilder <> * b, Type * bitBlockType): mMod(m), llvm_builder(b), mBitBlockType(bitBlockType) {
21        if (bitBlockType->isIntegerTy()) mBitBlockSize = dyn_cast<IntegerType>(bitBlockType)-> getIntegerBitWidth();
22        else mBitBlockSize = dyn_cast<VectorType>(bitBlockType)-> getBitWidth();
23    }
24       
25    Value * simd_add(unsigned fw, Value * a, Value * b);
26    Value * simd_sub(unsigned fw, Value * a, Value * b);
27    Value * simd_mult(unsigned fw, Value * a, Value * b);
28    Value * simd_eq(unsigned fw, Value * a, Value * b);
29    Value * simd_gt(unsigned fw, Value * a, Value * b);
30    Value * simd_ugt(unsigned fw, Value * a, Value * b);
31    Value * simd_lt(unsigned fw, Value * a, Value * b);
32    Value * simd_ult(unsigned fw, Value * a, Value * b);
33    Value * simd_max(unsigned fw, Value * a, Value * b);
34    Value * simd_umax(unsigned fw, Value * a, Value * b);
35    Value * simd_min(unsigned fw, Value * a, Value * b);
36    Value * simd_umin(unsigned fw, Value * a, Value * b);
37   
38    Value * simd_slli(unsigned fw, Value * a, unsigned shift);
39    Value * simd_srli(unsigned fw, Value * a, unsigned shift);
40    Value * simd_srai(unsigned fw, Value * a, unsigned shift);
41   
42    Value * simd_cttz(unsigned fw, Value * a);
43   
44    Value * esimd_mergeh(unsigned fw, Value * a, Value * b);
45    Value * esimd_mergel(unsigned fw, Value * a, Value * b);
46   
47    Value * hsimd_packh(unsigned fw, Value * a, Value * b);
48    Value * hsimd_packl(unsigned fw, Value * a, Value * b);
49    Value * hsimd_signmask(unsigned fw, Value * a);
50
51private:
52    Module * mMod;
53    IRBuilder <> * llvm_builder;
54    Type * mBitBlockType;
55    unsigned mBitBlockSize;
56   
57    Value * bitBlockCast(Value * a);
58    VectorType * fwVectorType(unsigned fw);
59    Value * fwCast(unsigned fw, Value * a);
60};
61
62}
63#endif // IDISA_BUILDER_H
Note: See TracBrowser for help on using the repository browser.