From a263e839c76bcba24fb707ed338ed99cc35f5a15 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 3 Feb 2014 17:21:14 -0500 Subject: generalize hardcoded HEAPF32 load casts --- lib/Target/JSBackend/JSBackend.cpp | 4 ++-- 1 file 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);"; -- cgit v1.2.3-18-g5258