[ARM] Masked load and store and predicate tests. NFC
[llvm-complete.git] / unittests / MC / TargetRegistry.cpp
blob587b2eeffdd7544274feb1bbca2c61ecd3be7968
1 //===- unittests/MC/TargetRegistry.cpp ------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // The target registry code lives in Support, but it relies on linking in all
10 // LLVM targets. We keep this test with the MC tests, which already do that, to
11 // keep the SupportTests target small.
13 #include "llvm/Support/TargetRegistry.h"
14 #include "llvm/Support/TargetSelect.h"
15 #include "gtest/gtest.h"
17 using namespace llvm;
19 namespace {
21 TEST(TargetRegistry, TargetHasArchType) {
22 // Presence of at least one target will be asserted when done with the loop,
23 // else this would pass by accident if InitializeAllTargetInfos were omitted.
24 int Count = 0;
26 llvm::InitializeAllTargetInfos();
28 for (const Target &T : TargetRegistry::targets()) {
29 StringRef Name = T.getName();
30 // There is really no way (at present) to ask a Target whether it targets
31 // a specific architecture, because the logic for that is buried in a
32 // predicate.
33 // We can't ask the predicate "Are you a function that always returns
34 // false?"
35 // So given that the cpp backend truly has no target arch, it is skipped.
36 if (Name != "cpp") {
37 Triple::ArchType Arch = Triple::getArchTypeForLLVMName(Name);
38 EXPECT_NE(Arch, Triple::UnknownArch);
39 ++Count;
42 ASSERT_NE(Count, 0);
45 } // end namespace