summaryrefslogtreecommitdiffstats
path: root/llvm/utils
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2017-05-29 16:25:20 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2017-05-29 16:25:20 +0000
commitfd1952761ed3691ef118f6ef4c6cc51b4d37de75 (patch)
treee01c8b0290fce6d9c06d0cbe3d027c09d92fc51d /llvm/utils
parenteed7a3102c51d863ff9035d31a33313e77364692 (diff)
downloadbcm5719-llvm-fd1952761ed3691ef118f6ef4c6cc51b4d37de75.tar.gz
bcm5719-llvm-fd1952761ed3691ef118f6ef4c6cc51b4d37de75.zip
[X86] Don't fold away the memory operand of an xchg.
xchg with a mem operand has different locking semantics. If we unfold it into a xchg r,r we will loose the implicit lock. Likewise we never want to fold a register xchg into a memory one as it would be a lot slower. This triggers during LLVM selfhost. llvm-svn: 304163
Diffstat (limited to 'llvm/utils')
-rw-r--r--llvm/utils/TableGen/X86FoldTablesEmitter.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/utils/TableGen/X86FoldTablesEmitter.cpp b/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
index f211a8fab97..99429c5f96a 100644
--- a/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
+++ b/llvm/utils/TableGen/X86FoldTablesEmitter.cpp
@@ -77,7 +77,14 @@ const char *const NoFoldSet[] = {
"TCRETURNri64",
"TCRETURNmi64", // Special dealing (in X86InstrCompiler.td under
"TCRETURNri", // "tailcall stuff" section).
- "TCRETURNmi"
+ "TCRETURNmi",
+
+ // Never fold XCHG, the register and memory forms have different locking
+ // semantics.
+ "XCHG8rr", "XCHG8rm",
+ "XCHG16rr", "XCHG16rm",
+ "XCHG32rr", "XCHG32rm",
+ "XCHG64rr", "XCHG64rm",
// Different calculations of the folded operand between
// memory and register forms (folding is illegal).
OpenPOWER on IntegriCloud