Fix a bug in TableGen where the intrinsic function name recognizer could mis-identify...
[oota-llvm.git] / test / TableGen / intrinsic-order.td
1 // RUN: llvm-tblgen -gen-intrinsic %s | FileCheck %s
2
3 class IntrinsicProperty;
4
5 class ValueType<int size, int value> {
6   string Namespace = "MVT";
7   int Size = size;
8   int Value = value;
9 }
10
11 class LLVMType<ValueType vt> {
12   ValueType VT = vt;
13 }
14
15 class Intrinsic<string name, list<LLVMType> param_types = []> {
16   string LLVMName = name;
17   bit isTarget = 0;
18   string TargetPrefix = "";
19   list<LLVMType> RetTypes = [];
20   list<LLVMType> ParamTypes = param_types;
21   list<IntrinsicProperty> Properties = [];
22 }
23
24 def iAny : ValueType<0, 254>;
25 def llvm_anyint_ty : LLVMType<iAny>;
26
27
28 // Make sure an intrinsic name that is a prefix of another is checked after the
29 // other.
30
31 // CHECK: if (NameR.startswith("oo.bar.")) return Intrinsic::foo_bar;
32 // CHECK: if (NameR.startswith("oo.")) return Intrinsic::foo;
33
34 def int_foo : Intrinsic<"llvm.foo", [llvm_anyint_ty]>;
35 def int_foo_bar : Intrinsic<"llvm.foo.bar", [llvm_anyint_ty]>;