This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] Implement __clear_cache on FreeBSD/powerpc
ClosedPublic

Authored by carenas on Mar 29 2022, 2:13 AM.

Details

Summary

dd9173420f06 (Add clear_cache implementation for ppc64. Fix buffer to
meet ppc64 alignment., 2017-07-28), adds an implementation for
builtin_clear_cache on powerpc64, which was promptly ammended to
also be used with big endian mode in f67036b62c0c (This ppc64 implementation
of clear_cache works for both big and little endian., 2017-08-02)

clang will use this implementation for it's builtin on FreeBSD and result
in an abort() in the cases where 32-bit generation was requested (ex in
macppc or when the big endian powerpc64 build was done with "-m32") and as
reported[1] recently with pcre2, but there is no reason why the same code
couldn't be used in those cases, so use instead the more generic identifier
for the PowerPC architecture.

While at it, update the comment to reflect that POWER8/9 have a 128 byte
wide cache line and so the code could instead use 64 byte windows instead
but that possible optimization has been punted for now.

[1] https://github.com/PhilipHazel/pcre2/issues/92

Diff Detail

Event Timeline

carenas created this revision.Mar 29 2022, 2:13 AM
carenas published this revision for review.Mar 29 2022, 2:16 AM
carenas added a reviewer: howard.hinnant.
Herald added a project: Restricted Project. · View Herald TranscriptMar 29 2022, 2:17 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
lkail added a subscriber: lkail.Mar 29 2022, 2:51 AM
MaskRay accepted this revision.Mar 29 2022, 1:47 PM
MaskRay added reviewers: jhibbits, q66.
MaskRay added a reviewer: Restricted Project.
MaskRay added a subscriber: MaskRay.

LGTM. But hope someone from #powerpc can stamp.

This revision is now accepted and ready to land.Mar 29 2022, 1:49 PM
jhibbits accepted this revision.Mar 29 2022, 1:56 PM

could someone with commit access merge this change?

This revision was automatically updated to reflect the committed changes.