mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
Add tests for different AVX cmp opcodes, also teach the x86 asm parser to understand the vcmp instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106678 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
749bb7e2d9
commit
428256b818
@ -664,11 +664,13 @@ ParseInstruction(const StringRef &Name, SMLoc NameLoc,
|
||||
|
||||
// FIXME: Hack to recognize cmp<comparison code>{ss,sd,ps,pd}.
|
||||
const MCExpr *ExtraImmOp = 0;
|
||||
if (PatchedName.startswith("cmp") &&
|
||||
if ((PatchedName.startswith("cmp") || PatchedName.startswith("vcmp")) &&
|
||||
(PatchedName.endswith("ss") || PatchedName.endswith("sd") ||
|
||||
PatchedName.endswith("ps") || PatchedName.endswith("pd"))) {
|
||||
bool IsVCMP = PatchedName.startswith("vcmp");
|
||||
unsigned SSECCIdx = IsVCMP ? 4 : 3;
|
||||
unsigned SSEComparisonCode = StringSwitch<unsigned>(
|
||||
PatchedName.slice(3, PatchedName.size() - 2))
|
||||
PatchedName.slice(SSECCIdx, PatchedName.size() - 2))
|
||||
.Case("eq", 0)
|
||||
.Case("lt", 1)
|
||||
.Case("le", 2)
|
||||
@ -682,14 +684,14 @@ ParseInstruction(const StringRef &Name, SMLoc NameLoc,
|
||||
ExtraImmOp = MCConstantExpr::Create(SSEComparisonCode,
|
||||
getParser().getContext());
|
||||
if (PatchedName.endswith("ss")) {
|
||||
PatchedName = "cmpss";
|
||||
PatchedName = IsVCMP ? "vcmpss" : "cmpss";
|
||||
} else if (PatchedName.endswith("sd")) {
|
||||
PatchedName = "cmpsd";
|
||||
PatchedName = IsVCMP ? "vcmpsd" : "cmpsd";
|
||||
} else if (PatchedName.endswith("ps")) {
|
||||
PatchedName = "cmpps";
|
||||
PatchedName = IsVCMP ? "vcmpps" : "cmpps";
|
||||
} else {
|
||||
assert(PatchedName.endswith("pd") && "Unexpected mnemonic!");
|
||||
PatchedName = "cmppd";
|
||||
PatchedName = IsVCMP ? "vcmppd" : "cmppd";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10390,3 +10390,130 @@
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc6,0x5c,0xcb,0xfc,0x08]
|
||||
vshufpd $8, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $0, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0xd9,0x00]
|
||||
vcmpeqps %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $2, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0xd9,0x02]
|
||||
vcmpleps %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $1, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0xd9,0x01]
|
||||
vcmpltps %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $4, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0xd9,0x04]
|
||||
vcmpneqps %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $6, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0xd9,0x06]
|
||||
vcmpnleps %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $5, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0xd9,0x05]
|
||||
vcmpnltps %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $7, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0xd9,0x07]
|
||||
vcmpordps %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $3, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0xd9,0x03]
|
||||
vcmpunordps %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $0, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0x5c,0xcb,0xfc,0x00]
|
||||
vcmpeqps -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $2, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0x5c,0xcb,0xfc,0x02]
|
||||
vcmpleps -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $1, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0x5c,0xcb,0xfc,0x01]
|
||||
vcmpltps -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $4, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0x5c,0xcb,0xfc,0x04]
|
||||
vcmpneqps -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $6, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0x5c,0xcb,0xfc,0x06]
|
||||
vcmpnleps -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $5, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0x5c,0xcb,0xfc,0x05]
|
||||
vcmpnltps -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmpps $7, -4(%ebx,%ecx,8), %xmm6, %xmm2
|
||||
// CHECK: encoding: [0xc5,0xc8,0xc2,0x54,0xcb,0xfc,0x07]
|
||||
vcmpordps -4(%ebx,%ecx,8), %xmm6, %xmm2
|
||||
|
||||
// CHECK: vcmpps $3, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe8,0xc2,0x5c,0xcb,0xfc,0x03]
|
||||
vcmpunordps -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $0, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0xd9,0x00]
|
||||
vcmpeqpd %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $2, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0xd9,0x02]
|
||||
vcmplepd %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $1, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0xd9,0x01]
|
||||
vcmpltpd %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $4, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0xd9,0x04]
|
||||
vcmpneqpd %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $6, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0xd9,0x06]
|
||||
vcmpnlepd %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $5, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0xd9,0x05]
|
||||
vcmpnltpd %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $7, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0xd9,0x07]
|
||||
vcmpordpd %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $3, %xmm1, %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0xd9,0x03]
|
||||
vcmpunordpd %xmm1, %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $0, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0x5c,0xcb,0xfc,0x00]
|
||||
vcmpeqpd -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $2, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0x5c,0xcb,0xfc,0x02]
|
||||
vcmplepd -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $1, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0x5c,0xcb,0xfc,0x01]
|
||||
vcmpltpd -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $4, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0x5c,0xcb,0xfc,0x04]
|
||||
vcmpneqpd -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $6, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0x5c,0xcb,0xfc,0x06]
|
||||
vcmpnlepd -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $5, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0x5c,0xcb,0xfc,0x05]
|
||||
vcmpnltpd -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
||||
// CHECK: vcmppd $7, -4(%ebx,%ecx,8), %xmm6, %xmm2
|
||||
// CHECK: encoding: [0xc5,0xc9,0xc2,0x54,0xcb,0xfc,0x07]
|
||||
vcmpordpd -4(%ebx,%ecx,8), %xmm6, %xmm2
|
||||
|
||||
// CHECK: vcmppd $3, -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
// CHECK: encoding: [0xc5,0xe9,0xc2,0x5c,0xcb,0xfc,0x03]
|
||||
vcmpunordpd -4(%ebx,%ecx,8), %xmm2, %xmm3
|
||||
|
@ -454,3 +454,131 @@ pshufb CPI1_0(%rip), %xmm1
|
||||
// CHECK: encoding: [0xc5,0x19,0xc6,0x6c,0xcb,0xfc,0x08]
|
||||
vshufpd $8, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $0, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x18,0xc2,0xeb,0x00]
|
||||
vcmpeqps %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $2, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x18,0xc2,0xeb,0x02]
|
||||
vcmpleps %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $1, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x18,0xc2,0xeb,0x01]
|
||||
vcmpltps %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $4, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x18,0xc2,0xeb,0x04]
|
||||
vcmpneqps %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $6, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x18,0xc2,0xeb,0x06]
|
||||
vcmpnleps %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $5, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x18,0xc2,0xeb,0x05]
|
||||
vcmpnltps %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $7, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x18,0xc2,0xeb,0x07]
|
||||
vcmpordps %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $3, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x18,0xc2,0xeb,0x03]
|
||||
vcmpunordps %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $0, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x18,0xc2,0x6c,0xcb,0xfc,0x00]
|
||||
vcmpeqps -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $2, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x18,0xc2,0x6c,0xcb,0xfc,0x02]
|
||||
vcmpleps -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $1, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x18,0xc2,0x6c,0xcb,0xfc,0x01]
|
||||
vcmpltps -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $4, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x18,0xc2,0x6c,0xcb,0xfc,0x04]
|
||||
vcmpneqps -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $6, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x18,0xc2,0x6c,0xcb,0xfc,0x06]
|
||||
vcmpnleps -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $5, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x18,0xc2,0x6c,0xcb,0xfc,0x05]
|
||||
vcmpnltps -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmpps $7, -4(%rbx,%rcx,8), %xmm6, %xmm2
|
||||
// CHECK: encoding: [0xc5,0xc8,0xc2,0x54,0xcb,0xfc,0x07]
|
||||
vcmpordps -4(%rbx,%rcx,8), %xmm6, %xmm2
|
||||
|
||||
// CHECK: vcmpps $3, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x18,0xc2,0x6c,0xcb,0xfc,0x03]
|
||||
vcmpunordps -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $0, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x19,0xc2,0xeb,0x00]
|
||||
vcmpeqpd %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $2, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x19,0xc2,0xeb,0x02]
|
||||
vcmplepd %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $1, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x19,0xc2,0xeb,0x01]
|
||||
vcmpltpd %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $4, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x19,0xc2,0xeb,0x04]
|
||||
vcmpneqpd %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $6, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x19,0xc2,0xeb,0x06]
|
||||
vcmpnlepd %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $5, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x19,0xc2,0xeb,0x05]
|
||||
vcmpnltpd %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $7, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x19,0xc2,0xeb,0x07]
|
||||
vcmpordpd %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $3, %xmm11, %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc4,0x41,0x19,0xc2,0xeb,0x03]
|
||||
vcmpunordpd %xmm11, %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $0, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x19,0xc2,0x6c,0xcb,0xfc,0x00]
|
||||
vcmpeqpd -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $2, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x19,0xc2,0x6c,0xcb,0xfc,0x02]
|
||||
vcmplepd -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $1, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x19,0xc2,0x6c,0xcb,0xfc,0x01]
|
||||
vcmpltpd -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $4, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x19,0xc2,0x6c,0xcb,0xfc,0x04]
|
||||
vcmpneqpd -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $6, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x19,0xc2,0x6c,0xcb,0xfc,0x06]
|
||||
vcmpnlepd -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $5, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x19,0xc2,0x6c,0xcb,0xfc,0x05]
|
||||
vcmpnltpd -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
// CHECK: vcmppd $7, -4(%rbx,%rcx,8), %xmm6, %xmm2
|
||||
// CHECK: encoding: [0xc5,0xc9,0xc2,0x54,0xcb,0xfc,0x07]
|
||||
vcmpordpd -4(%rbx,%rcx,8), %xmm6, %xmm2
|
||||
|
||||
// CHECK: vcmppd $3, -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
// CHECK: encoding: [0xc5,0x19,0xc2,0x6c,0xcb,0xfc,0x03]
|
||||
vcmpunordpd -4(%rbx,%rcx,8), %xmm12, %xmm13
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user