2014-10-20 3 views
0

g ++ 4.9.1로 NEON 데이터 유형으로 일부 코드를 크로스 컴파일하려고하지만 컴파일러가 계속 충돌합니다. 이 유형의 연산이 허용되지 않습니까? 아니면이 문제가 컴파일러 문제입니까? 제 OS는 우분투 12.04이고, 나는 "GCC 버전 4.9.1 (우분투/리나 4.9.1-10ubuntu2)"ARM NEON 데이터 유형으로 컴파일러가 작동하지 않습니다.

파일 이름 팔-GCC를 사용하고 있습니다 : crash.cpp

#include <arm_neon.h> 

void crash(
    const unsigned short * in, 
    unsigned short * out, 
    const int shift) 
{ 
    for(int x=0; x<200; x+=8) { 
    const uint16x8_t inValue = vld1q_u16(&in[x]); 

    const uint16x8_t normalizedValue = inValue >> shift; 

    vst1q_u16(&out[x], normalizedValue); 
    } 
} 

컴파일 옵션 :

arm-linux-gnueabihf-g++-4.9 -mfpu=neon-vfpv4 -c crash.cpp -o crash.o 

출력 :

crash.cpp: In function ‘void crash(const short unsigned int*, short unsigned int*, int)’: 
crash.cpp:11:51: internal compiler error: in copy_to_mode_reg, at explow.c:654 
    const uint16x8_t normalizedValue = inValue >> shift; 
               ^
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions. 
Preprocessed source stored into /tmp/ccfz4aZr.out file, please attach this to your bugreport. 

내가 바꿀 경우이 코드는 잘 컴파일 "서명되지 않은 INT"를 "uint16x8_과 함께"서명되지 않은 짧은 " t "에는"uint32x4_t ","_u16 "접미사에는"_u32 "접미어가 붙습니다.

+0

GCC는 내장 유형에 대해 자동으로 과부하 된 연산자를 제공합니까? 나는 명시 적 intrisics (이 경우에는'vshl')로 모든 것을해야한다고 생각했을 것입니다. – Notlikethat

+0

automagic 시프트는 일반 int로 작동하지만 16 비트 short int와 충돌합니다. – Pete

+0

GCC에서 버그 리포트를 만들었습니까? – auselen

답변

2

이것은 컴파일러 버그이므로 내부 컴파일러 오류가 발생하지 않아야합니다.

NEON 내장 함수로 시프트를 수행하면이 문제를 해결할 수 있습니다. NEON 내장 함수 정의에는 NEON 유형에서 C 연산자 사용이 포함되지 않으므로 다른 컴파일러에 비해 이식성이 뛰어납니다. 이는 GCC 확장입니다.

#include <arm_neon.h> 

void crash(
    const unsigned short * in, 
    unsigned short * out, 
    const int shift) 
{ 
    int16x8_t vshift = vdupq_n_s16(-shift); 
    for(int x=0; x<200; x+=8) { 
    const uint16x8_t inValue = vld1q_u16(&in[x]); 

    const uint16x8_t normalizedValue = vshlq_u16(inValue, vshift); 

    vst1q_u16(&out[x], normalizedValue); 
    } 
} 
관련 문제