Bug fixes for PowerPC targets
Fixes for Node.js (V8) for older PowerPC targets. I'm testing with Gentoo Linux on ppc64 (big-endian) on a PowerMac Quad G5, so this code needs testing on other systems, especially POWER9, which I believe should have some CPU flags enabled that aren't currently being enabled. Currently, POWER9 is setting MODULO but not the other feature flags, so I refactored the code to a switch statement with fallthrough assuming that the newer POWER CPUs have all the feature flags of the earlier ones. Please let me know if that assumption is incorrect. Other changes:
-
PPC64 big-endian ELFv1 ABI uses function descriptors, like AIX.
-
Tell the code generator when we don't have the FP to int rounding instructions (added in Power ISA v2.03) by not enabling them in the MachineOperatorBuilder::Flags if we don't have a new enough CPU. My first patch tried to emit the equivalent rounding behavior inline, but then I realized I could set the flags to not emit frim/frin/friz/frip if the CPU doesn't support those instructions.
-
Change minimum page size to 4KB for PPC. 64KB physical pages are a newer feature that breaks some software, such as the nouveau driver.
-
Change PPC CPU detection to use getauxval() for glibc 2.16 and newer, and to correctly recognize all known Linux PowerPC platform types. Cell BE is identified as PPC_G5; other CPUs with AltiVec as PPC_G4. The new PPC_G3 type is used for all other CPUs without VMX/AltiVec.
-
Add VMX feature for future VMX/AltiVec code generation. VMX is a subset of VSX that's available on POWER6, G5, Cell, G4, and PA6T. The newer VSX feature is only available on POWER7 and newer CPUs.
I need to continue testing, as I'm seeing one strange failure in cctest now, only with a release build. But I think the patches I have so far are basically correct and ready for review and feedback. Thanks!
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines