aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-19 10:17:40 -0800
committerAlon Zakai <alonzakai@gmail.com>2014-02-19 10:17:40 -0800
commitd4d4469b33ba23ee8801e75429f1d5c2ffc3e39c (patch)
treeadb3cc7e2d644908d900f163c997dabfeb2c7746
parent67c5344e6e14ebb165fc668549da8d5e9fc80c76 (diff)
parentaa72e2349d22e3ef30eabfb8d3aac5a845f81977 (diff)
Merge pull request #15 from jechter/incoming
Fix atomic decrement (operand order of emitted code was flipped).
-rw-r--r--lib/Target/JSBackend/JSBackend.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp
index 7222c28992..1620d3e10e 100644
--- a/lib/Target/JSBackend/JSBackend.cpp
+++ b/lib/Target/JSBackend/JSBackend.cpp
@@ -1492,12 +1492,12 @@ void JSWriter::generateInstruction(const Instruction *I, raw_string_ostream& Cod
// Most bitcasts are no-ops for us. However, the exception is int to float and float to int
switch (rmwi->getOperation()) {
case AtomicRMWInst::Xchg: Code << getStore(I, P, I->getType(), VS, 0); break;
- case AtomicRMWInst::Add: Code << getStore(I, P, I->getType(), "((" + VS + '+' + iName + ")|0)", 0); break;
- case AtomicRMWInst::Sub: Code << getStore(I, P, I->getType(), "((" + VS + '-' + iName + ")|0)", 0); break;
- case AtomicRMWInst::And: Code << getStore(I, P, I->getType(), "(" + VS + '&' + iName + ")", 0); break;
- case AtomicRMWInst::Nand: Code << getStore(I, P, I->getType(), "(~(" + VS + '&' + iName + "))", 0); break;
- case AtomicRMWInst::Or: Code << getStore(I, P, I->getType(), "(" + VS + '|' + iName + ")", 0); break;
- case AtomicRMWInst::Xor: Code << getStore(I, P, I->getType(), "(" + VS + '^' + iName + ")", 0); break;
+ case AtomicRMWInst::Add: Code << getStore(I, P, I->getType(), "((" + iName + '+' + VS + ")|0)", 0); break;
+ case AtomicRMWInst::Sub: Code << getStore(I, P, I->getType(), "((" + iName + '-' + VS + ")|0)", 0); break;
+ case AtomicRMWInst::And: Code << getStore(I, P, I->getType(), "(" + iName + '&' + VS + ")", 0); break;
+ case AtomicRMWInst::Nand: Code << getStore(I, P, I->getType(), "(~(" + iName + '&' + VS + "))", 0); break;
+ case AtomicRMWInst::Or: Code << getStore(I, P, I->getType(), "(" + iName + '|' + VS + ")", 0); break;
+ case AtomicRMWInst::Xor: Code << getStore(I, P, I->getType(), "(" + iName + '^' + VS + ")", 0); break;
case AtomicRMWInst::Max:
case AtomicRMWInst::Min:
case AtomicRMWInst::UMax: