Recommit "rL366894: [yaml2obj] - Allow custom fields for the SHT_UNDEF sections."
[llvm-complete.git] / unittests / IR / IntrinsicsTest.cpp
bloba500346b66a5e40d895a8fc7191ddb42850e7975
1 //===- llvm/unittest/IR/IntrinsicsTest.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 #include "llvm/IR/IntrinsicInst.h"
10 #include "gtest/gtest.h"
12 using namespace llvm;
14 namespace {
16 static const char *const NameTable1[] = {
17 "llvm.foo",
18 "llvm.foo.a",
19 "llvm.foo.b",
20 "llvm.foo.b.a",
21 "llvm.foo.c",
24 TEST(IntrinNameLookup, Basic) {
25 int I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo");
26 EXPECT_EQ(0, I);
27 I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.f64");
28 EXPECT_EQ(0, I);
29 I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.b");
30 EXPECT_EQ(2, I);
31 I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.b.a");
32 EXPECT_EQ(3, I);
33 I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.c");
34 EXPECT_EQ(4, I);
35 I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.c.f64");
36 EXPECT_EQ(4, I);
39 } // end namespace