source: icGREP/icgrep-devel/icgrep/kernels/radix64.h @ 5757

Last change on this file since 5757 was 5755, checked in by nmedfort, 19 months ago

Bug fixes and simplified MultiBlockKernel? logic

File size: 2.1 KB
Line 
1/*
2 *  Copyright (c) 2016 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 */
5#ifndef RADIX64_H
6#define RADIX64_H
7
8#include "kernel.h"
9
10namespace llvm { class Module; }
11namespace llvm { class Value; }
12
13namespace IDISA { class IDISA_Builder; }
14
15namespace kernel {
16
17/*  expand3_4 transforms a byte sequence by duplicating every third byte.
18    Each 3 bytes of the input abc produces a 4 byte output abcc.   
19    This is a useful preparatory transformation in various radix-64 encodings. */
20 
21class expand3_4Kernel final : public MultiBlockKernel {
22public:   
23    expand3_4Kernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
24    bool isCachable() const override { return true; }
25    bool hasSignature() const override { return false; }
26private:
27    llvm::Value * generateMultiBlockLogic(const std::unique_ptr<KernelBuilder> &iBuilder, llvm::Value * const numOfStrides) override;
28};
29
30class radix64Kernel final : public BlockOrientedKernel {
31public:
32    radix64Kernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
33    bool isCachable() const override { return true; }
34    bool hasSignature() const override { return false; }
35private:
36    virtual void generateDoBlockMethod(const std::unique_ptr<KernelBuilder> & iBuilder) override;
37    virtual void generateFinalBlockMethod(const std::unique_ptr<KernelBuilder> & iBuilder, llvm::Value * remainingBytes) override;
38    llvm::Value * processPackData(const std::unique_ptr<KernelBuilder> & iBuilder, llvm::Value* packData) const;
39};
40
41class base64Kernel final : public BlockOrientedKernel {
42public:
43    base64Kernel(const std::unique_ptr<kernel::KernelBuilder> & iBuilder);
44    bool isCachable() const override { return true; }
45    bool hasSignature() const override { return false; }
46private:
47    virtual void generateDoBlockMethod(const std::unique_ptr<KernelBuilder> & iBuilder) override;
48    virtual void generateFinalBlockMethod(const std::unique_ptr<KernelBuilder> & iBuilder, llvm::Value * remainingBytes) override;
49    llvm::Value* processPackData(const std::unique_ptr<KernelBuilder> & iBuilder, llvm::Value* packData) const;
50};
51
52}
53#endif
Note: See TracBrowser for help on using the repository browser.