source: icGREP/icgrep-devel/icgrep/IR_Gen/idisa_avx_builder.h @ 5979

Last change on this file since 5979 was 5979, checked in by cameron, 18 months ago

mvmd_slli override for AVX-512 in support of u8u16

File size: 3.2 KB
RevLine 
[4892]1#ifndef IDISA_AVX_BUILDER_H
2#define IDISA_AVX_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*/
8
[5238]9#include <IR_Gen/idisa_sse_builder.h>
[4892]10
11namespace IDISA {
12
[5118]13class IDISA_AVX_Builder : public IDISA_SSE2_Builder {
[4892]14public:
[5931]15
[5489]16    IDISA_AVX_Builder(llvm::LLVMContext & C, unsigned vectorWidth, unsigned stride)
17    : IDISA_Builder(C, vectorWidth, stride)
18    , IDISA_SSE2_Builder(C, vectorWidth, stride)
[5435]19    {
20
[4892]21    }
[5425]22
[5374]23    virtual std::string getBuilderUniqueName() override;
[5435]24
[5464]25    llvm::Value * hsimd_signmask(unsigned fw, llvm::Value * a) override;
[5435]26
[5217]27    ~IDISA_AVX_Builder() {}
[4892]28
29};
30
31class IDISA_AVX2_Builder : public IDISA_AVX_Builder {
32public:
[5931]33
[5489]34    IDISA_AVX2_Builder(llvm::LLVMContext & C, unsigned vectorWidth, unsigned stride)
35    : IDISA_Builder(C, vectorWidth, stride)
36    , IDISA_AVX_Builder(C, vectorWidth, stride) {
[5435]37
[4892]38    }
[5425]39
[5374]40    virtual std::string getBuilderUniqueName() override;
[5464]41    llvm::Value * hsimd_packh(unsigned fw, llvm::Value * a, llvm::Value * b) override;
42    llvm::Value * hsimd_packl(unsigned fw, llvm::Value * a, llvm::Value * b) override;
43    llvm::Value * esimd_mergeh(unsigned fw, llvm::Value * a, llvm::Value * b) override;
44    llvm::Value * esimd_mergel(unsigned fw, llvm::Value * a, llvm::Value * b) override;
45    llvm::Value * hsimd_packh_in_lanes(unsigned lanes, unsigned fw, llvm::Value * a, llvm::Value * b) override;
46    llvm::Value * hsimd_packl_in_lanes(unsigned lanes, unsigned fw, llvm::Value * a, llvm::Value * b) override;
47    std::pair<llvm::Value *, llvm::Value *> bitblock_add_with_carry(llvm::Value * a, llvm::Value * b, llvm::Value * carryin) override;
[5713]48    std::pair<llvm::Value *, llvm::Value *> bitblock_indexed_advance(llvm::Value * a, llvm::Value * index_strm, llvm::Value * shiftin, unsigned shift) override;
[5884]49    llvm::Value * hsimd_signmask(unsigned fw, llvm::Value * a) override;
[4957]50
[5217]51    ~IDISA_AVX2_Builder() {}
[4892]52};
[5931]53
[5975]54class IDISA_AVX512F_Builder : public IDISA_AVX2_Builder {
[5871]55public:
[5931]56
[5975]57    IDISA_AVX512F_Builder(llvm::LLVMContext & C, unsigned vectorWidth, unsigned stride)
[5931]58    : IDISA_Builder(C, vectorWidth, stride)
59    , IDISA_AVX2_Builder(C, vectorWidth, stride) {
[5977]60        getAVX512Features();
[5871]61    }
[5931]62
63    virtual std::string getBuilderUniqueName() override;
[5977]64    void getAVX512Features();
[5931]65    llvm::Value * hsimd_packh(unsigned fw, llvm::Value * a, llvm::Value * b) override;
66    llvm::Value * hsimd_packl(unsigned fw, llvm::Value * a, llvm::Value * b) override;
[5977]67    llvm::Value * esimd_bitspread(unsigned fw, llvm::Value * bitmask) override;
68    llvm::Value * simd_popcount(unsigned fw, llvm::Value * a) override;
[5979]69    llvm::Value * mvmd_slli(unsigned fw, llvm::Value * a, unsigned shift) override;
[5978]70    llvm::Value * hsimd_signmask(unsigned fw, llvm::Value * a) override;
[5976]71
[5977]72    ~IDISA_AVX512F_Builder() {
73    }
74private:
75    struct Features {
76        //not an exhaustive list, can be extended if needed
77        bool hasAVX512CD = false;
78        bool hasAVX512BW = false;
79        bool hasAVX512DQ = false;
80        bool hasAVX512VL = false;
81        bool hasAVX512VBMI = false;
82        bool hasAVX512VBMI2 = false;
83        bool hasAVX512VPOPCNTDQ = false;
84    };
85    Features hostCPUFeatures;
[5871]86};
87
[5931]88
[4892]89}
90#endif // IDISA_AVX_BUILDER_H
Note: See TracBrowser for help on using the repository browser.