This is an archive of the discontinued LLVM Phabricator instance.

[clang] [ARM] Don't set the strict alignment flag for armv7 on Windows
ClosedPublic

Authored by mstorsjo on Sep 17 2021, 4:31 AM.

Details

Summary

Windows on armv7 is as alignment tolerant as Linux.

The alignment considerations in the Windows on ARM ABI are documented
at https://docs.microsoft.com/en-us/cpp/build/overview-of-arm-abi-conventions?view=msvc-160#alignment.

The document doesn't explicitly say in which state the OS configures
the SCTLR.A register (and it's not accessible from user space to
inspect), but in practice, unaligned loads/stores do work and seem
to be as fast as aligned loads and stores. (Unaligned strd also does
seem to work, contrary to Linux, but significantly slower, as they're
handled by the kernel - exactly as the document describes.)

Diff Detail

Event Timeline

mstorsjo created this revision.Sep 17 2021, 4:31 AM
mstorsjo requested review of this revision.Sep 17 2021, 4:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 17 2021, 4:31 AM
DavidSpickett accepted this revision.Sep 17 2021, 5:26 AM

LGTM with the comment updated.

clang/lib/Driver/ToolChains/Arch/ARM.cpp
784

Might as well update this comment.

This revision is now accepted and ready to land.Sep 17 2021, 5:26 AM
mstorsjo updated this revision to Diff 373201.Sep 17 2021, 6:08 AM

Updated the comment too.