mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-21 18:29:46 +00:00
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
This commit is contained in:
parent
62d124a1fa
commit
19b30d56b2
@ -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
|
||||
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">; // 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
|
||||
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">;
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user