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

Last change on this file since 5037 was 5037, checked in by nmedfort, 3 years ago

UnicodeSet? bug fix and compile warning clean-up.

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
11// Dynamic processor detection
12//#define ISPC_LLVM_VERSION ISPC_LLVM_3_6
13#include <util/ispc.h>
14
15namespace IDISA {
16   
17
18
19IDISA_Builder * GetIDISA_Builder(Module * mod) {
20    bool hasAVX2 = (strncmp(lGetSystemISA(), "avx2", 4) == 0);
21    unsigned theBlockSize = codegen::BlockSize;  // from command line
22   
23    if (theBlockSize == 0) {  // No BlockSize override: use processor SIMD width
24        theBlockSize = hasAVX2 ? 256 : 128;
25    }
26    Type * bitBlockType = VectorType::get(IntegerType::get(getGlobalContext(), 64), theBlockSize/64);
27   
28    int blockSize = bitBlockType->isIntegerTy() ? cast<IntegerType>(bitBlockType)->getIntegerBitWidth() : cast<VectorType>(bitBlockType)->getBitWidth();
29    if (blockSize >= 256) {
30        if (hasAVX2) {
31            return new IDISA_AVX2_Builder(mod, bitBlockType);
32        }
33        else{
34            return new IDISA_SSE2_Builder(mod, bitBlockType);
35        }
36    }
37    else if (blockSize == 64)
38        return new IDISA_I64_Builder(mod, bitBlockType);
39    return new IDISA_SSE2_Builder(mod, bitBlockType);
40}
41
42}
Note: See TracBrowser for help on using the repository browser.