Page MenuHomePhabricator

[PowerPC] Add some of the missing predefined functions to altivec.h
ClosedPublic

Authored by seurer on May 29 2015, 10:48 AM.

Details

Summary

This revision adds 68 of the missing "Predefined Functions for Vector Programming" from appendix A of the OpenPOWER ABI for Linux Supplement document.

I also added tests for the new functions and updated another test that was looking for specific line numbers in error messages from altivec.h.

https://llvm.org/bugs/show_bug.cgi?id=23679

Diff Detail

Event Timeline

seurer updated this revision to Diff 26788.May 29 2015, 10:48 AM
seurer retitled this revision from to [PowerPC] Add missing predefined functions to altivec.h.
seurer updated this object.
seurer edited the test plan for this revision. (Show Details)
seurer added reviewers: echristo, wschmidt, kbarton, nemanjai.
seurer added a subscriber: Unknown Object (MLST).
echristo edited edge metadata.May 29 2015, 11:03 AM

I think you're missing things like vec_abs(double), vec_add(double), etc?

At least from the gcc documentation I mentioned.

Also POWER8_VECTOR and not VSX?

-eric

There are hundreds of missing functions. These are just the first batch that I got done.

The check for POWER8_VECTOR is what is done for other vector long long functions in altivec.h. See vec_mule, vec_packs, and etc. Which one is actually correct?

wschmidt edited edge metadata.May 29 2015, 12:23 PM

There are hundreds of missing functions. These are just the first batch that I got done.

The check for POWER8_VECTOR is what is done for other vector long long functions in altivec.h. See vec_mule, vec_packs, and etc. Which one is actually correct?

The answer is dependent upon each instruction. Is it from ISA 2.06 (VSX) or ISA 2.07 (POWER8_VECTOR)?

A good way to check this is to use the 2.07 ISA as your reference. If the instruction has a full change bar by its description, then use POWER8_VECTOR. Otherwise use VSX.

seurer updated this revision to Diff 26832.May 29 2015, 4:05 PM
seurer retitled this revision from [PowerPC] Add missing predefined functions to altivec.h to [PowerPC] Add some of the missing predefined functions to altivec.h.
seurer edited edge metadata.

I changed the #ifdefs where needed and moved some of the tests from builtins-ppc-p8vector to builtins-ppc-vsx.

echristo accepted this revision.May 29 2015, 4:08 PM
echristo edited edge metadata.

Looks fine to me. I'd probably want to reformat the file at some point using clang format, but that's up to others.

-eric

This revision is now accepted and ready to land.May 29 2015, 4:08 PM
seurer added a comment.Jun 1 2015, 7:56 AM

Reformat altivec.h and/or the test case(s)? I might as well do that now if we are going to do it.

"Yes" probably. :)

Reformatting is ok to do, but let's keep that separate from patches that add content.

Since the reformatting is potentially a big job anyway, I'd prefer to see that we get the content in place ASAP and follow up on the more minor issue of the formatting.

seurer added a comment.Jun 4 2015, 7:39 AM

I ran clang-format on altivec.h to see how it came out and most of the file was reformatted making a comparison with the previous version not very useful. So I concur that reformatting should be done separately.