PPC Altivec: Killed - processing time exceeded
Testcase:
extern void flag(unsigned long);
static __inline__ int
vec_all_eq(vector unsigned char __a, vector unsigned char __b) {
return __builtin_altivec_vcmpequb_p(2, (vector char)__a, (vector char)__b);
}
static __inline__ vector unsigned char
vec_perm(vector unsigned char __a, vector unsigned char __b,
vector unsigned char __c) {
return (vector unsigned char)__builtin_altivec_vperm_4si(
(vector int)__a, (vector int)__b, __c);
}
int t2(void) {
unsigned long msr;
__vector unsigned char a = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF};
__vector unsigned char b = {0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF};
__vector unsigned char c = {0x01, 0x14, 0x18, 0x10, 0x06, 0x15,
0x19, 0x1A, 0x1C, 0x1C, 0x1C, 0x13,
0x08, 0x1D, 0x1B, 0x0E};
__vector unsigned char s = {161, 180, 184, 176, 166, 181, 185, 186,
188, 188, 188, 179, 168, 189, 187, 174};
__vector unsigned char r;
r = vec_perm(a, b, c);
if (!vec_all_eq(s, r)) {
flag(msr);
return 1;
}
return 0;
}
Compile options:
-mcpu=a2 -msoft-float --target=ppc32 -O2 -maltivec
Error:
Killed - processing time exceeded
Compiler returned: 143
@llvm/issue-subscribers-backend-powerpc
I'll have a look. It seems that -msoft-float is disabling -maltivec.
I'll have a look. It seems that
-msoft-floatis disabling-maltivec.
Maybe the same thing is happening with #55555 as well? If -msoft-float is removed from the other defect, it then compiles just fine.
I looked at the code. Making Altivec dependent on hard float actually makes sense. Can you elaborate on the use case for Altivec with soft float?
I was comparing this with GCC, but looking at the generated code when using -msoft-float and -mhard-float, GCC actually generates the same code -- probably they silently use -mhard-float instead.
I believe #55555 can be closed in the same manner, right? Will you do this, or shall I?
I think it would be better from the perspective of usability if the compiler actually diagnosed this rather than doing weird things like crashing. What I have in mind is something like existing diagnostics for VSX and its sub-features:
$ clang -mno-vsx -mpower8-vector test.c -S
error: option '-mpower8-vector' cannot be specified with '-mno-vsx'
Except it would be something like:
error: option '-msoft-float' cannot be specified with '-maltivec'
Sounds good. I'll leave this defect open and close the other one.
Proposed fix in https://reviews.llvm.org/D126302
@nemanjai Hi, Nemanjai, is it possible to move https://reviews.llvm.org/D126302 to Github PR? Let me know if you need me or others to do it. Thank you.
@nemanjai Hi, Nemanjai, is it possible to move https://reviews.llvm.org/D126302 to Github PR? Let me know if you need me or others to do it. Thank you.
Hi @chenzheng1030 would you be able to take the patch over? TBH, I forgot about it.
@nemanjai Hi, Nemanjai, is it possible to move https://reviews.llvm.org/D126302 to Github PR? Let me know if you need me or others to do it. Thank you.
Hi @chenzheng1030 would you be able to take the patch over? TBH, I forgot about it.
Sure, https://github.com/llvm/llvm-project/pull/79109 is posted
@llvm/issue-subscribers-clang-driver
Author: Laurentiu Tertan (ltertan)
extern void flag(unsigned long);
static __inline__ int
vec_all_eq(vector unsigned char __a, vector unsigned char __b) {
return __builtin_altivec_vcmpequb_p(2, (vector char)__a, (vector char)__b);
}
static __inline__ vector unsigned char
vec_perm(vector unsigned char __a, vector unsigned char __b,
vector unsigned char __c) {
return (vector unsigned char)__builtin_altivec_vperm_4si(
(vector int)__a, (vector int)__b, __c);
}
int t2(void) {
unsigned long msr;
__vector unsigned char a = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7,
0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF};
__vector unsigned char b = {0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7,
0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF};
__vector unsigned char c = {0x01, 0x14, 0x18, 0x10, 0x06, 0x15,
0x19, 0x1A, 0x1C, 0x1C, 0x1C, 0x13,
0x08, 0x1D, 0x1B, 0x0E};
__vector unsigned char s = {161, 180, 184, 176, 166, 181, 185, 186,
188, 188, 188, 179, 168, 189, 187, 174};
__vector unsigned char r;
r = vec_perm(a, b, c);
if (!vec_all_eq(s, r)) {
flag(msr);
return 1;
}
return 0;
}
Compile options:
-mcpu=a2 -msoft-float --target=ppc32 -O2 -maltivec
Error:
Killed - processing time exceeded
Compiler returned: 143