[PATCH] D59733: ARM: Allow cp10/cp11 coprocessor register access with a warning

Stefan Agner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 14:00:17 PDT 2020


falstaff84 added a comment.

In D59733#2106433 <https://reviews.llvm.org/D59733#2106433>, @simon_tatham wrote:

> > for ARMv7 we only disallowed this pair, and this change removes that restriction. So now, all of them are allowed...
>
> Yes, //for Arm v7//.
>
> What I'm getting at is: should we turn the //whole// of `isValidCoprocessorNumber` into warnings of this kind, on the same principle (that it's OK to write any CDP instruction if it's in the context of code that will dynamically decide at run time which instructions to actually execute)? If not, what makes this v7 constraint different from the v8 ones?


Going by the architecture reference manuals, I came up with the following data:

- ARMv7-A/R (ARM DDI 0406C.c): <coproc> ... The generic coprocessor names are p0-p15.
- ARMv7-M (ARM DDI 0403E.b): <coproc> ... The standard generic coprocessor names are p0-p15.
- Armv8-A (ARM DDI 0487F.b): <coproc> .. It can have the following values .. p14, p15 (MCR/MRC only, also chapter G1.19 "The AArch32 System register interface" says "[...] with permitted coproc values of 0b1110 and 0b1111")
- ARMv8-M (ARM DDI 0553A.e): <coproc> ...  The valid coprocessor names are p0 to p7, p10, and p11. (for CBD) and ...  The valid coprocessor names are p10, p11, p14, and p15 (for MCR/MRC)
- Armv8-M (ARM DDI 0553B.i): <coproc> ... The generic coprocessor names are p0 to p15. (for Armv8-M Main Extension only?), BUT, there is decoding pseudocode:

  if coproc IN {'100x', '101x', '111x'} then SEE "Floating-point and MVE";
  if !HaveMainExt() then UNDEFINED;
  cp = UInt(coproc);

So the restrictions for Armv8-A seems correct to me. Not sure about Armv8-M... It seems that restrictions changed between ARMv8-M and Armv8.1-M. So to me it seems that with main extension, all of them are allowed. Just p8, p9, p10, p11, p14, p15 are in the "Floating-point and MVE" range...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59733/new/

https://reviews.llvm.org/D59733





More information about the llvm-commits mailing list