Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit d13b557

Browse files
committedOct 2, 2016
wasm-only 32-bit bitcasts
1 parent e800fd1 commit d13b557

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed
 

‎lib/Target/JSBackend/JSBackend.cpp

+12-4
Original file line numberDiff line numberDiff line change
@@ -2785,15 +2785,23 @@ void JSWriter::generateExpression(const User *I, raw_string_ostream& Code) {
27852785
Type *OutType = I->getType();
27862786
std::string V = getValueAsStr(I->getOperand(0));
27872787
if (InType->isIntegerTy() && OutType->isFloatingPointTy()) {
2788-
if (OnlyWebAssembly && InType->getIntegerBitWidth() == 64) {
2789-
Code << "i64_bc2d(" << V << ')';
2788+
if (OnlyWebAssembly) {
2789+
if (InType->getIntegerBitWidth() == 64) {
2790+
Code << "i64_bc2d(" << V << ')';
2791+
} else {
2792+
Code << "i32_bc2f(" << V << ')';
2793+
}
27902794
break;
27912795
}
27922796
assert(InType->getIntegerBitWidth() == 32);
27932797
Code << "(HEAP32[tempDoublePtr>>2]=" << V << "," << getCast("HEAPF32[tempDoublePtr>>2]", Type::getFloatTy(TheModule->getContext())) << ")";
27942798
} else if (OutType->isIntegerTy() && InType->isFloatingPointTy()) {
2795-
if (OnlyWebAssembly && OutType->getIntegerBitWidth() == 64) {
2796-
Code << "i64_bc2i(" << V << ')';
2799+
if (OnlyWebAssembly) {
2800+
if (OutType->getIntegerBitWidth() == 64) {
2801+
Code << "i64_bc2i(" << V << ')';
2802+
} else {
2803+
Code << "i32_bc2i(" << V << ')';
2804+
}
27972805
break;
27982806
}
27992807
assert(OutType->getIntegerBitWidth() == 32);

0 commit comments

Comments
 (0)