OSDN Git Service

[Dominators] Visit affected node candidates found at different root levels
[android-x86/external-llvm.git] / unittests / IR / IntrinsicsTest.cpp
1 //===- llvm/unittest/IR/IntrinsicsTest.cpp - ------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "llvm/IR/IntrinsicInst.h"
11 #include "gtest/gtest.h"
12
13 using namespace llvm;
14
15 namespace {
16
17 static const char *const NameTable1[] = {
18   "llvm.foo",
19   "llvm.foo.a",
20   "llvm.foo.b",
21   "llvm.foo.b.a",
22   "llvm.foo.c",
23 };
24
25 TEST(IntrinNameLookup, Basic) {
26   int I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo");
27   EXPECT_EQ(0, I);
28   I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.f64");
29   EXPECT_EQ(0, I);
30   I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.b");
31   EXPECT_EQ(2, I);
32   I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.b.a");
33   EXPECT_EQ(3, I);
34   I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.c");
35   EXPECT_EQ(4, I);
36   I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.c.f64");
37   EXPECT_EQ(4, I);
38 }
39
40 } // end namespace