1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Fix rdar://8468087 - llvm-mc commutes fmul (and friend) operands.

My previous fix for rdar://8456371 should only apply to fmulp/faddp,
not to fmul/fadd.  Instruction set orthogonality is overrated or 
something.

llvm-svn: 114818
This commit is contained in:
Chris Lattner 2010-09-27 07:08:21 +00:00
parent 0ebcc18dec
commit 5cadf79b60
2 changed files with 20 additions and 5 deletions

View File

@ -911,10 +911,9 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
Operands.erase(Operands.begin() + 2);
}
// FIXME: Hack to handle "f{mul*,add*} st(0), $op" the same as
// "f{mul*,add*} $op", since they commute.
if ((Name.startswith("fmul") || Name.startswith("fadd")) &&
Operands.size() == 3 &&
// FIXME: Hack to handle "f{mulp,addp} st(0), $op" the same as
// "f{mulp,addp} $op", since they commute.
if ((Name == "fmulp" || Name == "faddp") && Operands.size() == 3 &&
static_cast<X86Operand*>(Operands[1])->isReg() &&
static_cast<X86Operand*>(Operands[1])->getReg() == X86::ST0) {
delete Operands[1];

View File

@ -360,6 +360,22 @@ mov %rdx, %cr15
faddp %st, %st(1)
fmulp %st, %st(2)
// rdar://8468087 - Encode these accurately, they are not synonyms.
// CHECK: fmul %st(0), %st(1)
// CHECK: encoding: [0xdc,0xc9]
// CHECK: fmul %st(1)
// CHECK: encoding: [0xd8,0xc9]
fmul %st, %st(1)
fmul %st(1), %st
// CHECK: fadd %st(0), %st(1)
// CHECK: encoding: [0xdc,0xc1]
// CHECK: fadd %st(1)
// CHECK: encoding: [0xd8,0xc1]
fadd %st, %st(1)
fadd %st(1), %st
// rdar://8416805
// CHECK: xorb %al, %al
// CHECK: encoding: [0x30,0xc0]