Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryowl <scott.waye@hubse.com>2018-05-17 23:45:36 +0300
committerMorgan Brown <morganbr@users.noreply.github.com>2018-05-17 23:45:36 +0300
commit09437ab725ee383805bfee2c600379c8436f26fb (patch)
tree22ab4854c6ba64d22d57f001ea98cb6aa2f8682c /src/ILCompiler.WebAssembly
parent94f3464f940816d0d20993720ebcb82d2a73bd7c (diff)
Double/Float casting and comparisons, push floats as 64bit to stack (#5813)
Fix double cast push floats and doubles to stack as double add some more tests around float/double comparisons
Diffstat (limited to 'src/ILCompiler.WebAssembly')
-rw-r--r--src/ILCompiler.WebAssembly/src/CodeGen/EvaluationStack.cs2
-rw-r--r--src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs13
2 files changed, 6 insertions, 9 deletions
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/EvaluationStack.cs b/src/ILCompiler.WebAssembly/src/CodeGen/EvaluationStack.cs
index df5ce4bea..44b947ccd 100644
--- a/src/ILCompiler.WebAssembly/src/CodeGen/EvaluationStack.cs
+++ b/src/ILCompiler.WebAssembly/src/CodeGen/EvaluationStack.cs
@@ -199,7 +199,7 @@ namespace Internal.IL
else if (kind == StackValueKind.Int64)
return ValueAsInt64(builder, signExtend);
else if (kind == StackValueKind.Float)
- return ValueAsType(LLVM.FloatType(), builder);
+ return ValueAsType(LLVM.DoubleType(), builder);
else if (kind == StackValueKind.NativeInt || kind == StackValueKind.ByRef || kind == StackValueKind.ObjRef)
return ValueAsInt32(builder, false);
else
diff --git a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
index c512583b1..2aeccaff3 100644
--- a/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
+++ b/src/ILCompiler.WebAssembly/src/CodeGen/ILToWebAssemblyImporter.cs
@@ -563,7 +563,7 @@ namespace Internal.IL
if (sourceType.Pointer == valueType.Pointer)
return source;
- LLVMTypeKind toStoreKind = LLVM.GetTypeKind(LLVM.TypeOf(source));
+ LLVMTypeKind toStoreKind = LLVM.GetTypeKind(sourceType);
LLVMTypeKind valueTypeKind = LLVM.GetTypeKind(valueType);
LLVMValueRef typedToStore = source;
@@ -613,19 +613,16 @@ namespace Internal.IL
Debug.Assert(toStoreKind != LLVMTypeKind.LLVMPointerTypeKind && valueTypeKind != LLVMTypeKind.LLVMPointerTypeKind);
typedToStore = LLVM.BuildIntCast(builder, source, valueType, "CastInt" + (name ?? ""));
}
- else if (toStoreKind != LLVMTypeKind.LLVMFloatTypeKind && valueTypeKind == LLVMTypeKind.LLVMFloatTypeKind)
+ else if (toStoreKind == LLVMTypeKind.LLVMIntegerTypeKind && (valueTypeKind == LLVMTypeKind.LLVMDoubleTypeKind || valueTypeKind == LLVMTypeKind.LLVMFloatTypeKind))
{
- typedToStore = LLVM.BuildFPCast(builder, source, valueType, "CastFloat" + (name ?? ""));
+ //TODO: keep track of the TypeDesc so we can call BuildUIToFP when the integer is unsigned
+ typedToStore = LLVM.BuildSIToFP(builder, source, valueType, "CastSIToFloat" + (name ?? ""));
}
else if ((toStoreKind == LLVMTypeKind.LLVMDoubleTypeKind || toStoreKind == LLVMTypeKind.LLVMFloatTypeKind) &&
valueTypeKind == LLVMTypeKind.LLVMIntegerTypeKind)
{
//TODO: keep track of the TypeDesc so we can call BuildFPToUI when the integer is unsigned
- typedToStore = LLVM.BuildFPToSI(builder, source, valueType, "CastFloat" + (name ?? ""));
- }
- else if (toStoreKind == LLVMTypeKind.LLVMIntegerTypeKind && valueTypeKind == LLVMTypeKind.LLVMDoubleTypeKind)
- {
- throw new NotImplementedException();
+ typedToStore = LLVM.BuildFPToSI(builder, source, valueType, "CastFloatSI" + (name ?? ""));
}
return typedToStore;