[PATCH] D38633: [TableGen] Allow intrinsics to have up to 8 return values.
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 6 09:37:35 PDT 2017
tra created this revision.
Herald added subscribers: hiraditya, jlebar, sanjoy.
The change is needed for my upcoming changes to NVPTX back-end that implement an intrinsic that has up to 8 output values.
https://reviews.llvm.org/D38633
Files:
llvm/lib/IR/Function.cpp
llvm/test/TableGen/intrinsic-struct.td
llvm/utils/TableGen/IntrinsicEmitter.cpp
Index: llvm/utils/TableGen/IntrinsicEmitter.cpp
===================================================================
--- llvm/utils/TableGen/IntrinsicEmitter.cpp
+++ llvm/utils/TableGen/IntrinsicEmitter.cpp
@@ -214,7 +214,10 @@
IIT_VEC_OF_ANYPTRS_TO_ELT = 34,
IIT_I128 = 35,
IIT_V512 = 36,
- IIT_V1024 = 37
+ IIT_V1024 = 37,
+ IIT_STRUCT6 = 38,
+ IIT_STRUCT7 = 39,
+ IIT_STRUCT8 = 40
};
static void EncodeFixedValueType(MVT::SimpleValueType VT,
@@ -369,6 +372,9 @@
case 3: TypeSig.push_back(IIT_STRUCT3); break;
case 4: TypeSig.push_back(IIT_STRUCT4); break;
case 5: TypeSig.push_back(IIT_STRUCT5); break;
+ case 6: TypeSig.push_back(IIT_STRUCT6); break;
+ case 7: TypeSig.push_back(IIT_STRUCT7); break;
+ case 8: TypeSig.push_back(IIT_STRUCT8); break;
default: llvm_unreachable("Unhandled case in struct");
}
Index: llvm/test/TableGen/intrinsic-struct.td
===================================================================
--- /dev/null
+++ llvm/test/TableGen/intrinsic-struct.td
@@ -0,0 +1,32 @@
+// RUN: llvm-tblgen -gen-intrinsic %s | FileCheck %s
+// XFAIL: vg_leak
+
+class IntrinsicProperty;
+
+class ValueType<int size, int value> {
+ string Namespace = "MVT";
+ int Size = size;
+ int Value = value;
+}
+
+class LLVMType<ValueType vt> {
+ ValueType VT = vt;
+}
+
+class Intrinsic<string name, list<LLVMType> ret_types = []> {
+ string LLVMName = name;
+ bit isTarget = 0;
+ string TargetPrefix = "";
+ list<LLVMType> RetTypes = ret_types;
+ list<LLVMType> ParamTypes = [];
+ list<IntrinsicProperty> IntrProperties = [];
+}
+
+def iAny : ValueType<0, 253>;
+def llvm_anyint_ty : LLVMType<iAny>;
+
+// Make sure we can return up to 8 values
+// CHECK: returns_8_results // llvm.returns.8.results
+def int_returns_8_results : Intrinsic<"llvm.returns.8.results",
+ [llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty,
+ llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty, llvm_anyint_ty]>;
Index: llvm/lib/IR/Function.cpp
===================================================================
--- llvm/lib/IR/Function.cpp
+++ llvm/lib/IR/Function.cpp
@@ -649,7 +649,10 @@
IIT_VEC_OF_ANYPTRS_TO_ELT = 34,
IIT_I128 = 35,
IIT_V512 = 36,
- IIT_V1024 = 37
+ IIT_V1024 = 37,
+ IIT_STRUCT6 = 38,
+ IIT_STRUCT7 = 39,
+ IIT_STRUCT8 = 40
};
static void DecodeIITType(unsigned &NextElt, ArrayRef<unsigned char> Infos,
@@ -798,6 +801,9 @@
case IIT_EMPTYSTRUCT:
OutputTable.push_back(IITDescriptor::get(IITDescriptor::Struct, 0));
return;
+ case IIT_STRUCT8: ++StructElts; LLVM_FALLTHROUGH;
+ case IIT_STRUCT7: ++StructElts; LLVM_FALLTHROUGH;
+ case IIT_STRUCT6: ++StructElts; LLVM_FALLTHROUGH;
case IIT_STRUCT5: ++StructElts; LLVM_FALLTHROUGH;
case IIT_STRUCT4: ++StructElts; LLVM_FALLTHROUGH;
case IIT_STRUCT3: ++StructElts; LLVM_FALLTHROUGH;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38633.118021.patch
Type: text/x-patch
Size: 2869 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171006/6bf34572/attachment.bin>
More information about the llvm-commits
mailing list