I am looking into porting a generic library of abstractions on top of SIMD to power architecture.
However, the information about which extensions are supported on which power and how to compile to them is confusing. At the moment only looking at 64 bit processors and no older than power-7.
On one hand I see this document.
There are 3 types of instructions: no requirements, requires power-8 and requires power-9.
For example vec_cmpgt
has no special requirements.
However, when I use powerpc64-linux-gnu-g++-10
I see an error:
error: '__builtin_altivec_vcmpgtsd' requires the '-mpower8-vector' option
In some other places I can find information about vmx
and vsx
extensions but it is also unclear to which power iterations the correspond to.
For example here it talks about vsx on power-7.
UPD: I missed that 64 bit integer comparison is only available on power8, but others are before that.
There are a few resources that will help you on your quest.
Firstly, the actual underlying vector instructions in the CPU which are available to you vary by CPU version. These are documented in the ISA. For:
These are all massive PDFs telling you many things, including the details of the vector instructions. You can use these directly if you write your code in assembler.
Then, you have noticed that the supported compiler intrinsics can vary from compiler to compiler: you picked up a reference from the very-google-friendly AIX XL C compiler manual, and found it didn't work on gcc.
So you'd want to spend some quality time with:
Power has the additional complexity of supporting different types of vector extensions with lots of different names. There's a good explainer at VSX? VMX? Altivec? VR? VSR?! How these PowerPC SIMD acronyms relate to each other?