aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-12-22 19:37:09 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-12-22 19:37:09 -0800
commit6e9be94eee0bbd5b84048cf86d4b1565c4a79a4b (patch)
treeb2c13f0cf1513dd273e7d76abaab08cb257b3911
parentc55e755e27e7b288bba4873a1feb5b5923657a9e (diff)
use comma operator for float <-> int bitcasts, to ensure they are not treated as separate instructions by the js optimizer later
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp
index d97f034f4e..cd316762a4 100644
--- a/lib/Target/CppBackend/CPPBackend.cpp
+++ b/lib/Target/CppBackend/CPPBackend.cpp
@@ -1044,10 +1044,10 @@ std::string JSWriter::generateInstruction(const Instruction *I) {
std::string V = getValueAsStr(I->getOperand(0));
if (InType->isIntegerTy() && OutType->isFloatingPointTy()) {
assert(InType->getIntegerBitWidth() == 32);
- text = "HEAP32[tempDoublePtr>>2]=" + V + ";" + text + "+HEAPF32[tempDoublePtr>>2];";
+ text += "(HEAP32[tempDoublePtr>>2]=" + V + "," + "+HEAPF32[tempDoublePtr>>2]);";
} else if (OutType->isIntegerTy() && InType->isFloatingPointTy()) {
assert(OutType->getIntegerBitWidth() == 32);
- text = "HEAPF32[tempDoublePtr>>2]=" + V + ";" + text + "HEAP32[tempDoublePtr>>2]|0;";
+ text += "(HEAPF32[tempDoublePtr>>2]=" + V + "," + "HEAP32[tempDoublePtr>>2]|0);";
} else {
text += V + ";";
}