Index: include/clang/Driver/Options.td =================================================================== --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1992,8 +1992,8 @@ HelpText<"Reserve the r9 register (ARM only)">; def mno_movt : Flag<["-"], "mno-movt">, Group, HelpText<"Disallow use of movt/movw pairs (ARM only)">; -def mcrc : Flag<["-"], "mcrc">, Group, - HelpText<"Allow use of CRC instructions (ARM only)">; +def mcrc : Flag<["-"], "mcrc">, Group, + HelpText<"Allow use of CRC instructions (ARM/Mips only)">; def mnocrc : Flag<["-"], "mnocrc">, Group, HelpText<"Disallow use of CRC instructions (ARM only)">; def mno_neg_immediates: Flag<["-"], "mno-neg-immediates">, Group, @@ -2211,6 +2211,8 @@ HelpText<"Enable SVR4-style position-independent code (Mips only)">; def mno_abicalls : Flag<["-"], "mno-abicalls">, Group, HelpText<"Disable SVR4-style position-independent code (Mips only)">; +def mno_crc : Flag<["-"], "mno-crc">, Group, + HelpText<"Disallow use of CRC instructions (Mips only)">; def mips1 : Flag<["-"], "mips1">, Alias, AliasArgs<["mips1"]>, Group, HelpText<"Equivalent to -march=mips1">, Flags<[HelpHidden]>; Index: lib/Driver/ToolChains/Arch/Mips.cpp =================================================================== --- lib/Driver/ToolChains/Arch/Mips.cpp +++ lib/Driver/ToolChains/Arch/Mips.cpp @@ -352,6 +352,8 @@ AddTargetFeature(Args, Features, options::OPT_mno_madd4, options::OPT_mmadd4, "nomadd4"); AddTargetFeature(Args, Features, options::OPT_mmt, options::OPT_mno_mt, "mt"); + AddTargetFeature(Args, Features, options::OPT_mcrc, options::OPT_mno_crc, + "crc"); if (Arg *A = Args.getLastArg(options::OPT_mindirect_jump_EQ)) { StringRef Val = StringRef(A->getValue()); Index: test/Driver/mips-features.c =================================================================== --- test/Driver/mips-features.c +++ test/Driver/mips-features.c @@ -408,3 +408,15 @@ // RUN: -mindirect-jump=hazard 2>&1 \ // RUN: | FileCheck --check-prefix=INDIRECT-BH %s // INDIRECT-BH: "-target-feature" "+use-indirect-jump-hazard" +// +// -mcrc +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-crc -mcrc 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-CRC %s +// CHECK-CRC: "-target-feature" "+crc" +// +// -mno-crc +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mcrc -mno-crc 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-CRC %s +// CHECK-NO-CRC: "-target-feature" "-crc"