This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Implement builtin for vbpermd
ClosedPublic

Authored by nemanjai on Aug 11 2021, 6:03 AM.

Details

Reviewers
bmahjour
lei
Group Reviewers
Restricted Project
Commits
rG09b67aa1c382: [PowerPC] Implement builtin for vbpermd
Summary

The instruction has similar semantics to vbpermq but for doublewords. It was added in P9 and the ABI documents the builtin.

Diff Detail

Event Timeline

nemanjai created this revision.Aug 11 2021, 6:03 AM
nemanjai requested review of this revision.Aug 11 2021, 6:03 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 11 2021, 6:03 AM
bmahjour added inline comments.
clang/lib/Headers/altivec.h
17367

This should be guarded under P8. It would also be good to add a vec_vbpermd(vector unsigned long long ...) counter part under __POWER9_VECTOR__ for consistency.

17379

vbpermq variants should be guarded under __POWER8_VECTOR__

lei accepted this revision as: lei.Sep 27 2021, 2:43 PM
lei added a subscriber: lei.

LGTM

clang/lib/Headers/altivec.h
17367

I think this is actually guarded under __POWER8_VECTOR__. See line 17237.
As far as I can see, there is no LLVM intrinsic corresponding to vbpermd.

17382

nit: It would be more clear if we had a comment here what this endif if for. I assume it's /* __POWER8_VECTOR__ */

This revision is now accepted and ready to land.Sep 27 2021, 2:43 PM
bmahjour added inline comments.Sep 28 2021, 6:42 AM
clang/lib/Headers/altivec.h
17367

I think this is actually guarded under POWER8_VECTOR. See line 17237.

You are right. I missed that.

As far as I can see, there is no LLVM intrinsic corresponding to vbpermd.

__builtin_altivec_vbpermd is being called on line 17356...not sure if it corresponds to an IR intrinsic or not, but regardless we have vec_vbpermq in this header but not vec_vbpermd. That seems inconsistent to me.

bmahjour added inline comments.Sep 28 2021, 6:44 AM
clang/lib/Headers/altivec.h
17379

never mind, looks like it already is guarded under P8.

This revision was landed with ongoing or failed builds.Sep 29 2021, 4:35 AM
This revision was automatically updated to reflect the committed changes.