diff options
author | David Greene <greened@obbligato.org> | 2009-06-08 20:23:18 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2009-06-08 20:23:18 +0000 |
commit | e1b469170bb3ab259fd488fb95c29efe802cdd6a (patch) | |
tree | b3c98585bc4d30950a3c48ba9c865c47792aec89 /test/TableGen | |
parent | 77c489dcae2d7906fae653e2d25e023004d1b9e4 (diff) |
Make IntInits and ListInits typed. This helps deduce types of !if and
other operators. For the rare cases where a list type cannot be
deduced, provide a []<type> syntax, where <type> is the list element
type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73078 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen')
-rw-r--r-- | test/TableGen/Slice.td | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/test/TableGen/Slice.td b/test/TableGen/Slice.td new file mode 100644 index 0000000000..75765d31e6 --- /dev/null +++ b/test/TableGen/Slice.td @@ -0,0 +1,87 @@ +// RUN: tblgen %s | grep {[(set VR128:$dst, (int_x86_sse2_add_pd VR128:$src1, VR128:$src2))]} | count 1 +// RUN: tblgen %s | grep {[(set VR128:$dst, (int_x86_sse2_add_ps VR128:$src1, VR128:$src2))]} | count 2 + +class ValueType<int size, int value> { + int Size = size; + int Value = value; +} + +def f32 : ValueType<32, 1>; // 2 x i64 vector value + +class Intrinsic<string name> { + string Name = name; +} + +class Inst<bits<8> opcode, dag oopnds, dag iopnds, string asmstr, + list<dag> pattern> { + bits<8> Opcode = opcode; + dag OutOperands = oopnds; + dag InOperands = iopnds; + string AssemblyString = asmstr; + list<dag> Pattern = pattern; +} + +def ops; +def outs; +def ins; + +def set; + +// Define registers +class Register<string n> { + string Name = n; +} + +class RegisterClass<list<ValueType> regTypes, list<Register> regList> { + list<ValueType> RegTypes = regTypes; + list<Register> MemberList = regList; +} + +def XMM0: Register<"xmm0">; +def XMM1: Register<"xmm1">; +def XMM2: Register<"xmm2">; +def XMM3: Register<"xmm3">; +def XMM4: Register<"xmm4">; +def XMM5: Register<"xmm5">; +def XMM6: Register<"xmm6">; +def XMM7: Register<"xmm7">; +def XMM8: Register<"xmm8">; +def XMM9: Register<"xmm9">; +def XMM10: Register<"xmm10">; +def XMM11: Register<"xmm11">; +def XMM12: Register<"xmm12">; +def XMM13: Register<"xmm13">; +def XMM14: Register<"xmm14">; +def XMM15: Register<"xmm15">; + +def FR32 : RegisterClass<[f32], + [XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, + XMM8, XMM9, XMM10, XMM11, + XMM12, XMM13, XMM14, XMM15]>; + +class SDNode {} +def not : SDNode; + +multiclass scalar<bits<8> opcode, string asmstr = "", list<list<dag>> patterns = []> { + def SSrr : Inst<opcode, (outs FR32:$dst), (ins FR32:$src), + !strconcat(asmstr, "\t$dst, $src"), + !if(!null(patterns),[]<dag>,patterns[0])>; + def SSrm : Inst<opcode, (outs FR32:$dst), (ins FR32:$src), + !strconcat(asmstr, "\t$dst, $src"), + !if(!null(patterns),[]<dag>,!if(!null(!cdr(patterns)),patterns[0],patterns[1]))>; +} + +multiclass vscalar<bits<8> opcode, string asmstr = "", list<list<dag>> patterns = []> { + def V#NAME#SSrr : Inst<opcode, (outs FR32:$dst), (ins FR32:$src), + !strconcat(asmstr, "\t$dst, $src"), + !if(!null(patterns),[]<dag>,patterns[0])>; + def V#NAME#SSrm : Inst<opcode, (outs FR32:$dst), (ins FR32:$src), + !strconcat(asmstr, "\t$dst, $src"), + !if(!null(patterns),[]<dag>,!if(!null(!cdr(patterns)),patterns[0],patterns[1]))>; +} + +multiclass myscalar<bits<8> opcode, string asmstr = "", list<list<dag>> patterns = []> : + scalar<opcode, asmstr, patterns>, + vscalar<opcode, asmstr, patterns>; + +defm NOT : myscalar<0x10, "not", [[], [(set FR32:$dst, (f32 (not FR32:$src)))]]>; |