0

I am porting altivec code from PPC to Intel architecture. The current altivec code is 32-bit. My Intel CPUs are 64-bit.

  1. Will a 32-bit compiled code run on a 64-bit machine?
  2. Can a 32-bit Altivec code be compiled for a 64-bit machine?

thnx

shok
  • 1
  • 1
  • AltiVec code is PowerPC (or POWER) only - you will need to convert the AltiVec code to SSE if you want to run it on an Intel CPU. – Paul R Oct 03 '18 at 21:14
  • Thanks Paul. I have downloaded the ALTIVEC library from Intel's website. Therefore I am assuming the SSE conversion has already been taken care of. – shok Oct 05 '18 at 13:56
  • Are you aware of any 64-bit ALTIVEC for Intel processors? – shok Oct 05 '18 at 13:57
  • AltiVec is part of the IBM PowerPC/POWER ISA. Intel has a similar SIMD architecture with SSE. You can not run AltiVec on Intel CPUs, and you can not run SSE on PowerPC/POWER CPUs. You would need to port the code from one architecture to the other, which generally means translating intrinsics or assembly code, depending on how the SIMD code was implemented. – Paul R Oct 05 '18 at 18:24
  • Can you post a link to the "ALTIVEC library from Intel's website" ? – Paul R Oct 05 '18 at 18:25
  • hi Paul: Here is a link from Intel's website: https://downloadcenter.intel.com/download/22957/Translation-of-PowerPC-AltiVec-SIMD-Macros-to-IA-32-AVX?product=74387 – shok Oct 08 '18 at 16:04
  • hi Paul: Here is a link from Intel's website: downloadcenter.intel.com/download/22957/… – shok Oct 08 '18 at 16:05
  • OK - that is a *header* which uses macros etc to translate a subset of AltiVec intrinsics to equivalent SSE intrinsics (and in some cases, where no mapping exists, to scalar code). You could use that to get a quick but inefficient port of your existing AltiVec *source code* (assuming it uses intrinsics, and not assembly), but if you care about performance then you will probably want to port the code properly. – Paul R Oct 08 '18 at 16:20
  • Paul,Thank you for your responses. – shok Oct 09 '18 at 14:05
  • Paul: As I see it, the Altivec code provided by intel is for 32-bit CPUs. I have a 64-bit CPU. Will this code work for a 64-bit CPU? If not, then what changes might need to be made? Is there some compiler directive for GCC that can compile this code for 64-bit? Thanks – shok Oct 09 '18 at 14:07
  • It should mostly work - the main problem I see is that the author has made the classic mistake of assuming that `sizeof(int) == sizeof(void *)`. He has also assumed that addresses are 32 bit when masking the low 4 bits of an address. So you'll need to fix those `Vxxx_ADDRESS` macros for a start. – Paul R Oct 09 '18 at 15:45

0 Answers0