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

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

Add bitblock_any to IDISA, return signmask of N fields as iN

File size: 2.3 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:
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   
[4652]44    Value * esimd_mergeh(unsigned fw, Value * a, Value * b);
45    Value * esimd_mergel(unsigned fw, Value * a, Value * b);
[4653]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);
[4652]50
[4655]51    Value * mvmd_dslli(unsigned fw, Value * a, Value * b, unsigned shift);
[4662]52   
53    Value * bitblock_any(Value * a);
[4655]54
[4662]55
[4651]56private:
57    Module * mMod;
58    IRBuilder <> * llvm_builder;
59    Type * mBitBlockType;
60    unsigned mBitBlockSize;
61   
62    Value * bitBlockCast(Value * a);
63    VectorType * fwVectorType(unsigned fw);
64    Value * fwCast(unsigned fw, Value * a);
65};
66
67}
68#endif // IDISA_BUILDER_H
Note: See TracBrowser for help on using the repository browser.