This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Fix PR34625 -mtune without -mcpu should not set -target-cpu
ClosedPublic

Authored by peter.smith on Oct 23 2017, 5:30 AM.

Details

Summary

When -mtune is used on AArch64 the -target-cpu is passed the value of the cpu given to -mtune. As well as setting micro-architectural features of the -mtune cpu, this will also add the architectural features such as support for instructions. This can result in the backend using instructions that are supported in the -mtune cpu but not supported in the target architecture. For example use of the v8.1-a LSE extensions with -march=v8.

This change removes the setting of -target-cpu for -mtune, the -mcpu must be used to set -target-cpu. This has the effect of removing all non-hard coded benefits of mtune but it does produce correct output when -mtune cpu with a later architecture than v8 is used. I've kept the hard-coded behaviour of -mtune for some Apple CPU codenames and have added in a call to check the -mtune cpu as there are some tests that depend on it.

Further work will be needed to implement -mtune properly, so that it affects only micro-architectural features.

fixes PR34625

Diff Detail

Repository
rL LLVM

Event Timeline

peter.smith created this revision.Oct 23 2017, 5:30 AM
echristo accepted this revision.Oct 23 2017, 11:05 AM

This should be fine for now. Thanks!

-eric

This revision is now accepted and ready to land.Oct 23 2017, 11:05 AM
This revision was automatically updated to reflect the committed changes.