diff unittests/IR/IntrinsicsTest.cpp @ 120:1172e4bd9c6f

update 4.0.0
author mir3636
date Fri, 25 Nov 2016 19:14:25 +0900
parents
children c2174574ed3a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/unittests/IR/IntrinsicsTest.cpp	Fri Nov 25 19:14:25 2016 +0900
@@ -0,0 +1,40 @@
+//===- llvm/unittest/IR/IntrinsicsTest.cpp - ------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/IR/IntrinsicInst.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+
+namespace {
+
+static const char *const NameTable1[] = {
+  "llvm.foo",
+  "llvm.foo.a",
+  "llvm.foo.b",
+  "llvm.foo.b.a",
+  "llvm.foo.c",
+};
+
+TEST(IntrinNameLookup, Basic) {
+  int I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo");
+  EXPECT_EQ(0, I);
+  I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.f64");
+  EXPECT_EQ(0, I);
+  I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.b");
+  EXPECT_EQ(2, I);
+  I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.b.a");
+  EXPECT_EQ(3, I);
+  I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.c");
+  EXPECT_EQ(4, I);
+  I = Intrinsic::lookupLLVMIntrinsicByName(NameTable1, "llvm.foo.c.f64");
+  EXPECT_EQ(4, I);
+}
+
+} // end namespace