Skip to content

Commit 784004e

Browse files
committedMar 27, 2017
[ARM] Add a driver option for +no-neg-immediates
Reviewers: olista01, rengolin, javed.absar, samparker Reviewed By: samparker Subscribers: samparker, llvm-commits, aemerson Differential Revision: https://reviews.llvm.org/D31197 llvm-svn: 298850
1 parent d668a01 commit 784004e

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed
 

‎clang/include/clang/Driver/Options.td

+2
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,8 @@ def mcrc : Flag<["-"], "mcrc">, Group<m_arm_Features_Group>,
17601760
HelpText<"Allow use of CRC instructions (ARM only)">;
17611761
def mnocrc : Flag<["-"], "mnocrc">, Group<m_arm_Features_Group>,
17621762
HelpText<"Disallow use of CRC instructions (ARM only)">;
1763+
def mno_neg_immediates: Flag<["-"], "mno-neg-immediates">, Group<m_arm_Features_Group>,
1764+
HelpText<"Disallow converting instructions with negative immediates to their negation or inversion.">;
17631765

17641766
def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group<m_aarch64_Features_Group>,
17651767
HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">;

‎clang/lib/Driver/ToolChains/Arch/AArch64.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,7 @@ void aarch64::getAArch64TargetFeatures(const Driver &D, const ArgList &Args,
193193

194194
if (Args.hasArg(options::OPT_ffixed_x18))
195195
Features.push_back("+reserve-x18");
196+
197+
if (Args.hasArg(options::OPT_mno_neg_immediates))
198+
Features.push_back("+no-neg-immediates");
196199
}

‎clang/lib/Driver/ToolChains/Arch/ARM.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ void arm::getARMTargetFeatures(const ToolChain &TC,
449449
// The kext linker doesn't know how to deal with movw/movt.
450450
if (KernelOrKext || Args.hasArg(options::OPT_mno_movt))
451451
Features.push_back("+no-movt");
452+
453+
if (Args.hasArg(options::OPT_mno_neg_immediates))
454+
Features.push_back("+no-neg-immediates");
452455
}
453456

454457
const std::string arm::getARMArch(StringRef Arch, const llvm::Triple &Triple) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %clang -target arm-none-gnueabi -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT
2+
// RUN: %clang -target arm-none-gnueabi -mno-neg-immediates -### %s 2>&1 | FileCheck %s
3+
4+
// RUN: %clang -target aarch64-none-gnueabi -### %s 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT
5+
// RUN: %clang -target aarch64-none-gnueabi -mno-neg-immediates -### %s 2>&1 | FileCheck %s
6+
7+
// CHECK: "-target-feature" "+no-neg-immediates"
8+
// CHECK-DEFAULT-NOT: "+no-neg-immediates"

0 commit comments

Comments
 (0)
Please sign in to comment.