r193600 - ARM: Add -m[no-]crc to dis/enable CRC subtargetfeature from clang

Timur Iskhodzhanov timurrrr at google.com
Tue Oct 29 07:28:01 PDT 2013


Hm, this seems to be fixed by r193601.
Am I reading it right?

2013/10/29 Timur Iskhodzhanov <timurrrr at google.com>:
> FYI this asserts at tools\clang\lib\Driver\Tools.cpp:3855 when using clang-cl
>
> Please fix or revert asap
>
> 2013/10/29 Bernard Ogden <bogden at arm.com>:
>> Author: bogden
>> Date: Tue Oct 29 04:47:51 2013
>> New Revision: 193600
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=193600&view=rev
>> Log:
>> ARM: Add -m[no-]crc to dis/enable CRC subtargetfeature from clang
>>
>> Allow users to disable or enable CRC subtarget feature.
>>
>> Differential Revision: http://llvm-reviews.chandlerc.com/D2037
>>
>> Added:
>>     cfe/trunk/test/Driver/armv8-crc.c   (with props)
>> Modified:
>>     cfe/trunk/docs/UsersManual.rst
>>     cfe/trunk/include/clang/Driver/Options.td
>>     cfe/trunk/lib/Basic/Targets.cpp
>>     cfe/trunk/lib/Driver/Tools.cpp
>>     cfe/trunk/test/Driver/arm-mfpu.c
>>     cfe/trunk/test/Preprocessor/arm-target-features.c
>>
>> Modified: cfe/trunk/docs/UsersManual.rst
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=193600&r1=193599&r2=193600&view=diff
>> ==============================================================================
>> --- cfe/trunk/docs/UsersManual.rst (original)
>> +++ cfe/trunk/docs/UsersManual.rst Tue Oct 29 04:47:51 2013
>> @@ -1057,6 +1057,15 @@ are listed below.
>>     hardware division instructions. This only applies to the ARM
>>     architecture.
>>
>> +.. option:: -m[no-]crc
>> +
>> +   Enable or disable CRC instructions.
>> +
>> +   This option is used to indicate whether CRC instructions are to
>> +   be generated. This only applies to the ARM architecture.
>> +
>> +   CRC instructions are enabled by default on ARMv8.
>> +
>>
>>  Controlling Size of Debug Information
>>  -------------------------------------
>>
>> Modified: cfe/trunk/include/clang/Driver/Options.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=193600&r1=193599&r2=193600&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Driver/Options.td (original)
>> +++ cfe/trunk/include/clang/Driver/Options.td Tue Oct 29 04:47:51 2013
>> @@ -1023,6 +1023,10 @@ def mno_thumb : Flag<["-"], "mno-thumb">
>>  def marm : Flag<["-"], "marm">, Alias<mno_thumb>;
>>  def ffixed_r9 : Flag<["-"], "ffixed-r9">, Group<m_arm_Features_Group>,
>>    HelpText<"Reserve the r9 register (ARM only)">;
>> +def mcrc : Flag<["-"], "mcrc">, Group<m_arm_Features_Group>,
>> +  HelpText<"Allow use of CRC instructions (ARM only)">;
>> +def mnocrc : Flag<["-"], "mnocrc">, Group<m_arm_Features_Group>,
>> +  HelpText<"Disallow use of CRC instructions (ARM only)">;
>>
>>  def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
>>  def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>;
>>
>> Modified: cfe/trunk/lib/Basic/Targets.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=193600&r1=193599&r2=193600&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Basic/Targets.cpp (original)
>> +++ cfe/trunk/lib/Basic/Targets.cpp Tue Oct 29 04:47:51 2013
>> @@ -3633,6 +3633,8 @@ class ARMTargetInfo : public TargetInfo
>>    unsigned SoftFloat : 1;
>>    unsigned SoftFloatABI : 1;
>>
>> +  unsigned CRC : 1;
>> +
>>    static const Builtin::Info BuiltinInfo[];
>>
>>    static bool shouldUseInlineAtomic(const llvm::Triple &T) {
>> @@ -3784,6 +3786,7 @@ public:
>>        Features["neon"] = true;
>>        Features["hwdiv"] = true;
>>        Features["hwdiv-arm"] = true;
>> +      Features["crc"] = true;
>>      } else if (CPU == "cortex-r5" || CPU == "cortex-m3" ||
>>                 CPU == "cortex-m4" ||
>>                 // Enable the hwdiv extension for all v8a AArch32 cores by
>> @@ -3798,6 +3801,7 @@ public:
>>    virtual bool handleTargetFeatures(std::vector<std::string> &Features,
>>                                      DiagnosticsEngine &Diags) {
>>      FPU = 0;
>> +    CRC = 0;
>>      SoftFloat = SoftFloatABI = false;
>>      HWDiv = 0;
>>      for (unsigned i = 0, e = Features.size(); i != e; ++i) {
>> @@ -3819,6 +3823,8 @@ public:
>>          HWDiv |= HWDivThumb;
>>        else if (Features[i] == "+hwdiv-arm")
>>          HWDiv |= HWDivARM;
>> +      else if (Features[i] == "+crc")
>> +        CRC = 1;
>>      }
>>
>>      if (!(FPU & NeonFPU) && FPMath == FP_Neon) {
>> @@ -3970,7 +3976,7 @@ public:
>>      if ((FPU & NeonFPU) && !SoftFloat && CPUArchVer >= 7)
>>        Builder.defineMacro("__ARM_NEON__");
>>
>> -    if (CPUArchVer == 8)
>> +    if (CRC)
>>        Builder.defineMacro("__ARM_FEATURE_CRC32");
>>
>>      if (CPUArchVer >= 6 && CPUArch != "6M") {
>>
>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=193600&r1=193599&r2=193600&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> +++ cfe/trunk/lib/Driver/Tools.cpp Tue Oct 29 04:47:51 2013
>> @@ -773,6 +773,15 @@ static void getARMTargetFeatures(const D
>>    // implementation, although the same isn't true of VFP or VFP3.
>>    if (FloatABI == "soft")
>>      Features.push_back("-neon");
>> +
>> +  // En/disable crc
>> +  if (Arg *A = Args.getLastArg(options::OPT_mcrc,
>> +                               options::OPT_mnocrc)) {
>> +    if (A->getOption().matches(options::OPT_mcrc))
>> +      Features.push_back("+crc");
>> +    else
>> +      Features.push_back("-crc");
>> +  }
>>  }
>>
>>  void Clang::AddARMTargetArgs(const ArgList &Args,
>>
>> Modified: cfe/trunk/test/Driver/arm-mfpu.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/arm-mfpu.c?rev=193600&r1=193599&r2=193600&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/Driver/arm-mfpu.c (original)
>> +++ cfe/trunk/test/Driver/arm-mfpu.c Tue Oct 29 04:47:51 2013
>> @@ -55,6 +55,7 @@
>>
>>  // RUN: %clang -target armv8-linux-gnueabihf -mfpu=fp-armv8 %s -### 2>&1 \
>>  // RUN:   | FileCheck --check-prefix=CHECK-FP-ARMV8 %s
>> +// CHECK-FP-ARMV8-NOT: "-target-feature" "+neon"
>>  // CHECK-FP-ARMV8: "-target-feature" "+fp-armv8"
>>  // CHECK-FP-ARMV8: "-target-feature" "-neon"
>>  // CHECK-FP-ARMV8: "-target-feature" "-crypto"
>>
>> Added: cfe/trunk/test/Driver/armv8-crc.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/armv8-crc.c?rev=193600&view=auto
>> ==============================================================================
>> --- cfe/trunk/test/Driver/armv8-crc.c (added)
>> +++ cfe/trunk/test/Driver/armv8-crc.c Tue Oct 29 04:47:51 2013
>> @@ -0,0 +1,8 @@
>> +// RUN: %clang -target armv8 -mcrc -### %s 2> %t
>> +// RUN: FileCheck --check-prefix=CHECK-V8-CRC < %t %s
>> +// CHECK-V8-CRC: "-target-feature" "+crc"
>> +
>> +// RUN: %clang -target armv8 -mnocrc -### %s 2> %t
>> +// RUN: FileCheck --check-prefix=CHECK-V8-NOCRC < %t %s
>> +// CHECK-V8-NOCRC: "-target-feature" "-crc"
>> +
>>
>> Propchange: cfe/trunk/test/Driver/armv8-crc.c
>> ------------------------------------------------------------------------------
>>     svn:eol-style = native
>>
>> Propchange: cfe/trunk/test/Driver/armv8-crc.c
>> ------------------------------------------------------------------------------
>>     svn:keywords = Rev Date Author URL Id
>>
>> Modified: cfe/trunk/test/Preprocessor/arm-target-features.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/arm-target-features.c?rev=193600&r1=193599&r2=193600&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/Preprocessor/arm-target-features.c (original)
>> +++ cfe/trunk/test/Preprocessor/arm-target-features.c Tue Oct 29 04:47:51 2013
>> @@ -27,6 +27,9 @@
>>  // CHECK-V8-BAREHF-NEON-FP: __ARM_NEON__ 1
>>  // CHECK-V8-BAREHF-NEON-FP: __VFP_FP__ 1
>>
>> +// RUN: %clang -target armv8a -mnocrc -x c -E -dM %s | FileCheck --check-prefix=CHECK-V8-NOCRC %s
>> +// CHECK-V8-NOCRC-NOT: __ARM_FEATURE_CRC32 1
>> +
>>  // Check that -mhwdiv works properly for armv8/thumbv8 (enabled by default).
>>
>>  // RUN: %clang -target armv8 -x c -E -dM %s -o - | FileCheck --check-prefix=ARMV8 %s
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list