Ignore:
Timestamp:
May 10, 2016, 12:12:41 AM (3 years ago)
Author:
nmedfort
Message:

UnicodeSet? bug fix and compile warning clean-up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/icgrep/util/ispc.cpp

    r5033 r5037  
    3737
    3838#include "ispc.h"
    39 #include <stdlib.h>
     39#include <stdexcept>
    4040
    4141///////////////////////////////////////////////////////////////////////////
     
    4343
    4444#if !defined(ISPC_IS_WINDOWS) && !defined(__arm__)
    45 static void __cpuid(int info[4], int infoType) {
    46     __asm__ __volatile__ ("cpuid"
    47                           : "=a" (info[0]), "=b" (info[1]), "=c" (info[2]), "=d" (info[3])
    48                           : "0" (infoType));
     45#include <cpuid.h> // supplied by clang and gcc
     46static inline void cpuid(int info[4], int level) {
     47    __cpuid(level, info[0], info[1], info[2], info[3]);
    4948}
    5049
    51 /* Save %ebx in case it's the PIC register */
    52 static void __cpuidex(int info[4], int level, int count) {
    53   __asm__ __volatile__ ("xchg{l}\t{%%}ebx, %1\n\t"
    54                         "cpuid\n\t"
    55                         "xchg{l}\t{%%}ebx, %1\n\t"
    56                         : "=a" (info[0]), "=r" (info[1]), "=c" (info[2]), "=d" (info[3])
    57                         : "0" (level), "2" (count));
     50static void cpuid_count(int info[4], int level, int count) {
     51    __cpuid_count(level, count, info[0], info[1], info[2], info[3]);
     52}
     53#else
     54static inline void cpuid(int info[4], int level) {
     55    __cpuid(info, level);
     56}
     57
     58static void cpuid_count(int info[4], int level, int count) {
     59    __cpuidex(info, level, count);
    5860}
    5961#endif // !ISPC_IS_WINDOWS && !__ARM__
     
    98100#else
    99101    int info[4];
    100     __cpuid(info, 1);
     102    cpuid(info, 1);
    101103
    102104    int info2[4];
    103105    // Call cpuid with eax=7, ecx=0
    104     __cpuidex(info2, 7, 0);
     106    cpuid_count(info2, 7, 0);
    105107
    106108    if ((info[2] & (1 << 27)) != 0 &&  // OSXSAVE
     
    148150        return "sse2-i32x4";
    149151    else {
    150         //Error(SourcePos(), "Unable to detect supported SSE/AVX ISA.  Exiting.");
    151        
    152         exit(1);
     152        throw std::runtime_error("Unable to detect supported SSE/AVX ISA.");
    153153    }
    154154#endif
Note: See TracChangeset for help on using the changeset viewer.