2017-09-07 7 views
2

PPC64-LE에서 소스 파일을 컴파일하려고합니다. xlC 컴파일러를 사용하고 컴파일이 실패했습니다. GCC는 프로그램을 승인하므로 문제의 원인을 정확히 알지 못합니다.xlC 및 유형 "vector unsigned int"와 "int"사이의 연산이 허용되지 않습니다.

$ xlc test-p8.c -qarch=pwr8 -qaltivec -o test-p8.exe 

가 여기에 컴파일 오류입니다 :

"test-p8.c", line 113.52: 1506-324 (S) "int" cannot be converted to "vector unsigned int". 
"test-p8.c", line 120.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed. 
"test-p8.c", line 121.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed. 
"test-p8.c", line 122.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed. 
"test-p8.c", line 123.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed. 
"test-p8.c", line 124.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed. 
"test-p8.c", line 125.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed. 
"test-p8.c", line 126.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed. 
"test-p8.c", line 127.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed. 
"test-p8.c", line 128.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed. 
"test-p8.c", line 130.15: 1506-068 (S) Operation between types "vector unsigned int" and "int" is not allowed. 

여기 소스 파일의 관련 부분

다음은 명령 줄입니다. 소스 파일은 another problem의 경우가 소문자이며 그 파일은 available on GitHub입니다.

$ cat -n test-p8.c 
    ... 
    12 typedef unsigned char uint8_t; 
    13 typedef unsigned long long uint64_t; 
    14 typedef vector unsigned char uint8x16_p8; 
    15 typedef vector unsigned int uint64x2_p8; 
    ... 
    76 __attribute__((aligned(16))) 
    77 uint8_t ks[176] = { 
    78  0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x9, 0xcf, 0x4f, 0x3c, 
    ... 
    89 }; 
    ... 
    113 uint64x2_p8 block = (uint64x2_p8)vec_vsx_ld(0U, (const uint8_t*)plain); 
    ... 
    118 block = vec_xor(block, (uint64x2_p8)vec_ld(0U, (const uint8_t*)ks)); 
    ... 
    120 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(16U, (const uint8_t*)ks)); 
    121 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(32U, (const uint8_t*)ks)); 
    122 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(48U, (const uint8_t*)ks)); 
    123 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(64U, (const uint8_t*)ks)); 
    124 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(80U, (const uint8_t*)ks)); 
    125 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(96U, (const uint8_t*)ks)); 
    126 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(112U, (const uint8_t*)ks)); 
    127 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(128U, (const uint8_t*)ks)); 
    128 block = __builtin_crypto_vcipher(block, (uint64x2_p8)vec_ld(144U, (const uint8_t*)ks)); 
    129 
    130 block = __builtin_crypto_vcipherlast(block, (uint64x2_p8)vec_ld(160U, (const uint8_t*)ks)); 

__builtin_crypto_vcipher

내장의 GCC이며, IBM은 xlC supports it을 말한다.

줄 118은 위의 모든 다른 줄과 비슷하지만 경고 나 오류를 유발하지 않습니다.

무엇이 문제이며 어떻게 수정합니까?

답변

0

Operation between types "vector unsigned int" and "int" is not allowed

나는 이것을 추적했다고 생각합니다. xlC는 함수 __builtin_crypto_vcipher을 모르기 때문에 컴파일러는 함수가 int을 인수로 받거나 int을 반환한다고 가정합니다 (어느 순간에 어떤 것이 확실하지 않습니다). 나는 상응하는 GCC 메시지가 누락 된 선언에 관한 것이고 int 반환을 가정한다고 생각한다. 이 벡터에 int을 할당

__builtin_crypto_vcipher(block, ...) 

또는 :

나중에, 알 수없는 함수는 INT 대신 벡터 소요 내가 xlC가의 내장 __vcipher 문제로 전환

block = __builtin_crypto_vcipher(...) 

갔다.

docs가 xlC가 GCC 기본 제공을 허용하는 이유를 알지 못합니다.

1

redbook you linked to은 "IBM POWER8 프로세서를 포함한 IBM Power Systems 프로세서의 성능 최적화 및 조정 기법"에 관한 것으로 컴파일러 관련 사항은 아닙니다. 여기에는 XLC 및 GCC 컴파일러를 포함하여 POWER8의 컴파일러 지원에 대한 정보가 포함되어 있습니다. 섹션 7.3.1에서

의 레드 북 (171 페이지는 PDF 페이지를 넘기고을 사용하는 경우)의 149 페이지는 다음과 같은 지원이 적혀있다 :

  • GCC을 : vector unsigned long long __builtin_crypto_vcipher (vector unsigned long long, vector unsigned long long)
  • XL C/C++ : vector unsigned char __vcipher (vector unsigned char, vector unsigned char)

당신은 GCC로 컴파일하는 경우는 XLC 컴파일하는 경우, 당신은 __builtin_crypto_vcipher를 사용한다, __vcipher을 사용해야합니다.

+0

감사합니다. * "연결된 레드 북은 [내장되지 않은]"* - 잘못된 브라우저 탭 URL을 복사/붙여 넣은 것처럼 들립니다. 나는 컴파일러 매뉴얼이나 온라인 문서를 사용해야했다. 나는 더 이상 어떤 것을 기억하지 못한다. – jww

+0

Google 문서를 변경해야하는 곳을 발견하면 알려주십시오. 온라인 문서에서이 주제에 대한 [링크] (https://www.ibm.com/support/knowledgecenter/en/SSXVZZ_13.1.5/com.ibm.xlcpp1315.lelinux.doc/compiler_ref/bif_crypto_aes_vcipher.html)를 참조하십시오. – trudeaun

+0

다시 한번 감사드립니다. 이 경우 컴파일러 진단을 개선해야한다고 생각합니다. 컴파일러는 프로토 타입이나 선언되지 않은 함수없이'__builtin_crypto_vcipher'를 함수로 명시해야합니다. 'int'라는 말을'vector'로 변환 할 수 없다는 것은별로 도움이되지 않습니다. – jww

2

PPC64-LE에서는 GCC와 XL 사이의 벡터 내장형 인터페이스를 통합하기 위해 많은 노력을 기울였습니다. 두 팀은 ABI 문서에 일관된 인터페이스를 추가하기 위해 협력했습니다. 당신은 여기에서 찾을 수 있습니다

HTML의 ABI의 일부 PDF

새로운 vcipher 기능이 vec_cipher_be이다, xlC가 지원한다.

새로운 기능의 이유 중 일부는 이전 GCC 암호화 기능에서 허용하는 유형이 endianess 문제를 가지고 있다는 점에 유의하십시오.

관련 문제