This is an archive of the discontinued LLVM Phabricator instance.

[LLVM] Add support for armv6k subtarget
ClosedPublic

Authored by tinti on Mar 6 2015, 2:25 PM.

Details

Summary

Add support for ARMV6K subtarget variant which is another layer between ARMV6
and ARMV6T2.

ARMV6 family LLVM implementation.

+-------------------------------------+
| ARMV6                               |
+----------------+--------------------+
| ARMV6M (thumb) | ARMV6K (arm,thumb) | <- From ARMV6K and ARMV6M processors
+----------------+--------------------+    have support for hint instructions
| ARMV6T2 (arm,thumb,thumb2)          |    (SEV/WFE/WFI/NOP/YIELD). They can
+-------------------------------------+    be either real or default to NOP.
| ARMV7 (arm,thumb,thumb2)            |    The two processors also use
+-------------------------------------+    different encoding for them.

Diff Detail

Event Timeline

tinti updated this revision to Diff 21395.Mar 6 2015, 2:25 PM
tinti retitled this revision from to Add support for armv6k subtarget.
tinti updated this object.
tinti edited the test plan for this revision. (Show Details)
tinti added reviewers: rengolin, t.p.northover, compnerd.
tinti added subscribers: behanw, mcharleb.
tinti updated this object.Mar 6 2015, 2:26 PM
tinti updated this object.
tinti updated this object.
tinti updated this object.
tinti added subscribers: Unknown Object (MLST), Unknown Object (MLST), Unknown Object (MLST).
compnerd accepted this revision.Mar 6 2015, 6:53 PM
compnerd edited edge metadata.
This revision is now accepted and ready to land.Mar 6 2015, 6:53 PM
rengolin accepted this revision.Mar 7 2015, 5:42 AM
rengolin edited edge metadata.

Apart from my silly comment, looks good. I'd like Tim to have a look as well, since he has a better eye than I do for these things.

include/llvm/Support/ARMBuildAttributes.h
102

That's actually ARM1176JZ_S, pure ARMv6K is more like MPCore. Ie. keep the comment. :)

rengolin edited edge metadata.Mar 7 2015, 5:45 AM
rengolin removed subscribers: Unknown Object (MLST), Unknown Object (MLST).
tinti added a comment.Mar 7 2015, 7:36 PM

Apart from my silly comment, looks good. I'd like Tim to have a look as well, since he has a better eye than I do for these things.

Right. I believe that there is more things to do but I would prefer to make small steps first and fix other things later.

For now this patch fixes arm1176jz-s, arm1176jzf-s and armv6k.

include/llvm/Support/ARMBuildAttributes.h
102

The problem is that we have many subtargets and many processors and it is still fuzzy how to link them:

Processors (ARM11):

  • arm1126j (never seen but there is one reference on ARM11 manual)
  • arm1136j-s (revision 0)
  • arm1136jf-s (revision 0)
  • arm1136j-s (revision 1)
  • arm1136jf-s (revision 1)
  • arm1156t2-s
  • arm1156t2f-s
  • arm1176jz-s
  • arm1176jzf-s
  • mpcorenovfp
  • mpcore

Subarches:

  • v6
  • v6j
  • v6k
  • v6z
  • v6kz
  • v6t2
  • v6core <== guessing a name

My guess of the best map:

  • v6 -> arm1126j arm1136j-s (r0) arm1136jf-s (r0)
  • v6j -> alias for v6
  • v6k -> arm1136j-s (r1) arm1136jf-s (r1); inherits v6; adds HINT
  • v6z -> arm1176jz-s arm1176jzf-s; inherits v6k; adds TRUSTZONE
  • v6kz -> alias for v6z
  • v6t2 -> arm1156t2-s arm1156t2f-s; inherits v6k; adds THUMB2
  • v6core -> mpcorenovfp mpcore; inherits v6k; adds MULTICORE

This does not reflect this patch because:

  • I'm ignoring that a arm1136 revisions can be v6k. Hence I'm being really strict in keeping the old behavior of LLVM that is to not allow HINT on this arm1136.
  • There is no support for MULTICORE and TRUSTZONE on the backend or I am afraid to use them and break things. Therefore I am merging mpcore and arm1176 as one being.

What do you think? For now I will do as you suggested but would be great to organize this later.

rengolin added inline comments.Mar 8 2015, 10:47 AM
include/llvm/Support/ARMBuildAttributes.h
102

v6core is actually v6k. Multi-core and trust-zone are irrelevant for the compiler, that's why we ignore. But we still have to recognize the arch name and associate with the right CPU (and vice-versa).

tinti updated this revision to Diff 21992.Mar 14 2015, 3:27 PM

Add back comments for v6KZ and fix minor typo.

t.p.northover accepted this revision.Mar 15 2015, 10:46 AM
t.p.northover edited edge metadata.

I think it looks fine too, as long as one test is made a bit stricter.

Tim.

test/MC/ARM/arm11-hint-instr.s
4–6

Probably best to put actual FileCheck tests in here (with the ARM encoding). It's very easy to accidentally make a Thumb encoding available on ARM (or vice-versa) with a slightly dodgy InstAlias.

I don't think you have, but for future changes...

tinti updated this revision to Diff 22005.Mar 15 2015, 2:15 PM
tinti edited edge metadata.

Check enconding as requested by Tim.

tinti retitled this revision from Add support for armv6k subtarget to [LLVM] Add support for armv6k subtarget.Mar 15 2015, 2:50 PM
t.p.northover added inline comments.Mar 15 2015, 8:54 PM
test/MC/ARM/arm11-hint-instr.s
49–50

I think this is a bit misleading. A v6T2 CPU ought to assemble the instructions in both ARM and Thumb mode. It's your triple that forces it to use in ARM mode, not an intrinsic property of the processor.

I'd suggest merging CHECK-V6K and CHECK-V6T2 into CHECK-ARM. V6M is always special (possibly with a capital 'S'), it's fine as is.

tinti updated this revision to Diff 22083.Mar 17 2015, 3:38 AM

Improve tests on ARM11:

  • Merge v6k and v6t2 tests as suggested by Tim into a single CHECK-ARM.
  • Add CHECK-THUMB for v6t2 by using thumb triple.
  • Remove miss comment on using default encoding.
  • Keep a separate check only for v6m since it is very special.
tinti added a comment.Mar 17 2015, 3:39 AM

I have also reordered the instructions based on the encoding for readability.

rengolin closed this revision.Mar 17 2015, 4:58 AM

Thanks Vinicius, r232468.