This is an archive of the discontinued LLVM Phabricator instance.

[PATCH] Allow case-insensitive values for -mcpu for ARM and AArch64 targets in line with GCC.
ClosedPublic

Authored by enefaim on May 4 2015, 9:30 AM.

Details

Summary

GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mcpu option.
I also plan to do the same for -march and -mtune, I just wanted to keep them separate.

I am not sure about how to test it though. There are hundreds of tests for -mcpu
in the test/Driver directory. Should I duplicate all of them in the existing test files
with upper-case -mcpu arguments, or should I create a separate test file for them?
Or maybe just have some of them duplicated?
I'm looking forward to some guidance here.

Thanks,
Gabor Ballabas

Diff Detail

Repository
rL LLVM

Event Timeline

enefaim updated this revision to Diff 24885.May 4 2015, 9:30 AM
enefaim retitled this revision from to [PATCH] Allow case-insensitive values for -mcpu for ARM and AArch64 targets in line with GCC..
enefaim updated this object.
enefaim edited the test plan for this revision. (Show Details)
enefaim set the repository for this revision to rL LLVM.
enefaim added a subscriber: Unknown Object (MLST).

Hi Gabor, Joerg

To me, it seems like an easy win to have better GCC compatibility for options like -mcpu which mirror GCC options. In terms of lack of uses in the wild, it appears to be a behaviour change in GCC 4.9 so would only appear in very new projects. The behaviour is not documented, but there is no reason it could not appear in projects in the future.

Other ARM compilers e.g. IAR, armcc, gcc accept capitalised names for their equivalent options and ARM tends to refer to the CPUs via captialised names like Cortex-A72 so it is reasonable to assume someone might try to pass -mcpu=Cortex-A72 to clang or to gcc and expect it to work.

Is there a good reason not to follow gcc here?

On the patch itself:

  • Is there any reason not to patch the function DecodeAArch64Mcpu itself like for GetArmArchForMCpu rather than patching the arguments at the two callsites?
  • Otherwise this looks ok to me - but IANA Clang expert.

Thanks
Rich

I agree with Richard that there is little point in forcing it to be case sensitive.

I also agree that if there is a more central way for the lower() call, we should use that.

About the tests, I think having a few of them in varying cases (like Cortex-A15, cortex-A53, Cortex-a57) should be enough. No need to be thorough for that.

enefaim updated this revision to Diff 25324.May 8 2015, 6:55 AM
enefaim edited edge metadata.

Hi Richard, Renato,

  • Moved lower() calls to DecodeAArch64Mcpu.
  • Added test cases.

Thanks,
Gabor

rengolin accepted this revision.May 8 2015, 7:27 AM
rengolin added a reviewer: rengolin.

LGTM, Thanks!

This revision is now accepted and ready to land.May 8 2015, 7:27 AM
rengolin closed this revision.May 8 2015, 7:55 AM

r236859