Open lu-zero opened 6 months ago
@llvm/issue-subscribers-backend-powerpc
Author: Luca Barbato (lu-zero)
hmm, actually -mpower9-vector
is a switch for instructions that start with xv/xs/xx
(vector-scalar instructions) on pwr9. Instruction starting with v
like vabsdub
is guarded by altivec feature bit. So this is some kind of by design. Unfortunately there is no -mpower9-altivec option in clang for now. So can only enable this builtin with -mcpu=power9
.
There is doc about this builtin usage in https://www.ibm.com/docs/en/openxl-c-and-cpp-aix/17.1.2?topic=functions-vec-absd
gcc does allow vec_absd
with -mpower9-vector
and the intrinsic is guarded by __POWER9_VECTOR__
in altivec.h
thus my confusion.
gcc does allow vec_absd with -mpower9-vector and the intrinsic is guarded by __POWER9_VECTOR__ in altivec.h thus my confusion.
OK. That's a good reason we should check llvm. llvm should be compatible with gcc for this option and its behavior.
Hi @lu-zero Which gcc version are you using? How is -mpower9-vector
documented in GCC?
gcc-13, the manpage mentions it in passing as:
If you use the ISA 3.0 instruction set (-mpower9-vector or -mcpu=power9) ...
The part that is annoying with clang is that __POWER9_VECTOR__
is the only guard in the clang-provided altivec.h so one would be none-the-wiser when looking at the instructions there and papr also does not differentiate: ISA 3.0 the only discriminant documented.
I've posted an RFC PR https://github.com/llvm/llvm-project/pull/86905. @lu-zero I've checked the manual of the latest GCC manual which doesn't list -mpower9-vector
like -mcpu
any more. I think clang should follow the latest gcc behavior, i.e., I suggest you use -mcpu=pwr9
rather than -mpower9-vector
. Some GCC PPC port developers told me, this might be a debug option which is not for long-term uses.
pwr9
or power9
? Right now I set the CFLAGS for the code using vec_absd to -mcpu=power9
in dav1d, and indeed would be nice if the -mcpu
does not need to be changed again...
(and yes, it is already annoying to have -Ctarget-cpu
to support pwr9 only in rustc).
pwr9 or power9
I think clang should support both.
I agreed with @bzEq 's conclusion that if GCC is going to drop this option, Clang should not try to support this option either. To me, the best solution for your case is to use -mcpu=power9(for GCC) or -mcpu=[pwr9|power9](for Clang). If you upgrade your GCC compiler in future, the option might be not supported any longer, right?
The option cannot disappear overnight if they do not want to make even less developers interested in supporting power.
In general you want to build with -m
What would happen if somebody has a Power 11
and wants to pass -mcpu=pwr11 and the build system ends up adding -mcpu=pwr9 ?
I'd rather have -maltivec -mvsx -mpower9-vector
.
What would happen if somebody has a Power 11 and wants to pass -mcpu=pwr11 and the build system ends up adding -mcpu=pwr9 ?
Can you elaborate? To me, it should be an issue inside the build system.
The option cannot disappear overnight if they do not want to make even less developers interested in supporting power.
I think it's common to deprecate some options when upgrading compiler. These options in the context are intended originally for debug purpose as far as I know.
What would happen if somebody has a Power 11 and wants to pass -mcpu=pwr11 and the build system ends up adding -mcpu=pwr9 ?
Can you elaborate? To me, it should be an issue inside the build system.
Most build systems take additional cflags.
Having multiple -mcpu
is confusing and you have to make sure to remember right-most-wins.
Having -m{isa-extension} like -mvsx or -mavx512ifma
let you state clearly the intent, thus why I'm puzzled that I have to pass -mcpu
Right now with both clang-16 and clang-17 it triggers a: