This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Set preferred function alignment to 16 bytes on Neoverse N1
ClosedPublic

Authored by pbarrio on Aug 2 2019, 6:25 AM.

Details

Summary

The Arm Neoverse N1 Software Optimization Guide [1], Section "4.8 Branch
instruction alignment" states:

"Consider aligning subroutine entry points and branch targets to 32B
boundaries, within the bounds of the code-density requirements of the
program."

This patch sets the preferred function alignment on Neoverse N1 to 2^4=16B.
This was already the case in some of the latest Cortex-A CPUs. Benchmarking
in previous Cortex-A CPUs suggested that 16B alignment is already better
than the default. See commit d04ee305.

The reason we don't set it to 32B right now (as the optimisation guide
suggests) is that this will impact code size and perhaps the instruction
cache performance. Therefore we need benchmark numbers first.

I have also added testing for A75 and A76 that we were missing.

[1] https://developer.arm.com/docs/swog309707/latest

Diff Detail

Repository
rL LLVM

Event Timeline

pbarrio created this revision.Aug 2 2019, 6:25 AM
dmgreen accepted this revision.Aug 2 2019, 7:40 AM
dmgreen added a subscriber: dmgreen.

Looks very sensible to me! Thanks

llvm/lib/Target/AArch64/AArch64Subtarget.cpp
82 ↗(On Diff #213035)

Whilst you are here can you set this to 3 too, like the A53.

127 ↗(On Diff #213035)

This one can be 3 too I think. Like the A53.

This revision is now accepted and ready to land.Aug 2 2019, 7:40 AM
pbarrio marked 2 inline comments as done.Aug 2 2019, 8:30 AM
pbarrio added inline comments.
llvm/lib/Target/AArch64/AArch64Subtarget.cpp
82 ↗(On Diff #213035)

I agree, I'll do that as a separate patch

127 ↗(On Diff #213035)

I agree, I'll do that as a separate patch

This revision was automatically updated to reflect the committed changes.