summaryrefslogtreecommitdiffstats
path: root/llvm/unittests
diff options
context:
space:
mode:
authorJohn Brawn <john.brawn@arm.com>2015-05-08 12:52:02 +0000
committerJohn Brawn <john.brawn@arm.com>2015-05-08 12:52:02 +0000
commit50ed9470dcd867c3341991bdc3fe704db43aae4d (patch)
treea12ed06ca5854c8ebdcb667dc9180ad3a13574a4 /llvm/unittests
parent6c253006b8961247e7406592675d8787d761dce1 (diff)
downloadbcm5719-llvm-50ed9470dcd867c3341991bdc3fe704db43aae4d.tar.gz
bcm5719-llvm-50ed9470dcd867c3341991bdc3fe704db43aae4d.zip
[ARM] Reject invalid -march values
Restructure Triple::getARMCPUForArch so that invalid values will return nullptr, while retaining the behaviour that an argument specifying no particular architecture version will give a default CPU. This will be used by clang to give an error on invalid -march values. Also restructure the extraction of the architecture version from the MArch string a little to hopefully make what it's doing clearer. Differential Revision: http://reviews.llvm.org/D9599 llvm-svn: 236845
Diffstat (limited to 'llvm/unittests')
-rw-r--r--llvm/unittests/ADT/TripleTest.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp
index 96050374221..d168097d540 100644
--- a/llvm/unittests/ADT/TripleTest.cpp
+++ b/llvm/unittests/ADT/TripleTest.cpp
@@ -705,6 +705,37 @@ TEST(TripleTest, getARMCPUForArch) {
llvm::Triple Triple("arm--nacl");
EXPECT_STREQ("cortex-a8", Triple.getARMCPUForArch("arm"));
}
+ // armebv6 and armv6eb are permitted, but armebv6eb is not
+ {
+ llvm::Triple Triple("armebv6-non-eabi");
+ EXPECT_STREQ("arm1136jf-s", Triple.getARMCPUForArch());
+ }
+ {
+ llvm::Triple Triple("armv6eb-none-eabi");
+ EXPECT_STREQ("arm1136jf-s", Triple.getARMCPUForArch());
+ }
+ {
+ llvm::Triple Triple("armebv6eb-none-eabi");
+ EXPECT_EQ(nullptr, Triple.getARMCPUForArch());
+ }
+ // armeb is permitted, but armebeb is not
+ {
+ llvm::Triple Triple("armeb-none-eabi");
+ EXPECT_STREQ("arm7tdmi", Triple.getARMCPUForArch());
+ }
+ {
+ llvm::Triple Triple("armebeb-none-eabi");
+ EXPECT_EQ(nullptr, Triple.getARMCPUForArch());
+ }
+ // xscaleeb is permitted, but armebxscale is not
+ {
+ llvm::Triple Triple("xscaleeb-none-eabi");
+ EXPECT_STREQ("xscale", Triple.getARMCPUForArch());
+ }
+ {
+ llvm::Triple Triple("armebxscale-none-eabi");
+ EXPECT_EQ(nullptr, Triple.getARMCPUForArch());
+ }
}
TEST(TripleTest, NormalizeARM) {
OpenPOWER on IntegriCloud