2017-10-13 21 views
2

일부 Altivec 코드 경로를 활성화 할시기를 결정하려고합니다. -qaltivec이 적용될 때 전 처리기 매크로를 검사 할 때 해당 전 처리기 매크로가 표시되지 않습니다 (아래 참조).전 처리기에서 IBM XL/C 신호 Altivec가 지원합니까?

걱정이나 두려움은 -qaltivec-DALTIVEC=1 또는 그 유사품이 필요합니다. 사용자는 매뉴얼을 거의 읽지 않으므로 플랫폼에 대한 끝없는 질문 및 버그 보고서가 생성됩니다. RTFM이 작동하려면 지난 50 년 간 일어 났을 것입니다.

-qaltivec이 적용될 때 XL/C가 Altivec를 신호합니까? 그렇지 않다면 우리가 그것을 추론 할 수있는 다른 방법이 있습니까?

미리 감사드립니다.


다음은 Power7 시스템 인 GCC111입니다. 나는 왜 컴파일러가 Altivec가 지원되지 않는다고 주장하는지 모르겠습니다.

$ xlC -qshowmacros -qaltivec -E adhoc.cpp.proto | sort | egrep -iv 'sync' 
1506-1162 (W) The altivec option is not supported for the target architecture and is ignored. 
"adhoc.cpp.proto", line 2.10: 1506-296 (S) #include file <iosfwd> not found. 
"adhoc.cpp.proto", line 3.10: 1506-296 (S) #include file <string> not found. 
#define _AIX 1 
#define _AIX32 1 
#define _AIX41 1 
#define _AIX43 1 
#define _AIX50 1 
#define _AIX51 1 
#define _AIX52 1 
#define _AIX53 1 
#define _AIX61 1 
#define _AIX71 1 
#define _ARCH_COM 1 
#define _ARCH_PPC 1 
#define _BIG_ENDIAN 1 
#define _CHAR_UNSIGNED 1 
#define _IBMR2 1 
#define _ILP32 1 
#define _LONG_LONG 1 
#define _POWER 1 
#define __ALIGN 1 
#define __BASE_FILE__ "adhoc.cpp.proto" 
#define __BIG_ENDIAN__ 1 
#define __BOOL__ 1 
#define __C99_BOOL 1 
#define __C99_COMPLEX 1 
#define __C99_COMPOUND_LITERAL 1 
#define __C99_CPLUSCMT 1 
#define __C99_DESIGNATED_INITIALIZER 1 
#define __C99_DUP_TYPE_QUALIFIER 1 
#define __C99_EMPTY_MACRO_ARGUMENTS 1 
#define __C99_FLEXIBLE_ARRAY_MEMBER 1 
#define __C99_HEX_FLOAT_CONST 1 
#define __C99_INLINE 1 
#define __C99_LLONG 1 
#define __C99_MACRO_WITH_VA_ARGS 1 
#define __C99_MAX_LINE_NUMBER 1 
#define __C99_MIXED_DECL_AND_CODE 1 
#define __C99_MIXED_STRING_CONCAT 1 
#define __C99_NON_CONST_AGGR_INITIALIZER 1 
#define __C99_NON_LVALUE_ARRAY_SUB 1 
#define __C99_PRAGMA_OPERATOR 1 
#define __C99_RESTRICT 1 
#define __C99_STATIC_ARRAY_SIZE 1 
#define __C99_STD_PRAGMAS 1 
#define __C99_TGMATH 1 
#define __C99_UCN 1 
#define __C99_VAR_LEN_ARRAY 1 
#define __C99__FUNC__ 1 
#define __CHAR_UNSIGNED__ 1 
#define __DIGRAPHS__ 1 
#define __FENCE 1 
#define __FUNCTION__ __FUNCTION__ 
#define __GCC_PROTO_OVERRIDES_KNR_DEF 1 
#define __HHW_BIG_ENDIAN__ 1 
#define __HHW_RS6000__ 1 
#define __HOS_AIX__ 1 
#define __IBMC_NORETURN 1 
#define __IBMC_STATIC_ASSERT 1 
#define __IBMC__ 1210 
#define __IBM_ALIGNOF__ 1 
#define __IBM_ATTRIBUTES 1 
#define __IBM_COMPUTED_GOTO 1 
#define __IBM_DOLLAR_IN_ID 1 
#define __IBM_EXTENSION_KEYWORD 1 
#define __IBM_GCC_ASM 1 
#define __IBM_GCC__INLINE__ 1 
#define __IBM_GENERALIZED_LVALUE 1 
#define __IBM_INCLUDE_NEXT 1 
#define __IBM_LABEL_VALUE 1 
#define __IBM_LOCAL_LABEL 1 
#define __IBM_MACRO_WITH_VA_ARGS 1 
#define __IBM_NESTED_FUNCTION 1 
#define __IBM_PP_PREDICATE 1 
#define __IBM_PP_WARNING 1 
#define __IBM_REGISTER_VARS 1 
#define __IBM__IMAG__ 1 
#define __IBM__REAL__ 1 
#define __IBM__TYPEOF__ 1 
#define __ILP32__ 1 
#define __LONGDOUBLE64 1 
#define __MATH__ 1 
#define __PPC 1 
#define __PPC__ 1 
#define __SIZE_TYPE__ unsigned int 
#define __STDC_HOSTED__ 1 
#define __STDC_VERSION__ 199901L 
#define __STDC__ 1 
#define __STR__ 1 
#define __THW_BIG_ENDIAN__ 1 
#define __THW_PPC__ 1 
#define __THW_RS6000__ 1 
#define __TOS_AIX__ 1 
#define __XLC121__ 1 
#define __XLC13__ 1 
#define __XLC_BUILTIN_VAARG__ 1 
#define __alignof __alignof__ 
#define __const const 
#define __const__ const 
#define __powerpc 1 
#define __powerpc__ 1 
#define __signed signed 
#define __signed__ signed 
#define __typeof __typeof__ 
#define __unix 1 
#define __unix__ 1 
#define __volatile volatile 
#define __volatile__ volatile 
#define __xlC__ 0x0c01 
#define __xlC_ver__ 0x00000000 
#define __xlc__ "12.1.0.0" 

답변

2

대부분의 컴파일러 (GCC )가 자동으로 정의하는 것이 일반적인 매크로 __VEC__ (또는 적어도이 나는 보통 크로스 플랫폼 코드에서 알티 벡을 테스트하는 데 사용하는 상징이다). -maltivec 또는 -qaltivec을 사용할 때 xlc에 대해 IBM claims that __ALTIVEC__ is also defined ("사전 정의 된 매크로"참조)

+1

감사합니다. @Paul. [IBM 매뉴얼] (https://www-01.ibm.com/support/docview.wss?uid=swg27024811)에서'__VEC__'을 보았지만 위와 같이 존재하지 않습니다. XL C/C++에서'-qaltivec'가 지원되지 않는 옵션이라고 주장하는 것을 정말로 이해하지 못합니다. 그건 내 말이 맞지 않아. 그러나 컴파일러에 공평하게''을 포함하고'__vector'를 사용하려고하면 알 수없는 유형의 컴파일 오류가 발생합니다. 그래서 컴파일러는 실제로 혼란 스럽습니다. – jww

+2

Altivec는 벡터 단위가있는 CPU에서만 지원됩니다. AIX에서 XLC의 기본 CPU 아키텍처는 pwr4로 OS에 필요한 최소 CPU입니다. pwr4에는 벡터 단위가 없으므로 XLC에서 본 오류가 발생했습니다. 이 문제를 해결하려면 -qarch = pwr7 또는 -qarch = auto를 추가하십시오. –