aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-02-03 17:21:14 -0500
committerAlon Zakai <alonzakai@gmail.com>2014-02-03 17:21:14 -0500
commita263e839c76bcba24fb707ed338ed99cc35f5a15 (patch)
tree4b693fc81a789ac10933777150715895d65dc330
parent651d2cbf3258cd4b38b42cfe9e282a8b67073bfb (diff)
generalize hardcoded HEAPF32 load casts
-rw-r--r--lib/Target/JSBackend/JSBackend.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Target/JSBackend/JSBackend.cpp b/lib/Target/JSBackend/JSBackend.cpp
index 8dcd77a666..2a622c81f3 100644
--- a/lib/Target/JSBackend/JSBackend.cpp
+++ b/lib/Target/JSBackend/JSBackend.cpp
@@ -608,7 +608,7 @@ std::string JSWriter::getLoad(const std::string& Assign, const Value *P, const T
}
default: assert(0 && "bad 4f store");
}
- text += sep + Assign + "+HEAPF32[tempDoublePtr>>2]";
+ text += sep + Assign + getCast("HEAPF32[tempDoublePtr>>2]", Type::getFloatTy(TheModule->getContext()));
}
break;
}
@@ -1323,7 +1323,7 @@ void JSWriter::generateInstruction(const Instruction *I, raw_string_ostream& Cod
std::string V = getValueAsStr(I->getOperand(0));
if (InType->isIntegerTy() && OutType->isFloatingPointTy()) {
assert(InType->getIntegerBitWidth() == 32);
- Code << "(HEAP32[tempDoublePtr>>2]=" << V << "," << "+HEAPF32[tempDoublePtr>>2]);";
+ Code << "(HEAP32[tempDoublePtr>>2]=" << V << "," << getCast("HEAPF32[tempDoublePtr>>2]", Type::getFloatTy(TheModule->getContext())) + ");";
} else if (OutType->isIntegerTy() && InType->isFloatingPointTy()) {
assert(OutType->getIntegerBitWidth() == 32);
Code << "(HEAPF32[tempDoublePtr>>2]=" << V << "," << "HEAP32[tempDoublePtr>>2]|0);";