source: icGREP/icgrep-devel/icgrep/IDISA/idisa_target.cpp @ 5175

Last change on this file since 5175 was 5175, checked in by cameron, 3 years ago

Some tidy ups and changes to prepare for LLVM 3.9

File size: 1.3 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
6#include <toolchain.h>
7#include <IDISA/idisa_avx_builder.h>
8#include <IDISA/idisa_sse_builder.h>
9#include <IDISA/idisa_i64_builder.h>
10#include <IDISA/idisa_nvptx_builder.h>
11
12namespace IDISA {
13   
14
15
16IDISA_Builder * GetIDISA_Builder(Module * mod) {
17    bool hasAVX2 = AVX2_available();
18    unsigned theBlockSize = codegen::BlockSize;  // from command line
19   
20    if (theBlockSize == 0) {  // No BlockSize override: use processor SIMD width
21        theBlockSize = hasAVX2 ? 256 : 128;
22    }
23    Type * bitBlockType = VectorType::get(IntegerType::get(mod->getContext(), 64), theBlockSize/64);
24   
25    int blockSize = bitBlockType->isIntegerTy() ? cast<IntegerType>(bitBlockType)->getIntegerBitWidth() : cast<VectorType>(bitBlockType)->getBitWidth();
26    if (blockSize >= 256) {
27        if (hasAVX2) {
28            return new IDISA_AVX2_Builder(mod, bitBlockType);
29        }
30        else{
31            return new IDISA_SSE2_Builder(mod, bitBlockType);
32        }
33    }
34    else if (blockSize == 64)
35        return new IDISA_I64_Builder(mod, bitBlockType);
36    return new IDISA_SSE2_Builder(mod, bitBlockType);
37}
38
39IDISA_Builder * GetIDISA_GPU_Builder(Module * mod) {
40    return new IDISA_NVPTX20_Builder(mod, 64);
41}
42
43}
Note: See TracBrowser for help on using the repository browser.