我正在尝试在 PPC64-LE 上编译源文件。我正在使用 xlC 编译器并且编译失败。GCC 接受该程序,所以我不确定问题的原因是什么。
这是命令行:
$ 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.
这是源文件的相关部分。源文件是另一个问题的简化案例,它可以在 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 支持它。
第 118 行与上面显示的所有其他行一样,但它不会触发警告或错误。
有什么问题,我该如何解决?