Bug 1272640: Implement wasm opcodes trunc/nearestint; r=sunfish

MozReview-Commit-ID: 5g9KwkTM36k

--HG--
extra : rebase_source : 1bcf9863bb895fb7d7ddf44fb2704db58ed4df4b
This commit is contained in:
Benjamin Bouvier 2016-05-19 15:48:29 +02:00
Родитель 258bdc0148
Коммит 71c7696397
5 изменённых файлов: 27 добавлений и 16 удалений

Просмотреть файл

@ -289,21 +289,17 @@ DecodeExpr(FunctionDecoder& f)
case Expr::F32Ceil:
case Expr::F32Floor:
case Expr::F32Sqrt:
return f.iter().readUnary(ValType::F32, nullptr);
case Expr::F32Trunc:
return f.iter().notYetImplemented("trunc");
case Expr::F32Nearest:
return f.iter().notYetImplemented("nearest");
return f.iter().readUnary(ValType::F32, nullptr);
case Expr::F64Abs:
case Expr::F64Neg:
case Expr::F64Ceil:
case Expr::F64Floor:
case Expr::F64Sqrt:
return f.iter().readUnary(ValType::F64, nullptr);
case Expr::F64Trunc:
return f.iter().notYetImplemented("trunc");
case Expr::F64Nearest:
return f.iter().notYetImplemented("nearest");
return f.iter().readUnary(ValType::F64, nullptr);
case Expr::I32Add:
case Expr::I32Sub:
case Expr::I32Mul:

Просмотреть файл

@ -73,11 +73,15 @@ wasm::Classify(Expr expr)
case Expr::F32Neg:
case Expr::F32Ceil:
case Expr::F32Floor:
case Expr::F32Trunc:
case Expr::F32Nearest:
case Expr::F32Sqrt:
case Expr::F64Abs:
case Expr::F64Neg:
case Expr::F64Ceil:
case Expr::F64Floor:
case Expr::F64Trunc:
case Expr::F64Nearest:
case Expr::F64Sqrt:
case Expr::I32BitNot:
case Expr::I32Abs:
@ -459,10 +463,6 @@ wasm::Classify(Expr expr)
return ExprKind::SimdComparison;
case Expr::CurrentMemory:
case Expr::GrowMemory:
case Expr::F32Trunc:
case Expr::F32Nearest:
case Expr::F64Trunc:
case Expr::F64Nearest:
break;
}
MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("unimplemented opcode");

Просмотреть файл

@ -3015,6 +3015,10 @@ EmitExpr(FunctionCompiler& f)
return EmitUnaryMathBuiltinCall(f, exprOffset, SymbolicAddress::CeilF, ValType::F32);
case Expr::F32Floor:
return EmitUnaryMathBuiltinCall(f, exprOffset, SymbolicAddress::FloorF, ValType::F32);
case Expr::F32Trunc:
return EmitUnaryMathBuiltinCall(f, exprOffset, SymbolicAddress::TruncF, ValType::F32);
case Expr::F32Nearest:
return EmitUnaryMathBuiltinCall(f, exprOffset, SymbolicAddress::NearbyIntF, ValType::F32);
case Expr::F32DemoteF64:
return EmitConversion<MToFloat32>(f, ValType::F64, ValType::F32);
case Expr::F32ConvertSI32:
@ -3066,8 +3070,11 @@ EmitExpr(FunctionCompiler& f)
case Expr::F64Ceil:
return EmitUnaryMathBuiltinCall(f, exprOffset, SymbolicAddress::CeilD, ValType::F64);
case Expr::F64Floor:
return EmitUnaryMathBuiltinCall(f, exprOffset, SymbolicAddress::FloorD,
ValType::F64);
return EmitUnaryMathBuiltinCall(f, exprOffset, SymbolicAddress::FloorD, ValType::F64);
case Expr::F64Trunc:
return EmitUnaryMathBuiltinCall(f, exprOffset, SymbolicAddress::TruncD, ValType::F64);
case Expr::F64Nearest:
return EmitUnaryMathBuiltinCall(f, exprOffset, SymbolicAddress::NearbyIntD, ValType::F64);
case Expr::F64Sin:
return EmitUnaryMathBuiltinCall(f, exprOffset, SymbolicAddress::SinD, ValType::F64);
case Expr::F64Cos:
@ -3327,11 +3334,7 @@ EmitExpr(FunctionCompiler& f)
// Future opcodes
case Expr::F32CopySign:
case Expr::F32Trunc:
case Expr::F32Nearest:
case Expr::F64CopySign:
case Expr::F64Nearest:
case Expr::F64Trunc:
case Expr::I64Load8S:
case Expr::I64Load16S:
case Expr::I64Load32S:

Просмотреть файл

@ -305,6 +305,14 @@ wasm::AddressOf(SymbolicAddress imm, ExclusiveContext* cx)
return FuncCast<double (double)>(fdlibm::floor, Args_Double_Double);
case SymbolicAddress::FloorF:
return FuncCast<float (float)>(fdlibm::floorf, Args_Float32_Float32);
case SymbolicAddress::TruncD:
return FuncCast<double (double)>(fdlibm::trunc, Args_Double_Double);
case SymbolicAddress::TruncF:
return FuncCast<float (float)>(fdlibm::truncf, Args_Float32_Float32);
case SymbolicAddress::NearbyIntD:
return FuncCast<double (double)>(nearbyint, Args_Double_Double);
case SymbolicAddress::NearbyIntF:
return FuncCast<float (float)>(nearbyintf, Args_Float32_Float32);
case SymbolicAddress::ExpD:
return FuncCast<double (double)>(fdlibm::exp, Args_Double_Double);
case SymbolicAddress::LogD:

Просмотреть файл

@ -672,6 +672,10 @@ enum class SymbolicAddress
CeilF,
FloorD,
FloorF,
TruncD,
TruncF,
NearbyIntD,
NearbyIntF,
ExpD,
LogD,
PowD,