This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Add support for armv7ve triple in llvm (PR31358).
ClosedPublic

Authored by manojgupta on Feb 2 2017, 1:40 PM.

Details

Summary

Gcc supports target armv7ve which is armv7-a with virtualization
extensions. This change add support for this in llvm for gcc
compatibility.

Also remove redundant FeatureHWDiv, FeatureHWDivARM for a few models
as this is specified automatically by FeatureVirtualization.

The corresponding clang change is at https://reviews.llvm.org/D29773 .

Subscribers: aemerson, llvm-commits, rengolin

Differential Revision: https://reviews.llvm.org/D29472

Diff Detail

Repository
rL LLVM

Event Timeline

manojgupta created this revision.Feb 2 2017, 1:40 PM
ab requested changes to this revision.Feb 2 2017, 5:03 PM
ab added a subscriber: ab.

I don't think we can unilaterally add MachO subtypes: I would remove all MachO changes.

Otherwise, this seems reasonable. Can you update the TargetParser unittest?

This revision now requires changes to proceed.Feb 2 2017, 5:03 PM
manojgupta updated this revision to Diff 86992.Feb 3 2017, 11:30 AM
manojgupta edited edge metadata.
manojgupta set the repository for this revision to rL LLVM.

Updates as requested:

  1. Removed Mach-o changes.
  2. Updated TargetParser UnitTest.
richard.barton.arm requested changes to this revision.Feb 3 2017, 11:41 AM

Hi Manoj

Virtualization requires TrustZone so I have added a few comments where I think this is missing. Looks like there are existing bugs in this area which you have propagated into your patch for ARMv7-VE. Would be good to fix the whole lot at once.

Shouldn't new TargetParser options also get a clang test for the new commandline? I was also expecting a build attributes test added to test/CodeGen/ARM/build-attributes.ll testing the Virtualization and Div attributes are set correctly.

include/llvm/Support/ARMTargetParser.def
86 ↗(On Diff #86878)

The Virtualization extension requires TrustZone, so I would expect to see AEK_SEC in this list, unless this is implied by AEK_VIRT. I guess from the Divide macros also given that it is not.

lib/Target/ARM/ARM.td
450 ↗(On Diff #86878)

Same comment here about lack of TrustZone with Virtualization. I think this should reallybe part of the FeatureVirtualization definition higher in the file. This definition also includes the two divide Features, so they are redundant here and can be removed. The same comment could perhaps be made for a number of other targets in this file.

lib/Target/ARM/ARMSubtarget.h
55 ↗(On Diff #86878)

Being super pedantic, after ARMv7-A would be a more logical order. Super super pedantic there

This revision now requires changes to proceed.Feb 3 2017, 11:41 AM

Hi Richard,

After making the changes you suggested, I am getting a test fail in build-attributes for cortex-r52 wrt Tag_Virtualization_use.
I noticed that cortex-r52 uses armv8-r arch model but armv8-r does not have TrustZone in its supported features. Is this correct ?
And if so, I can not add TrustZone to FeatureVirtualization sublist.

If TrustZone is indeed supported for Armv8-r, I'll simply fix the test for cortex-r52.

def : ProcessorModel<"cortex-r52", CortexR52Model, [ARMv8r, ProcR52,

FeatureFPAO]>;

def ARMv8r : Architecture<"armv8-r", "ARMv8r", [HasV8Ops,

FeatureRClass,
FeatureDB,
FeatureHWDiv,
FeatureHWDivARM,
FeatureT2XtPk,
FeatureDSP,
FeatureCRC,
FeatureMP,
FeatureVirtualization,  // No Trustzone in this list
FeatureFPARMv8,
FeatureNEON]>;

Failure details:

Before (ToT):
.eabi_attribute 68, 2 @ Tag_Virtualization_use

After adding TrustZone:
.eabi_attribute 68, 3 @ Tag_Virtualization_use

Thanks,
Manoj

manojgupta updated this revision to Diff 87833.Feb 9 2017, 10:24 AM
manojgupta edited edge metadata.
manojgupta retitled this revision from PR31358: Add support for armv7ve triple in llvm. to [ARM] Add support for armv7ve triple in llvm (PR31358)..
manojgupta edited the summary of this revision. (Show Details)

Updated as per Richard comments. Did not add TrustZone to FeatureVirtualization since Armv8-r supports virtualization but not TrustZone.
Added more tests for armv7ve.

richard.barton.arm requested changes to this revision.Feb 9 2017, 11:38 AM

Hi Manoj

Sorry for not getting back to you yesterday. As you have concluded, ARMv8-R has not got the Security extension, which ruins my idea of neatly encapsulating this in the Virtualization extension definiton.

The new patch is fine save for a missing multiprocessing extension feature in the .td

lib/Target/ARM/ARM.td
427 ↗(On Diff #87833)

FeatureMP is missing from here. The Virtualization extension on ARMv7-A requires the MP extension, Security Extension and Divide extensions (and some other things which are not interesting to MC).

This revision now requires changes to proceed.Feb 9 2017, 11:38 AM
manojgupta updated this revision to Diff 87861.Feb 9 2017, 1:04 PM
manojgupta edited edge metadata.

Added FeatureMP.

Thanks Manoj - this now also LGTM.

Thanks Richard. I will wait for Mehdi's approval since he is a blocking reviewer.

efriedma added a subscriber: efriedma.

You can ignore that; I added Medhi because the initial version of the patch had some MachO changes that would have needed approval from someone at Apple.

Yeah ignore me please :)

This revision was automatically updated to reflect the committed changes.