[PATCH] D48169: [mips] Add '-mcrc', '-mno-crc' options to enable/disable CRC ASE
vstefanovic created this revision. vstefanovic added reviewers: sdardis, bogden. Herald added a reviewer: javed.absar. Herald added subscribers: cfe-commits, atanasyan, kristof.beyls, arichardson. '-mcrc' is shared with ARM. '-mno-crc' is Mips-only (ARM uses '-mnocrc'). Repository: rC Clang https://reviews.llvm.org/D48169 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Arch/Mips.cpp test/Driver/mips-features.c 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" 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: 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: 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" 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: 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<["-"],
[PATCH] D56878: [mips] Add '-mrelax-pic-calls', '-mno-relax-pic-calls'
vstefanovic created this revision. vstefanovic added a reviewer: atanasyan. Herald added subscribers: jrtc27, arichardson, sdardis. These two options enable/disable emission of R_{MICRO}MIPS_JALR fixups along with PIC calls. The linker may then try to turn PIC calls into direct jumps. By default, these fixups do get emitted by the backend, use '-mno-relax-pic-calls' to omit them. Repository: rC Clang https://reviews.llvm.org/D56878 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Clang.cpp test/Driver/mips-features.c Index: test/Driver/mips-features.c === --- test/Driver/mips-features.c +++ test/Driver/mips-features.c @@ -444,3 +444,15 @@ // RUN: -mginv -mno-ginv 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-GINV %s // CHECK-NO-GINV: "-target-feature" "-ginv" +// +// -mrelax-pic-calls +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-relax-pic-calls -mrelax-pic-calls 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-RELAX-PIC-CALLS %s +// CHECK-RELAX-PIC-CALLS-NOT: "-mllvm" "-mips-jalr-reloc=0" +// +// -mno-relax-pic-calls +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mrelax-pic-calls -mno-relax-pic-calls 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-RELAX-PIC-CALLS %s +// CHECK-NO-RELAX-PIC-CALLS: "-mllvm" "-mips-jalr-reloc=0" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -1712,6 +1712,14 @@ } else D.Diag(diag::warn_target_unsupported_compact_branches) << CPUName; } + + if (Arg *A = Args.getLastArg(options::OPT_mrelax_pic_calls, + options::OPT_mno_relax_pic_calls)) { +if (A->getOption().matches(options::OPT_mno_relax_pic_calls)) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back(Args.MakeArgString("-mips-jalr-reloc=0")); +} + } } void Clang::AddPPCTargetArgs(const ArgList &Args, Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -2402,6 +2402,14 @@ def mno_odd_spreg : Flag<["-"], "mno-odd-spreg">, Group, HelpText<"Disable odd single-precision floating point registers">, Flags<[HelpHidden]>; +def mrelax_pic_calls : Flag<["-"], "mrelax-pic-calls">, + Group, + HelpText<"Try turning PIC calls (j{al}r{c} $25) into direct calls " + "(MIPS only)">, Flags<[HelpHidden]>; +def mno_relax_pic_calls : Flag<["-"], "mno-relax-pic-calls">, + Group, + HelpText<"Do not try turning PIC calls (j{al}r{c} $25) into direct calls " + "(MIPS only)">, Flags<[HelpHidden]>; def mglibc : Flag<["-"], "mglibc">, Group, Flags<[HelpHidden]>; def muclibc : Flag<["-"], "muclibc">, Group, Flags<[HelpHidden]>; def module_file_info : Flag<["-"], "module-file-info">, Flags<[DriverOption,CC1Option]>, Group, Index: test/Driver/mips-features.c === --- test/Driver/mips-features.c +++ test/Driver/mips-features.c @@ -444,3 +444,15 @@ // RUN: -mginv -mno-ginv 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-GINV %s // CHECK-NO-GINV: "-target-feature" "-ginv" +// +// -mrelax-pic-calls +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-relax-pic-calls -mrelax-pic-calls 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-RELAX-PIC-CALLS %s +// CHECK-RELAX-PIC-CALLS-NOT: "-mllvm" "-mips-jalr-reloc=0" +// +// -mno-relax-pic-calls +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mrelax-pic-calls -mno-relax-pic-calls 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-RELAX-PIC-CALLS %s +// CHECK-NO-RELAX-PIC-CALLS: "-mllvm" "-mips-jalr-reloc=0" Index: lib/Driver/ToolChains/Clang.cpp === --- lib/Driver/ToolChains/Clang.cpp +++ lib/Driver/ToolChains/Clang.cpp @@ -1712,6 +1712,14 @@ } else D.Diag(diag::warn_target_unsupported_compact_branches) << CPUName; } + + if (Arg *A = Args.getLastArg(options::OPT_mrelax_pic_calls, + options::OPT_mno_relax_pic_calls)) { +if (A->getOption().matches(options::OPT_mno_relax_pic_calls)) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back(Args.MakeArgString("-mips-jalr-reloc=0")); +} + } } void Clang::AddPPCTargetArgs(const ArgList &Args, Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -2402,6 +2402,14 @@ def mno_odd_spreg : Flag<["-"], "mno-odd-spreg">, Group, HelpText<"Disable odd single-precision floating point registers">, Flags<[HelpHidden]>; +def mrelax_pic_calls : Flag<["-"], "mrelax-pic-calls">, + Group, +
[PATCH] D56878: [mips] Add '-mrelax-pic-calls', '-mno-relax-pic-calls'
This revision was automatically updated to reflect the committed changes. Closed by commit rL351579: [mips] Add '-mrelax-pic-calls', '-mno-relax-pic-calls' (authored by vstefanovic, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D56878?vs=182397&id=182572#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56878/new/ https://reviews.llvm.org/D56878 Files: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/mips-features.c Index: cfe/trunk/include/clang/Driver/Options.td === --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -2418,6 +2418,14 @@ def mno_odd_spreg : Flag<["-"], "mno-odd-spreg">, Group, HelpText<"Disable odd single-precision floating point registers">, Flags<[HelpHidden]>; +def mrelax_pic_calls : Flag<["-"], "mrelax-pic-calls">, + Group, + HelpText<"Try turning PIC calls (j{al}r{c} $25) into direct calls " + "(MIPS only)">, Flags<[HelpHidden]>; +def mno_relax_pic_calls : Flag<["-"], "mno-relax-pic-calls">, + Group, + HelpText<"Do not try turning PIC calls (j{al}r{c} $25) into direct calls " + "(MIPS only)">, Flags<[HelpHidden]>; def mglibc : Flag<["-"], "mglibc">, Group, Flags<[HelpHidden]>; def muclibc : Flag<["-"], "muclibc">, Group, Flags<[HelpHidden]>; def module_file_info : Flag<["-"], "module-file-info">, Flags<[DriverOption,CC1Option]>, Group, Index: cfe/trunk/test/Driver/mips-features.c === --- cfe/trunk/test/Driver/mips-features.c +++ cfe/trunk/test/Driver/mips-features.c @@ -444,3 +444,15 @@ // RUN: -mginv -mno-ginv 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-GINV %s // CHECK-NO-GINV: "-target-feature" "-ginv" +// +// -mrelax-pic-calls +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-relax-pic-calls -mrelax-pic-calls 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-RELAX-PIC-CALLS %s +// CHECK-RELAX-PIC-CALLS-NOT: "-mllvm" "-mips-jalr-reloc=0" +// +// -mno-relax-pic-calls +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mrelax-pic-calls -mno-relax-pic-calls 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-RELAX-PIC-CALLS %s +// CHECK-NO-RELAX-PIC-CALLS: "-mllvm" "-mips-jalr-reloc=0" Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp === --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp @@ -1716,6 +1716,14 @@ } else D.Diag(diag::warn_target_unsupported_compact_branches) << CPUName; } + + if (Arg *A = Args.getLastArg(options::OPT_mrelax_pic_calls, + options::OPT_mno_relax_pic_calls)) { +if (A->getOption().matches(options::OPT_mno_relax_pic_calls)) { + CmdArgs.push_back("-mllvm"); + CmdArgs.push_back("-mips-jalr-reloc=0"); +} + } } void Clang::AddPPCTargetArgs(const ArgList &Args, Index: cfe/trunk/include/clang/Driver/Options.td === --- cfe/trunk/include/clang/Driver/Options.td +++ cfe/trunk/include/clang/Driver/Options.td @@ -2418,6 +2418,14 @@ def mno_odd_spreg : Flag<["-"], "mno-odd-spreg">, Group, HelpText<"Disable odd single-precision floating point registers">, Flags<[HelpHidden]>; +def mrelax_pic_calls : Flag<["-"], "mrelax-pic-calls">, + Group, + HelpText<"Try turning PIC calls (j{al}r{c} $25) into direct calls " + "(MIPS only)">, Flags<[HelpHidden]>; +def mno_relax_pic_calls : Flag<["-"], "mno-relax-pic-calls">, + Group, + HelpText<"Do not try turning PIC calls (j{al}r{c} $25) into direct calls " + "(MIPS only)">, Flags<[HelpHidden]>; def mglibc : Flag<["-"], "mglibc">, Group, Flags<[HelpHidden]>; def muclibc : Flag<["-"], "muclibc">, Group, Flags<[HelpHidden]>; def module_file_info : Flag<["-"], "module-file-info">, Flags<[DriverOption,CC1Option]>, Group, Index: cfe/trunk/test/Driver/mips-features.c === --- cfe/trunk/test/Driver/mips-features.c +++ cfe/trunk/test/Driver/mips-features.c @@ -444,3 +444,15 @@ // RUN: -mginv -mno-ginv 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-GINV %s // CHECK-NO-GINV: "-target-feature" "-ginv" +// +// -mrelax-pic-calls +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-relax-pic-calls -mrelax-pic-calls 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-RELAX-PIC-CALLS %s +// CHECK-RELAX-PIC-CALLS-NOT: "-mllvm" "-mips-jalr-reloc=0" +// +// -mno-relax-pic-calls +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mrelax-pic-calls -mno-relax-pic-calls 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-RELAX-PIC-CALLS %s +// CHECK-NO-RELAX-PIC-CALLS: "-ml
[PATCH] D56878: [mips] Add '-mrelax-pic-calls', '-mno-relax-pic-calls'
vstefanovic marked an inline comment as done. vstefanovic added inline comments. Comment at: cfe/trunk/include/clang/Driver/Options.td:2423 + Group, + HelpText<"Try turning PIC calls (j{al}r{c} $25) into direct calls " + "(MIPS only)">, Flags<[HelpHidden]>; sdardis wrote: > I think this help text could be a little better. Instead of implying that the > compiler could turn PIC calls into direct calls, something like "Produce > relaxation hints for linkers to try optimizing PIC call sequences into direct > calls", I believe describes the optimization better. Likewise in the negative > sense for the -mno-relax-pic-calls. Hi Simon, I'll replace the text with your version, it's better indeed. Thanks. Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56878/new/ https://reviews.llvm.org/D56878 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48169: [mips] Add '-mcrc', '-mno-crc' options to enable/disable CRC ASE
This revision was automatically updated to reflect the committed changes. Closed by commit rC336347: [mips] Add '-mcrc', '-mno-crc' options to enable/disable CRC ASE (authored by vstefanovic, committed by ). Repository: rC Clang https://reviews.llvm.org/D48169 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Arch/Mips.cpp test/Driver/mips-features.c 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" Index: lib/Driver/ToolChains/Arch/Mips.cpp === --- lib/Driver/ToolChains/Arch/Mips.cpp +++ lib/Driver/ToolChains/Arch/Mips.cpp @@ -350,6 +350,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: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1993,8 +1993,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, @@ -2212,6 +2212,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: 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" Index: lib/Driver/ToolChains/Arch/Mips.cpp === --- lib/Driver/ToolChains/Arch/Mips.cpp +++ lib/Driver/ToolChains/Arch/Mips.cpp @@ -350,6 +350,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: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -1993,8 +1993,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
[PATCH] D48982: [mips] Add '-mvirt', '-mno-virt', '-mginv', '-mno-ginv' options
vstefanovic created this revision. vstefanovic added a reviewer: atanasyan. Herald added subscribers: cfe-commits, arichardson, sdardis. '-mvirt'/'-mno-virt' enables/disables Virtualization ASE. '-mginv'/'-mno-ginv' enables/disables GINV (Global Invalidate) ASE. Repository: rC Clang https://reviews.llvm.org/D48982 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Arch/Mips.cpp test/Driver/mips-features.c Index: test/Driver/mips-features.c === --- test/Driver/mips-features.c +++ test/Driver/mips-features.c @@ -420,3 +420,27 @@ // RUN: -mcrc -mno-crc 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-CRC %s // CHECK-NO-CRC: "-target-feature" "-crc" +// +// -mvirt +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-virt -mvirt 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VIRT %s +// CHECK-VIRT: "-target-feature" "+virt" +// +// -mno-virt +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mvirt -mno-virt 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-VIRT %s +// CHECK-NO-VIRT: "-target-feature" "-virt" +// +// -mginv +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-ginv -mginv 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-GINV %s +// CHECK-GINV: "-target-feature" "+ginv" +// +// -mno-ginv +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mginv -mno-ginv 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-GINV %s +// CHECK-NO-GINV: "-target-feature" "-ginv" Index: lib/Driver/ToolChains/Arch/Mips.cpp === --- lib/Driver/ToolChains/Arch/Mips.cpp +++ lib/Driver/ToolChains/Arch/Mips.cpp @@ -352,6 +352,10 @@ AddTargetFeature(Args, Features, options::OPT_mmt, options::OPT_mno_mt, "mt"); AddTargetFeature(Args, Features, options::OPT_mcrc, options::OPT_mno_crc, "crc"); + AddTargetFeature(Args, Features, options::OPT_mvirt, options::OPT_mno_virt, + "virt"); + AddTargetFeature(Args, Features, options::OPT_mginv, options::OPT_mno_ginv, + "ginv"); if (Arg *A = Args.getLastArg(options::OPT_mindirect_jump_EQ)) { StringRef Val = StringRef(A->getValue()); Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -2214,6 +2214,10 @@ 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 mvirt : Flag<["-"], "mvirt">, Group; +def mno_virt : Flag<["-"], "mno-virt">, Group; +def mginv : Flag<["-"], "mginv">, Group; +def mno_ginv : Flag<["-"], "mno-ginv">, Group; def mips1 : Flag<["-"], "mips1">, Alias, AliasArgs<["mips1"]>, Group, HelpText<"Equivalent to -march=mips1">, Flags<[HelpHidden]>; Index: test/Driver/mips-features.c === --- test/Driver/mips-features.c +++ test/Driver/mips-features.c @@ -420,3 +420,27 @@ // RUN: -mcrc -mno-crc 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-CRC %s // CHECK-NO-CRC: "-target-feature" "-crc" +// +// -mvirt +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-virt -mvirt 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VIRT %s +// CHECK-VIRT: "-target-feature" "+virt" +// +// -mno-virt +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mvirt -mno-virt 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-VIRT %s +// CHECK-NO-VIRT: "-target-feature" "-virt" +// +// -mginv +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-ginv -mginv 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-GINV %s +// CHECK-GINV: "-target-feature" "+ginv" +// +// -mno-ginv +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mginv -mno-ginv 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-GINV %s +// CHECK-NO-GINV: "-target-feature" "-ginv" Index: lib/Driver/ToolChains/Arch/Mips.cpp === --- lib/Driver/ToolChains/Arch/Mips.cpp +++ lib/Driver/ToolChains/Arch/Mips.cpp @@ -352,6 +352,10 @@ AddTargetFeature(Args, Features, options::OPT_mmt, options::OPT_mno_mt, "mt"); AddTargetFeature(Args, Features, options::OPT_mcrc, options::OPT_mno_crc, "crc"); + AddTargetFeature(Args, Features, options::OPT_mvirt, options::OPT_mno_virt, + "virt"); + AddTargetFeature(Args, Features, options::OPT_mginv, options::OPT_mno_ginv, + "ginv"); if (Arg *A = Args.getLastArg(options::OPT_mindirect_jump_EQ)) { StringRef Val = StringRef(A->getValue()); Index: include/clang/Driver/Options.td =
[PATCH] D48982: [mips] Add '-mvirt', '-mno-virt', '-mginv', '-mno-ginv' options
This revision was automatically updated to reflect the committed changes. Closed by commit rC336798: [mips] Add '-mvirt', '-mno-virt', '-mginv', '-mno-ginv' options (authored by vstefanovic, committed by ). Repository: rC Clang https://reviews.llvm.org/D48982 Files: include/clang/Driver/Options.td lib/Driver/ToolChains/Arch/Mips.cpp test/Driver/mips-features.c Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -2216,6 +2216,10 @@ 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 mvirt : Flag<["-"], "mvirt">, Group; +def mno_virt : Flag<["-"], "mno-virt">, Group; +def mginv : Flag<["-"], "mginv">, Group; +def mno_ginv : Flag<["-"], "mno-ginv">, Group; def mips1 : Flag<["-"], "mips1">, Alias, AliasArgs<["mips1"]>, Group, HelpText<"Equivalent to -march=mips1">, Flags<[HelpHidden]>; Index: test/Driver/mips-features.c === --- test/Driver/mips-features.c +++ test/Driver/mips-features.c @@ -420,3 +420,27 @@ // RUN: -mcrc -mno-crc 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-CRC %s // CHECK-NO-CRC: "-target-feature" "-crc" +// +// -mvirt +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-virt -mvirt 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VIRT %s +// CHECK-VIRT: "-target-feature" "+virt" +// +// -mno-virt +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mvirt -mno-virt 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-VIRT %s +// CHECK-NO-VIRT: "-target-feature" "-virt" +// +// -mginv +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-ginv -mginv 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-GINV %s +// CHECK-GINV: "-target-feature" "+ginv" +// +// -mno-ginv +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mginv -mno-ginv 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-GINV %s +// CHECK-NO-GINV: "-target-feature" "-ginv" Index: lib/Driver/ToolChains/Arch/Mips.cpp === --- lib/Driver/ToolChains/Arch/Mips.cpp +++ lib/Driver/ToolChains/Arch/Mips.cpp @@ -352,6 +352,10 @@ AddTargetFeature(Args, Features, options::OPT_mmt, options::OPT_mno_mt, "mt"); AddTargetFeature(Args, Features, options::OPT_mcrc, options::OPT_mno_crc, "crc"); + AddTargetFeature(Args, Features, options::OPT_mvirt, options::OPT_mno_virt, + "virt"); + AddTargetFeature(Args, Features, options::OPT_mginv, options::OPT_mno_ginv, + "ginv"); if (Arg *A = Args.getLastArg(options::OPT_mindirect_jump_EQ)) { StringRef Val = StringRef(A->getValue()); Index: include/clang/Driver/Options.td === --- include/clang/Driver/Options.td +++ include/clang/Driver/Options.td @@ -2216,6 +2216,10 @@ 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 mvirt : Flag<["-"], "mvirt">, Group; +def mno_virt : Flag<["-"], "mno-virt">, Group; +def mginv : Flag<["-"], "mginv">, Group; +def mno_ginv : Flag<["-"], "mno-ginv">, Group; def mips1 : Flag<["-"], "mips1">, Alias, AliasArgs<["mips1"]>, Group, HelpText<"Equivalent to -march=mips1">, Flags<[HelpHidden]>; Index: test/Driver/mips-features.c === --- test/Driver/mips-features.c +++ test/Driver/mips-features.c @@ -420,3 +420,27 @@ // RUN: -mcrc -mno-crc 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-CRC %s // CHECK-NO-CRC: "-target-feature" "-crc" +// +// -mvirt +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-virt -mvirt 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VIRT %s +// CHECK-VIRT: "-target-feature" "+virt" +// +// -mno-virt +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mvirt -mno-virt 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-VIRT %s +// CHECK-NO-VIRT: "-target-feature" "-virt" +// +// -mginv +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mno-ginv -mginv 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-GINV %s +// CHECK-GINV: "-target-feature" "+ginv" +// +// -mno-ginv +// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: -mginv -mno-ginv 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-GINV %s +// CHECK-NO-GINV: "-target-feature" "-ginv" Index: lib/Driver/ToolChains/Arch/Mips.cpp === --- lib/Driver/ToolChains/Arch/Mips.cpp +++ lib/Driv