summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2010-12-30 22:10:49 +0000
committerNick Lewycky <nicholas@mxc.ca>2010-12-30 22:10:49 +0000
commitc00210cef28b48b17408eb79e94691779da9d474 (patch)
tree77d1977f63a5ea76ea6ceab7f6a078e47ec21e4e
parentd34f19f7bacd9476c0fc55f95f7baf1011a69191 (diff)
downloadllvm-c00210cef28b48b17408eb79e94691779da9d474.tar.gz
llvm-c00210cef28b48b17408eb79e94691779da9d474.tar.bz2
llvm-c00210cef28b48b17408eb79e94691779da9d474.tar.xz
Add another non-commutable instruction that gas accepts commuted forms for.
Fixes PR8861. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122641 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86InstrInfo.td7
-rw-r--r--test/MC/X86/x86-64.s4
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/Target/X86/X86InstrInfo.td b/lib/Target/X86/X86InstrInfo.td
index 761e9ccb6c..f9c0a7bbfb 100644
--- a/lib/Target/X86/X86InstrInfo.td
+++ b/lib/Target/X86/X86InstrInfo.td
@@ -1465,14 +1465,15 @@ defm : FpUnaryAlias<"fucompi", UCOM_FIPr>;
// Handle "f{mulp,addp} st(0), $op" the same as "f{mulp,addp} $op", since they
-// commute. We also allow fdivrp/fsubrp even though they don't commute, solely
-// because gas supports it.
+// commute. We also allow fdiv[r]p/fsubrp even though they don't commute,
+// solely because gas supports it.
def : InstAlias<"faddp %st(0), $op", (ADD_FPrST0 RST:$op)>;
def : InstAlias<"fmulp %st(0), $op", (MUL_FPrST0 RST:$op)>;
def : InstAlias<"fsubrp %st(0), $op", (SUB_FPrST0 RST:$op)>;
+def : InstAlias<"fdivp %st(0), $op", (DIVR_FPrST0 RST:$op)>;
def : InstAlias<"fdivrp %st(0), $op", (DIV_FPrST0 RST:$op)>;
-// We accepts "fnstsw %eax" even though it only writes %ax.
+// We accept "fnstsw %eax" even though it only writes %ax.
def : InstAlias<"fnstsw %eax", (FNSTSW8r)>;
def : InstAlias<"fnstsw %al" , (FNSTSW8r)>;
def : InstAlias<"fnstsw" , (FNSTSW8r)>;
diff --git a/test/MC/X86/x86-64.s b/test/MC/X86/x86-64.s
index 5375919d55..2eb2aded6a 100644
--- a/test/MC/X86/x86-64.s
+++ b/test/MC/X86/x86-64.s
@@ -504,6 +504,10 @@ fdivrp %st(1), %st(0) // CHECK: encoding: [0xde,0xf9]
fsubrp %ST(0), %ST(1) // CHECK: encoding: [0xde,0xe9]
fsubrp %ST(1), %ST(0) // CHECK: encoding: [0xde,0xe9]
+// also PR8861
+fdivp %st(0), %st(1) // CHECK: encoding: [0xde,0xf1]
+fdivp %st(1), %st(0) // CHECK: encoding: [0xde,0xf1]
+
movl foo(%rip), %eax
// CHECK: movl foo(%rip), %eax