This is an archive of the discontinued LLVM Phabricator instance.

[PPC] add vector byte reverse functions to altivec.h
ClosedPublic

Authored by sfertile on Oct 24 2016, 11:20 AM.

Details

Summary

Add the following byte reverse functions in altivec.h

vector bool char vec_revb (vector bool char);
vector signed char vec_revb (vector signed char);
vector unsigned char vec_revb (vector unsigned char);
vector bool int vec_revb (vector bool int);
vector signed int vec_revb (vector signed int);
vector unsigned int vec_revb (vector unsigned int);
vector signed int128 vec_revb (vector signed int128);
vector unsigned int128 vec_revb (vector unsigned int128);
vector bool long long vec_revb (vector bool long long);
vector signed long long vec_revb (vector signed long long);
vector unsigned long long vec_revb (vector unsigned long long);
vector bool short vec_revb (vector bool short);
vector signed short vec_revb (vector signed short);
vector unsigned short vec_revb (vector unsigned short);
vector double vec_revb (vector double);
vector float vec_revb (vector float);

The return value is a vector where each element contains the corresponding byte-reversed vector element of the input vector.

Diff Detail

Repository
rL LLVM

Event Timeline

sfertile updated this revision to Diff 75614.Oct 24 2016, 11:20 AM
sfertile retitled this revision from to [PPC] add vector byte reverse functions to altivec.h.
sfertile updated this object.
sfertile added reviewers: nemanjai, kbarton, amehsan, jtony.
sfertile set the repository for this revision to rL LLVM.
sfertile added a subscriber: llvm-commits.
nemanjai edited edge metadata.Oct 25 2016, 6:27 AM

I think this patch looks fine but I'll let @kbarton review and provide approval.
BTW. you and @jtony have a conflict in the test case so the first to commit wins and the other one will have to make some changes on the commit.

test/CodeGen/builtins-ppc-altivec.c
9040

This is minor and can just be done on the commit, but I don't think this regex portion is needed. I'd just make these check lines:
//CHECK-LE: xor <16 x i8>

sfertile edited edge metadata.Oct 25 2016, 7:41 AM
sfertile added a subscriber: echristo.
nemanjai added inline comments.Oct 25 2016, 8:08 AM
test/CodeGen/builtins-ppc-altivec.c
9040

In general, a regex at the beginning or end of a line without saving the text is unnecessary.

kbarton accepted this revision.Oct 25 2016, 9:31 AM
kbarton edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 25 2016, 9:31 AM
echristo accepted this revision.Oct 25 2016, 1:56 PM
echristo added a reviewer: echristo.
sfertile updated this revision to Diff 75932.Oct 26 2016, 12:50 PM
sfertile edited edge metadata.
sfertile removed rL LLVM as the repository for this revision.

removed the unneeded regexs in the tests.

Committed revision 285268.
I've run the tests on a Big Endian machine as well. Sean, please close the review when you get a chance if there are no buildbot failures.

sfertile closed this revision.Oct 27 2016, 7:43 AM