diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-12-22 19:37:09 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-12-22 19:37:09 -0800 |
commit | 6e9be94eee0bbd5b84048cf86d4b1565c4a79a4b (patch) | |
tree | b2c13f0cf1513dd273e7d76abaab08cb257b3911 | |
parent | c55e755e27e7b288bba4873a1feb5b5923657a9e (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.cpp | 4 |
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 + ";"; } |