Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AltiVec portable implementation #171

Open
domalb opened this issue Apr 6, 2023 · 3 comments
Open

AltiVec portable implementation #171

domalb opened this issue Apr 6, 2023 · 3 comments
Assignees

Comments

@domalb
Copy link

domalb commented Apr 6, 2023

Hi all,
I open this issue as discussion, please forgive me if this is not appropriate.

I'm currently working on porting software that initially did run on a PowerPC based CPU.
The C code base contains many direct AltiVec intrinsics, which does not compile for x86_64 and ARM64 architectures of our target platforms.
Rewriting those calls is complex, so our strategy is to implement a port of AltiVec instructions in plain C. In scalar first, and SSE/NEON in a second step.
Would anybody have knowledge of such an existing implementation available?

My underqstanding of pveclib is that it does not handle that need, but I thought people involved here would be the best who could provide me some help.

Regards

Domenico Albani

@ThinkOpenly
Copy link
Contributor

GCC contains the opposite of what you seek: x86 intrinsics mapped to VSX, up through parts of SSE 4.2. This may or may not be helpful. I don't think Arm has the same -- although I do see an "mmintrin.h" file for Arm, I don't see any others.

For C implementations, it might be helpful to look at the RTL (pseudocode) in the Power ISA document, Book I, Chapters 6 and 7.

@munroesj52
Copy link
Contributor

munroesj52 commented Apr 7, 2023

As Paul points out, there is no universal vector intrinsic translator.

Each effort tends to be a platform support team's effort ro help customers who show a sudden interest in their platform/architecture. But the customer has old software for another architecture.

You may find that the Vector Intrinsics Porting Guide covers some of the issues you will encounter. For example: Altivec support generic intrinsics (ie vec_add(() where the compiler generated instruction depends on the operand type. Intel intrinsic names are type specific. You will need some auxiary type definitions/casts to manage this.

I have not looked at ARM64.

Also GCC supports some Vector Extentsions that may work across targets.

@munroesj52 munroesj52 self-assigned this Jul 21, 2023
@munroesj52
Copy link
Contributor

Closed as outside the scope of PVECLIB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants