diff options
author | David Greene <greened@obbligato.org> | 2011-10-05 22:42:48 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2011-10-05 22:42:48 +0000 |
commit | fd56d75396fd945d5cedb634d34fb3c3f739b3e8 (patch) | |
tree | 2e791b41146c5fdec2c73ed661f1de72268ce7c2 /test/TableGen/MultiPat.td | |
parent | e5d5cdf2e971e746b103bab8a5258469a716cacf (diff) | |
download | llvm-fd56d75396fd945d5cedb634d34fb3c3f739b3e8.tar.gz llvm-fd56d75396fd945d5cedb634d34fb3c3f739b3e8.tar.bz2 llvm-fd56d75396fd945d5cedb634d34fb3c3f739b3e8.tar.xz |
Update Test for Multidefs
Update the MultiPat.td test to create some defs via multidefs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141235 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/TableGen/MultiPat.td')
-rw-r--r-- | test/TableGen/MultiPat.td | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/test/TableGen/MultiPat.td b/test/TableGen/MultiPat.td index 54c13c1975..ed14438ca6 100644 --- a/test/TableGen/MultiPat.td +++ b/test/TableGen/MultiPat.td @@ -85,8 +85,16 @@ def int_x86_sse2_add_ps : Intrinsic<"addps">; def int_x86_sse2_add_pd : Intrinsic<"addpd">; def INTRINSIC : Intrinsic<"Dummy">; def bitconvert; +def add; -class MakePat<list<dag> patterns> : Pat<patterns[0], patterns[1]>; +class MakePatImpl<list<dag> patterns> : Pat<patterns[0], patterns[1]>; +class MakePat<list<dag> patterns, + string suffix, + string intr> : MakePatImpl<!foreach(Decls.pattern, patterns, + !foreach(Decls.operand, Decls.pattern, + !subst(INTRINSIC, !cast<Intrinsic>(!subst("SUFFIX", suffix, intr)), + !subst(REGCLASS, VR128, + !subst(MNEMONIC, set, Decls.operand)))))>; class Base<bits<8> opcode, dag opnds, dag iopnds, string asmstr, Intrinsic intr, list<list<dag>> patterns> @@ -95,12 +103,7 @@ class Base<bits<8> opcode, dag opnds, dag iopnds, string asmstr, Intrinsic intr, !foreach(Decls.operand, Decls.pattern, !subst(INTRINSIC, intr, !subst(REGCLASS, VR128, - !subst(MNEMONIC, set, Decls.operand)))))>, - MakePat<!foreach(Decls.pattern, patterns[1], - !foreach(Decls.operand, Decls.pattern, - !subst(INTRINSIC, intr, - !subst(REGCLASS, VR128, - !subst(MNEMONIC, set, Decls.operand)))))>; + !subst(MNEMONIC, set, Decls.operand)))))>; multiclass arith<bits<8> opcode, string asmstr, string intr, list<list<dag>> patterns> { def PS : Base<opcode, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), @@ -108,13 +111,18 @@ multiclass arith<bits<8> opcode, string asmstr, string intr, list<list<dag>> pat def PD : Base<opcode, (outs VR128:$dst), (ins VR128:$src1, VR128:$src2), !strconcat(asmstr, "\t$dst, $src1, $src2"), !cast<Intrinsic>(!subst("SUFFIX", "_pd", intr)), patterns>; + + multidef <patterns, list<dag> pats, 1> : MakePat<pats, "_ps", intr>; + multidef <patterns, list<dag> pats, 1> : MakePat<pats, "_pd", intr>; } defm ADD : arith<0x58, "add", "int_x86_sse2_addSUFFIX", // rr Patterns [[(set REGCLASS:$dst, (INTRINSIC REGCLASS:$src1, REGCLASS:$src2))], [(set REGCLASS:$dst, (bitconvert (INTRINSIC REGCLASS:$src1, REGCLASS:$src2))), - (MNEMONIC REGCLASS:$dst, REGCLASS:$src)]]>; + (MNEMONIC REGCLASS:$dst, REGCLASS:$src)], + [(set REGCLASS:$dst, (add (INTRINSIC REGCLASS:$src1, REGCLASS:$src2))), + (MNEMONIC (add REGCLASS:$dst, REGCLASS:$src))]]>; // CHECK: [(set VR128:$dst, (int_x86_sse2_add_pd VR128:$src1, VR128:$src2))] // CHECK: [(set VR128:$dst, (int_x86_sse2_add_ps VR128:$src1, VR128:$src2))] |