Page MenuHomePhabricator

[ARM,CDE] Implement CDE feature test macros
ClosedPublic

Authored by miyuki on Mar 9 2020, 5:16 AM.

Details

Summary

This patch implements feature test macros for the CDE extension
according to the upcoming ACLE specification.

The following 2 macros are being added:

  • __ARM_FEATURE_CDE - defined as '1' when any coprocessor is configured as a CDE coprocessor
  • __ARM_FEATURE_CDE_COPROC - defined as an 8-bit mask, each bit of the mask corresponds to a coprocessor and is set when the corresponding coprocessor is configured as CDE (and cleared otherwise).

The patch also exposes the value of __ARM_FEATURE_CDE_COPROC in the
target-independent method TargetInfo::getARMCDECorpocMask, the method
will be used in follow-up patches implementing semantic checks of CDE
intrinsics (we want to diagnose the cases when CDE intrinsics are used
with coprocessors that are not configured as CDE).

Diff Detail

Event Timeline

miyuki created this revision.Mar 9 2020, 5:16 AM
simon_tatham requested changes to this revision.Mar 9 2020, 6:46 AM
simon_tatham added inline comments.
clang/include/clang/Basic/TargetInfo.h
213

Typo: CorpocCoproc. Lots of those throughout this patch.

clang/test/Preprocessor/arm-target-features.c
807

Especially important not to test for the absence of a misspelled macro – that can lead to false-positive test passes!

This revision now requires changes to proceed.Mar 9 2020, 6:46 AM
miyuki updated this revision to Diff 249103.Mar 9 2020, 8:03 AM

Fixed typos and formatting.

miyuki marked 2 inline comments as done.Mar 9 2020, 8:04 AM
simon_tatham added inline comments.Mar 9 2020, 8:13 AM
clang/lib/Basic/Targets/ARM.cpp
492

As far as I can see, feature names have not already been checked against any whitelist of known strings by the time we get here.

So this test will catch strings like +cdecp0sdfsdfsdf as well as the eight strings you actually wanted.

And then the next line makes an out-of-range shift count from the last character.

miyuki marked an inline comment as done.Mar 9 2020, 8:29 AM
miyuki added inline comments.
clang/lib/Basic/Targets/ARM.cpp
492

Doh!

miyuki updated this revision to Diff 249115.Mar 9 2020, 8:39 AM

Fix condition check

miyuki marked an inline comment as done.Mar 9 2020, 8:39 AM
simon_tatham accepted this revision.Mar 9 2020, 9:06 AM
This revision is now accepted and ready to land.Mar 9 2020, 9:06 AM
This revision was automatically updated to reflect the committed changes.