Page MenuHomePhabricator

[COFF, ARM64] Add __byteswap intrinsics
ClosedPublic

Authored by mgrang on Jan 14 2019, 3:27 PM.

Diff Detail

Event Timeline

mgrang created this revision.Jan 14 2019, 3:27 PM
efriedma added inline comments.Jan 14 2019, 3:42 PM
lib/Headers/arm64intr.h
50 ↗(On Diff #181657)

These should be available for all Microsoft targets, I think.

Please define these as inline functions or proper builtins, rather than macros; a macro is very likely to break something. (For example, if someone includes stdlib.h, which declares "unsigned long _byteswap_ulong(unsigned long);", replacing _byteswap_ulong with __builtin_bswap32 will cause a compile error.)

mgrang updated this revision to Diff 181671.Jan 14 2019, 4:53 PM
mgrang retitled this revision from [COFF, ARM64] Declare __byteswap intrinsics to [COFF, ARM64] Add __byteswap intrinsics.
efriedma accepted this revision.Jan 14 2019, 5:04 PM

LGTM

test/Headers/ms-arm64-intrin.cpp
19

While you're here, please fix all four tests to just check the IR.

This revision is now accepted and ready to land.Jan 14 2019, 5:04 PM

Before you commit, please verify this actually compiles if you include both this intrin.h and stdlib.h from the Microsoft SDK, in either order.

mgrang updated this revision to Diff 181679.Jan 14 2019, 5:22 PM
mgrang marked an inline comment as done.

Verified that this compiles when both intrin.h and stdlib.h from the Microsoft SDK are included, in either order.

This revision was automatically updated to reflect the committed changes.