diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2013-06-13 15:45:24 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2013-06-13 15:45:24 +0000 |
commit | 19b30d56b224ab3507f7a93743eac2b01c5861dd (patch) | |
tree | fff432cf54d1b22a00e7b71b85c7fb5f8e80d114 | |
parent | 62d124a1fa8b212bae1d331f027c9eec06a45199 (diff) | |
download | llvm-19b30d56b224ab3507f7a93743eac2b01c5861dd.tar.gz llvm-19b30d56b224ab3507f7a93743eac2b01c5861dd.tar.bz2 llvm-19b30d56b224ab3507f7a93743eac2b01c5861dd.tar.xz |
X86: Make the cmov aliases work with intel syntax too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183907 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/X86/X86InstrInfo.td | 46 | ||||
-rw-r--r-- | test/MC/X86/intel-syntax.s | 29 |
2 files changed, 54 insertions, 21 deletions
diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td index 817bd6cc34..d67203e29c 100644 --- a/lib/Target/X86/X86InstrInfo.td +++ b/lib/Target/X86/X86InstrInfo.td @@ -1921,29 +1921,31 @@ def : MnemonicAlias<"fucomip", "fucompi", "att">; def : MnemonicAlias<"fwait", "wait", "att">; -class CondCodeAlias<string Prefix,string Suffix, string OldCond, string NewCond> +class CondCodeAlias<string Prefix,string Suffix, string OldCond, string NewCond, + string VariantName> : MnemonicAlias<!strconcat(Prefix, OldCond, Suffix), - !strconcat(Prefix, NewCond, Suffix)>; + !strconcat(Prefix, NewCond, Suffix), VariantName>; /// IntegerCondCodeMnemonicAlias - This multiclass defines a bunch of /// MnemonicAlias's that canonicalize the condition code in a mnemonic, for /// example "setz" -> "sete". -multiclass IntegerCondCodeMnemonicAlias<string Prefix, string Suffix> { - def C : CondCodeAlias<Prefix, Suffix, "c", "b">; // setc -> setb - def Z : CondCodeAlias<Prefix, Suffix, "z" , "e">; // setz -> sete - def NA : CondCodeAlias<Prefix, Suffix, "na", "be">; // setna -> setbe - def NB : CondCodeAlias<Prefix, Suffix, "nb", "ae">; // setnb -> setae - def NC : CondCodeAlias<Prefix, Suffix, "nc", "ae">; // setnc -> setae - def NG : CondCodeAlias<Prefix, Suffix, "ng", "le">; // setng -> setle - def NL : CondCodeAlias<Prefix, Suffix, "nl", "ge">; // setnl -> setge - def NZ : CondCodeAlias<Prefix, Suffix, "nz", "ne">; // setnz -> setne - def PE : CondCodeAlias<Prefix, Suffix, "pe", "p">; // setpe -> setp - def PO : CondCodeAlias<Prefix, Suffix, "po", "np">; // setpo -> setnp - - def NAE : CondCodeAlias<Prefix, Suffix, "nae", "b">; // setnae -> setb - def NBE : CondCodeAlias<Prefix, Suffix, "nbe", "a">; // setnbe -> seta - def NGE : CondCodeAlias<Prefix, Suffix, "nge", "l">; // setnge -> setl - def NLE : CondCodeAlias<Prefix, Suffix, "nle", "g">; // setnle -> setg +multiclass IntegerCondCodeMnemonicAlias<string Prefix, string Suffix, + string V = ""> { + def C : CondCodeAlias<Prefix, Suffix, "c", "b", V>; // setc -> setb + def Z : CondCodeAlias<Prefix, Suffix, "z" , "e", V>; // setz -> sete + def NA : CondCodeAlias<Prefix, Suffix, "na", "be", V>; // setna -> setbe + def NB : CondCodeAlias<Prefix, Suffix, "nb", "ae", V>; // setnb -> setae + def NC : CondCodeAlias<Prefix, Suffix, "nc", "ae", V>; // setnc -> setae + def NG : CondCodeAlias<Prefix, Suffix, "ng", "le", V>; // setng -> setle + def NL : CondCodeAlias<Prefix, Suffix, "nl", "ge", V>; // setnl -> setge + def NZ : CondCodeAlias<Prefix, Suffix, "nz", "ne", V>; // setnz -> setne + def PE : CondCodeAlias<Prefix, Suffix, "pe", "p", V>; // setpe -> setp + def PO : CondCodeAlias<Prefix, Suffix, "po", "np", V>; // setpo -> setnp + + def NAE : CondCodeAlias<Prefix, Suffix, "nae", "b", V>; // setnae -> setb + def NBE : CondCodeAlias<Prefix, Suffix, "nbe", "a", V>; // setnbe -> seta + def NGE : CondCodeAlias<Prefix, Suffix, "nge", "l", V>; // setnge -> setl + def NLE : CondCodeAlias<Prefix, Suffix, "nle", "g", V>; // setnle -> setg } // Aliases for set<CC> @@ -1951,9 +1953,11 @@ defm : IntegerCondCodeMnemonicAlias<"set", "">; // Aliases for j<CC> defm : IntegerCondCodeMnemonicAlias<"j", "">; // Aliases for cmov<CC>{w,l,q} -defm : IntegerCondCodeMnemonicAlias<"cmov", "w">; -defm : IntegerCondCodeMnemonicAlias<"cmov", "l">; -defm : IntegerCondCodeMnemonicAlias<"cmov", "q">; +defm : IntegerCondCodeMnemonicAlias<"cmov", "w", "att">; +defm : IntegerCondCodeMnemonicAlias<"cmov", "l", "att">; +defm : IntegerCondCodeMnemonicAlias<"cmov", "q", "att">; +// No size suffix for intel-style asm. +defm : IntegerCondCodeMnemonicAlias<"cmov", "", "intel">; //===----------------------------------------------------------------------===// diff --git a/test/MC/X86/intel-syntax.s b/test/MC/X86/intel-syntax.s index fa1ba5ba54..1a519aa186 100644 --- a/test/MC/X86/intel-syntax.s +++ b/test/MC/X86/intel-syntax.s @@ -325,3 +325,32 @@ _main: // CHECK: outb %al, $4 out 4, al ret + +// CHECK: cmovbl %ebx, %eax + cmovc eax, ebx +// CHECK: cmovel %ebx, %eax + cmovz eax, ebx +// CHECK: cmovbel %ebx, %eax + cmovna eax, ebx +// CHECK: cmovael %ebx, %eax + cmovnb eax, ebx +// CHECK: cmovael %ebx, %eax + cmovnc eax, ebx +// CHECK: cmovlel %ebx, %eax + cmovng eax, ebx +// CHECK: cmovgel %ebx, %eax + cmovnl eax, ebx +// CHECK: cmovnel %ebx, %eax + cmovnz eax, ebx +// CHECK: cmovpl %ebx, %eax + cmovpe eax, ebx +// CHECK: cmovnpl %ebx, %eax + cmovpo eax, ebx +// CHECK: cmovbl %ebx, %eax + cmovnae eax, ebx +// CHECK: cmoval %ebx, %eax + cmovnbe eax, ebx +// CHECK: cmovll %ebx, %eax + cmovnge eax, ebx +// CHECK: cmovgl %ebx, %eax + cmovnle eax, ebx |