HomePhabricator

[PowerPC] [Clang] Port MMX intrinsics and basic test cases to Power

Description

[PowerPC] [Clang] Port MMX intrinsics and basic test cases to Power

Port mmintrin.h which include x86 MMX intrinsics implementation to PowerPC platform (using Altivec).

To make the include process correct, PowerPC's toolchain class is overrided to insert new headers directory (named ppc_wrappers) into the path. Basic test cases for several intrinsic functions are added.

The header is mainly developed by Steven Munroe, with contributions from Paul Clarke, Bill Schmidt, Jinsong Ji and Zixuan Wu.

Reviewed By: Jinsong Ji

Differential Revision: https://reviews.llvm.org/D59924

Event Timeline

hubert.reinterpretcast added inline comments.
/cfe/trunk/lib/Driver/ToolChains/PPCLinux.cpp
26

The directory is called "ppc_wrappers", but it is not really generic for PPC. Already in this commit it does not apply to 32-bit PPC targets, and in later commits changes are made assuming Linux. @jsji @qiucf

jsji added inline comments.Jun 4 2019, 6:54 AM
/cfe/trunk/lib/Driver/ToolChains/PPCLinux.cpp
26

yes, it is currently Linux only. I think we can extend it to include other OS like AIX later if needed.

/cfe/trunk/lib/Driver/ToolChains/PPCLinux.cpp
26

I'm not particularly concerned about the scoping of the work; however, the ppc_wrappers directory is not at all indicative of that scoping. It neither indicates the scope in terms of purpose (providing x86 vector intrinsics) nor does it indicate the scope in terms of applicability (64-bit Linux). I would suggest that the header belongs as part of a deeper structure that can be used for other purposes as well ppc_wrappers/ppc64common/linux/. If the header becomes applicable to more platforms, we can move it with the possibility of additionally placing headers that use #include_next as appropriate.

wuzish added a subscriber: wuzish.Jun 4 2019, 8:38 PM
wuzish added inline comments.
/cfe/trunk/lib/Driver/ToolChains/PPCLinux.cpp
26

@hubert.reinterpretcast
Thanks for your advice. I think the name ppc_wrappers is accurate to describe its meaning that wrapping the headers under standard library path or standard header search path. (Headers in lib/Headers is clang standard search path) It's truly that ppc_wrappers can be used for all platforms of powerpc no matter what's OS or bit mode or endian because there are only little num of files and no need for too many level directory. And we can distinguish OS, endian or mode by macros in wrapped headers, combining with #include_next as what you said, which I also prefer to use because it's easier to maintain headers instead of modifying cpp code about toolchain class such as PPCLinuxToolChain .

We will use better way described above to guard those headers only in 64-bit mode soon after other headers have been upstreamed.

I think the name ppc_wrappers is accurate to describe its meaning that wrapping the headers under standard library path or standard header search path.

Thanks for clarifying this for me. In the case where all of the headers are expected to be present somewhere in the usual search path, I agree that the current directory structure would be okay given proper guards within the headers themselves.

[ ... ] which I also prefer to use because it's easier to maintain headers instead of modifying cpp code about toolchain class such as PPCLinuxToolChain .

We will use better way described above to guard those headers only in 64-bit mode soon after other headers have been upstreamed.

That (controlling within the headers) sounds good to me. When that lands, then my understanding is that the PPCLinuxToolChain code would be adjusted to include ppc_wrappers in the search path in the general case. Please let me know if that's not the case. Thanks.

wuzish added a comment.Jun 5 2019, 7:07 PM

That (controlling within the headers) sounds good to me. When that lands, then my understanding is that the PPCLinuxToolChain code would be adjusted to include ppc_wrappers in the search path in the general case. Please let me know if that's not the case. Thanks.

Yes, I 'd like to include ppc_wrappers in the search path directly not conditionally later.