Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tizen ARMEL build fail by #55558 #55794

Closed
clamp03 opened this issue Jul 16, 2021 · 6 comments · Fixed by #55987
Closed

Tizen ARMEL build fail by #55558 #55794

clamp03 opened this issue Jul 16, 2021 · 6 comments · Fixed by #55987
Assignees
Labels
arch-arm32 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI bug
Milestone

Comments

@clamp03
Copy link
Member

clamp03 commented Jul 16, 2021

ARMEL build fails when crossgen2 compiles System.Private.CoreLib.

I found the cause of buid erorr is #55558
In void CodeGen::genCodeForBitCast(GenTreeOp* treeNode), it doesn't handle special case of ARMEL (Converting between long and double)
@sandreenko Could you please fix it?

Some details
If I update the function like below, it works well.

diff --git a/src/coreclr/jit/codegencommon.cpp b/src/coreclr/jit/codegencommon.cpp
index 73e6f196cae..f1b8fc0acb0 100644
--- a/src/coreclr/jit/codegencommon.cpp
+++ b/src/coreclr/jit/codegencommon.cpp
@@ -12639,6 +12640,31 @@ void CodeGen::genCodeForBitCast(GenTreeOp* treeNode)
             genCodeForTreeNode(op1);
         }
     }
+#ifdef TARGET_ARM
+    else if (compiler->opts.compUseSoftFP && varTypeUsesFloatReg(treeNode) != varTypeUsesFloatReg(op1))
+    {
+        regNumber srcReg = op1->GetRegNum();
+        assert(genTypeSize(op1->TypeGet()) == genTypeSize(targetType));
+        if (genTypeSize(targetType) == 8)
+        {
+            // Converting between long and double on ARM is a special case.
+            if (targetType == TYP_LONG)
+            {
+                regNumber otherReg = treeNode->AsMultiRegOp()->gtOtherReg;
+                assert(otherReg != REG_NA);
+                inst_RV_RV_RV(INS_vmov_d2i, targetReg, otherReg, srcReg, EA_8BYTE);
+            }
+            else
+            {
+                NYI_ARM("Converting from long to double");
+            }
+        }
+        else
+        {
+            genBitCast(targetType, targetReg, op1->TypeGet(), op1->GetRegNum());
+        }
+    }
+#endif // TARGET_ARM
     else
     {
         genBitCast(targetType, targetReg, op1->TypeGet(), op1->GetRegNum());

Build Error Message (Release Build)

  Generated /home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/StandardOptimizationData.mibc                                                                                                                                          [48/96630]
  Generating native image of System.Private.CoreLib for Linux.armel.Release. Logging to /home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/log/CrossgenCoreLib_Linux__armel__Release.log                                                                                        
  /home/dheon/work/dotnet/jobs/fnv/runtime/dotnet.sh /home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/x64/crossgen2/crossgen2.dll -o:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/System.Private.CoreLib
.dll -r:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/IL/*.dll --targetarch:armel -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/StandardOptimizationData.mibc -m:/home/dheon/work/dotnet/jobs/fnv/r
untime/artifacts/bin/coreclr/Linux.armel.Release/StandardOptimizationData.mibc -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/StandardOptimizationData.mibc -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel
.Release/StandardOptimizationData.mibc --embed-pgo-data -O /home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/IL/System.Private.CoreLib.dll --perfmap --perfmap-path:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.
Release/                                                
EXEC : error : One or more errors occurred. (Code generation failed for method '[S.P.CoreLib]System.TimeSpan.FromSeconds(float64)') (Code generation failed for method '[S.P.CoreLib]System.IO.TextWriter.WriteLine(float64)') [/home/dheon/work/dotnet/jobs/fnv/runtime/src/cor
eclr/crossgen-corelib.proj]                             
  System.AggregateException: One or more errors occurred. (Code generation failed for method '[S.P.CoreLib]System.TimeSpan.FromSeconds(float64)') (Code generation failed for method '[S.P.CoreLib]System.IO.TextWriter.WriteLine(float64)')
   ---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[S.P.CoreLib]System.TimeSpan.FromSeconds(float64)'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL) in ILCompiler.ReadyToRun.dll:token 0x6000812+0x125
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodWithGCInfo methodCodeNodeNeedingCode, Logger logger) in ILCompiler.ReadyToRun.dll:token 0x600071c+0x48                                    
     at ILCompiler.ReadyToRunCodegenCompilation.<ComputeDependencyNodeDependencies>b__36_0(DependencyNodeCore`1 dependency) in ILCompiler.ReadyToRun.dll:token 0x600013b+0xe7                     
     at System.Threading.Tasks.Parallel.<>c__DisplayClass33_0`2.<ForEachWorker>b__0(Int32 i) in System.Threading.Tasks.Parallel.dll:token 0x6000072+0x0
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) in System.Threading.Tasks.Parallel.dll:token 0x6000067+0xcf
  --- End of stack trace from previous location ---         
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) in System.Threading.Tasks.Parallel.dll:token 0x6000067+0x1e7
     at System.Threading.Tasks.TaskReplicator.Replica.Execute() in System.Threading.Tasks.Parallel.dll:token 0x60000c5+0x0
     --- End of inner exception stack trace ---
     at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure) in System.Threading.Tasks.Parallel.dll:token 0x60000be+0x5b
     at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) in System.Threading.Tasks.Parallel.dll:
token 0x600002a+0x144                                                                                                                                                                                                                                                           
  --- End of stack trace from previous location ---                                                                                                                                                                                                                             
     at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException) in System.Threading.Tasks.Parallel.dll:token 0x6000045+0xd
     at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) in System.Threading.Tasks.Parallel.dll:
token 0x600002a+0x186                                                                                                                                                                                                                                                           
     at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IList`1 list, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 
localFinally) in System.Threading.Tasks.Parallel.dll:token 0x6000038+0x54              
     at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, A
ction`1 localFinally) in System.Threading.Tasks.Parallel.dll:token 0x6000036+0x36                 
     at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body) in System.Threading.Tasks.Parallel.dll:token 0x600002d+0x1c
     at ILCompiler.ReadyToRunCodegenCompilation.ComputeDependencyNodeDependencies(List`1 obj) in ILCompiler.ReadyToRun.dll:token 0x6000136+0x84                              
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() in ILCompiler.DependencyAnalysisFramework.dll:token 0x600003b+0x46
     at ILCompiler.ReadyToRunCodegenCompilation.Compile(String outputFile) in ILCompiler.ReadyToRun.dll:token 0x600012f+0x0                                                                                                                                                     
     at ILCompiler.Program.RunSingleCompilation(Dictionary`2 inFilePaths, InstructionSetSupport instructionSetSupport, String compositeRootPath, Dictionary`2 unrootedInputFilePaths, HashSet`1 versionBubbleModulesHash, CompilerTypeSystemContext typeSystemContext) in crossg
en2.dll:token 0x600015b+0x5a4                                                                                                                                                                                                                                                   
     at ILCompiler.Program.Run(String[] args) in crossgen2.dll:token 0x600015a+0x52e   
     at ILCompiler.Program.Main(String[] args) in crossgen2.dll:token 0x6000162+0x5                                                                                                                                                                                             
   ---> (Inner Exception #1) ILCompiler.CodeGenerationFailedException: Code generation failed for method '[S.P.CoreLib]System.IO.TextWriter.WriteLine(float64)'
     at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode methodCodeNodeNeedingCode, MethodIL methodIL) in ILCompiler.ReadyToRun.dll:token 0x6000812+0x125
     at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodWithGCInfo methodCodeNodeNeedingCode, Logger logger) in ILCompiler.ReadyToRun.dll:token 0x600071c+0x48
     at ILCompiler.ReadyToRunCodegenCompilation.<ComputeDependencyNodeDependencies>b__36_0(DependencyNodeCore`1 dependency) in ILCompiler.ReadyToRun.dll:token 0x600013b+0xe7
     at System.Threading.Tasks.Parallel.<>c__DisplayClass33_0`2.<ForEachWorker>b__0(Int32 i) in System.Threading.Tasks.Parallel.dll:token 0x6000072+0x0
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) in System.Threading.Tasks.Parallel.dll:token 0x6000067+0xcf
  --- End of stack trace from previous location ---
     at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) in System.Threading.Tasks.Parallel.dll:token 0x6000067+0x1e7
     at System.Threading.Tasks.TaskReplicator.Replica.Execute() in System.Threading.Tasks.Parallel.dll:token 0x60000c5+0x0<---
                                  
/home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/crossgen-corelib.proj(131,5): error MSB3073: "/home/dheon/work/dotnet/jobs/fnv/runtime/dotnet.sh /home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/x64/crossgen2/crossgen2.dll -o:/home/dh
eon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/System.Private.CoreLib.dll -r:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/IL/*.dll --targetarch:armel -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bi
n/coreclr/Linux.armel.Release/StandardOptimizationData.mibc -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/StandardOptimizationData.mibc -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/StandardOp
timizationData.mibc -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/StandardOptimizationData.mibc --embed-pgo-data -O /home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/IL/System.Private.CoreLib.dll --p
erfmap --perfmap-path:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/" 명령이 종료되었습니다(코드: 1).

빌드하지 못했습니다.

EXEC : error : One or more errors occurred. (Code generation failed for method '[S.P.CoreLib]System.TimeSpan.FromSeconds(float64)') (Code generation failed for method '[S.P.CoreLib]System.IO.TextWriter.WriteLine(float64)') [/home/dheon/work/dotnet/jobs/fnv/runtime/src/cor
eclr/crossgen-corelib.proj]
/home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/crossgen-corelib.proj(131,5): error MSB3073: "/home/dheon/work/dotnet/jobs/fnv/runtime/dotnet.sh /home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/x64/crossgen2/crossgen2.dll -o:/home/dh
eon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/System.Private.CoreLib.dll -r:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/IL/*.dll --targetarch:armel -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bi
n/coreclr/Linux.armel.Release/StandardOptimizationData.mibc -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/StandardOptimizationData.mibc -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/StandardOp
timizationData.mibc -m:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/StandardOptimizationData.mibc --embed-pgo-data -O /home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/IL/System.Private.CoreLib.dll --p
erfmap --perfmap-path:/home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Release/" 명령이 종료되었습니다(코드: 1).
    경고 0개
    오류 2개

Back trace when crossge2 crashes. (Debug Build)

#0  DBG_DebugBreak () at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/pal/src/arch/amd64/debugbreak.S:9
#1  0x00007ffa3d53b02b in DebugBreak () at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/pal/src/debug/debug.cpp:406
#2  0x00007ffa3d2a2ea9 in assertAbort (why=0x7ffa3d674883 "IsMovInstruction(ins)", file=0x7ffa3d673d3a "/home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/emitarm.cpp", line=2053) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/error.cpp:303
#3  0x00007ffa3d4d92e9 in emitter::emitIns_Mov (this=0x7ff9ec007fd8, ins=INS_vmov_d2i, attr=EA_4BYTE, dstReg=REG_R2, srcReg=REG_F8, canSkip=true, flags=INS_FLAGS_DONT_CARE) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/emitarm.cpp:2053
#4  0x00007ffa3d38db1a in CodeGen::inst_Mov (this=0x7ff9ec007c40, dstType=TYP_LONG, dstReg=REG_R2, srcReg=REG_F8, canSkip=true, size=EA_4BYTE, flags=INS_FLAGS_DONT_CARE) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/instr.cpp:417
#5  0x00007ffa3d25d533 in CodeGen::genBitCast (this=0x7ff9ec007c40, targetType=TYP_LONG, targetReg=REG_R2, srcType=TYP_DOUBLE, srcReg=REG_F8) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/codegencommon.cpp:12608
#6  0x00007ffa3d25d73d in CodeGen::genCodeForBitCast (this=0x7ff9ec007c40, treeNode=0x7ff9ec069208) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/codegencommon.cpp:12644
#7  0x00007ffa3d4c04ac in CodeGen::genCodeForTreeNode (this=0x7ff9ec007c40, treeNode=0x7ff9ec069208) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/codegenarmarch.cpp:256
#8  0x00007ffa3d2670b0 in CodeGen::genCodeForBBlist (this=0x7ff9ec007c40) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/codegenlinear.cpp:457
#9  0x00007ffa3d24ce28 in CodeGen::genGenerateMachineCode (this=0x7ff9ec007c40) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/codegencommon.cpp:2295
#10 0x00007ffa3d2638ab in CodeGenPhase::DoPhase (this=0x7ffa0d7f7e00) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/codegen.h:1606
#11 0x00007ffa3d469c75 in Phase::Run (this=0x7ffa0d7f7e00) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/phase.cpp:61
#12 0x00007ffa3d25fd25 in DoPhase (_codeGen=0x7ff9ec007c40, _phase=PHASE_GENERATE_CODE, _action=(void (CodeGen::*)(CodeGen * const)) 0x7ffa3d24c6a0 <CodeGen::genGenerateMachineCode()>) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/codegen.h:1620
#13 0x00007ffa3d24c640 in CodeGen::genGenerateCode (this=0x7ff9ec007c40, codePtr=0x7ffa0d7f9070, nativeSizeOfCode=0x7ffa0d7f9358) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/codegencommon.cpp:2098
#14 0x00007ffa3d27648b in Compiler::compCompile (this=0x7ff9ec0071b8, methodCodePtr=0x7ffa0d7f9070, methodCodeSize=0x7ffa0d7f9358, compileFlags=0x7ffa0d7f9098) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/compiler.cpp:5204
#15 0x00007ffa3d279b88 in Compiler::compCompileHelper (this=0x7ff9ec0071b8, classPtr=0x4000000000420040, compHnd=0x7ffa0d7f9140, methodInfo=0x7ffa0d7f9378, methodCodePtr=0x7ffa0d7f9070, methodCodeSize=0x7ffa0d7f9358, compileFlags=0x7ffa0d7f9098)
    at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/compiler.cpp:6407
#16 0x00007ffa3d2784cc in Compiler::compCompile(CORINFO_MODULE_STRUCT_*, void**, unsigned int*, JitFlags*)::$_11::operator()(Compiler::compCompile(CORINFO_MODULE_STRUCT_*, void**, unsigned int*, JitFlags*)::__JITParam*) const (this=0x7ffa0d7f8790, 
    __JITpParam=0x7ffa0d7f8798) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/compiler.cpp:5684
#17 0x00007ffa3d27802b in Compiler::compCompile (this=0x7ff9ec0071b8, classPtr=0x4000000000420040, methodCodePtr=0x7ffa0d7f9070, methodCodeSize=0x7ffa0d7f9358, compileFlags=0x7ffa0d7f9098) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/compiler.cpp:5703
#18 0x00007ffa3d27f5fe in jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::$_14::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::__JITParam*) const::{lambda(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::$_14::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::__JITParam*) const::__JITParam*)#1}::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::$_14::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::__JITParam*) const::__JITParam*) const (this=0x7ffa0d7f8920, 
    __JITpParam=0x7ffa0d7f8928) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/compiler.cpp:7053
#19 0x00007ffa3d27afa4 in jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::$_14::operator()(jitNativeCode(CORINFO_METHOD_STRUCT_*, CORINFO_MODULE_STRUCT_*, ICorJitInfo*, CORINFO_METHOD_INFO*, void**, unsigned int*, JitFlags*, void*)::__JITParam*) const (this=0x7ffa0d7f8a38, __JITpParam=0x7ffa0d7f8a48) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/compiler.cpp:7078
#20 0x00007ffa3d27ace3 in jitNativeCode (methodHnd=0x4000000000420038, classPtr=0x4000000000420040, compHnd=0x7ffa0d7f9140, methodInfo=0x7ffa0d7f9378, methodCodePtr=0x7ffa0d7f9070, methodCodeSize=0x7ffa0d7f9358, compileFlags=0x7ffa0d7f9098, inlineInfoPtr=0x0)
    at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/compiler.cpp:7080
#21 0x00007ffa3d28e148 in CILJit::compileMethod (this=0x7ffa3d73f309 <operator new(unsigned long, CILJitSingletonAllocator const&)::CILJitBuff>, compHnd=0x7ffa0d7f9140, methodInfo=0x7ffa0d7f9378, flags=4294967295, entryAddress=0x7ffa0d7f9360, 
    nativeSizeOfCode=0x7ffa0d7f9358) at /home/dheon/work/dotnet/jobs/fnv/runtime/src/coreclr/jit/ee_il_dll.cpp:276
#22 0x00007fffe7384e78 in JitCompileMethod () from /home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Debug/x64/crossgen2/libjitinterface_x64.so
#23 0x00007fff7ee05fe4 in ?? ()
#24 0x00007ffa0d7f9360 in ?? ()
#25 0x00007ffa0d7f9358 in ?? ()
#26 0x000000004d1dc1b3 in ?? ()
#27 0x00007ffff79163f0 in ?? () from /home/dheon/work/dotnet/jobs/fnv/runtime/.dotnet/shared/Microsoft.NETCore.App/6.0.0-preview.4.21253.7/libcoreclr.so
#28 0x00007ffa0d7f9cf0 in ?? ()
#29 0x00007fff7ebbf050 in ?? ()
#30 0x00007fff7ebbf050 in ?? ()
#31 0x00007ffa0d7f9190 in ?? ()
#32 0x00007fff7ee05fe4 in ?? ()
#33 0x00007ffa0d7f9250 in ?? ()
#34 0x00007ffa0d7f9378 in ?? ()
#35 0x00007fff7ebbf050 in ?? ()
#36 0x00007ff9f4001600 in ?? ()
#37 0x00007fffe7384d80 in ?? () from /home/dheon/work/dotnet/jobs/fnv/runtime/artifacts/bin/coreclr/Linux.armel.Debug/x64/crossgen2/libjitinterface_x64.so
#38 0x00007ffa0d7f9358 in ?? ()
#39 0x00007ffa0d7f9360 in ?? ()
#40 0x00007ffa0d7f9378 in ?? ()
#41 0x00007ffa0d7f9368 in ?? ()
#42 0xffffffff00000001 in ?? ()
#43 0x00007ffaf03492a8 in ?? ()
#44 0x0000000000000000 in ?? ()
@dotnet-issue-labeler dotnet-issue-labeler bot added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI untriaged New issue has not been triaged by the area owner labels Jul 16, 2021
@sandreenko sandreenko added arch-arm32 bug and removed untriaged New issue has not been triaged by the area owner labels Jul 16, 2021
@sandreenko sandreenko added this to the 6.0.0 milestone Jul 16, 2021
@sandreenko sandreenko self-assigned this Jul 16, 2021
@sandreenko
Copy link
Contributor

Thanks, @clamp03, so this is only for armel, correct? Do you know if we have it in ci somewhere? I think I saw that we were testing it in the past.

Btw is converting from long to double supported with INS_vmov_i2d or not? what about not-armel platforms?

@clamp03
Copy link
Member Author

clamp03 commented Jul 16, 2021

@sandreenko As I know, CI tests all platforms except armel. So I think this issue is only for armel currently.
Actually, I don't know the other platforms.
I am trying to add CI for armel. #2394

I can find some codes that convert long to double with INS_vmv_i2d.

@sandreenko
Copy link
Contributor

Strange, I see that arm32 (non-armel) should fall into the same assert:

inst_Mov(targetType, targetReg, srcReg, /* canSkip */ true);

calls:
instruction ins = ins_Copy(srcReg, dstType);

that returns
// No SIMD support yet
assert(!varTypeIsSIMD(dstType));
if (dstIsFloatReg)
{
return (dstType == TYP_DOUBLE) ? INS_vmov_i2d : INS_vmov_i2f;
}
else
{
return (dstType == TYP_LONG) ? INS_vmov_d2i : INS_vmov_f2i;
}
#else // TARGET*

so INS_vmov_d2i can be returned and then we call assert(IsMovInstruction(ins)); and it should fail with the assert.

The first guess is that we don't have any longs on arm32 because they are all decomposed but I need to check it and see why we have them for armel.

cc @dotnet/jit-contrib

@clamp03
Copy link
Member Author

clamp03 commented Jul 19, 2021

I found related source code.

#ifdef TARGET_ARMARCH
if (call->IsVarargs() || comp->opts.compUseSoftFP)
{
// For vararg call or on armel, reg args should be all integer.
// Insert copies as needed to move float value to integer register.
GenTree* newNode = LowerFloatArg(ppArg, info);
if (newNode != nullptr)
{
type = newNode->TypeGet();
}
}
#endif // TARGET_ARMARCH

(*. I think call->IsVarargs() is false in ARM&ARMEL. GTF_CALL_M_VARARGS can be assigned in morph.cpp and importer.cpp. However, in ARM(+ARMEL), FEATURE_VARARGS and FEATURE_TAILCALL_OPT are not defined.)

LowerFloatArg calls LowerFloatArgReg
In LowerFloatArgReg, it creates BitCast node that cast from Double to Long. This is a special case that AMREL should handle in CodeGen::genCodeForBitCast.

GenTree* Lowering::LowerFloatArgReg(GenTree* arg, regNumber regNum)
{
var_types floatType = arg->TypeGet();
assert(varTypeIsFloating(floatType));
var_types intType = (floatType == TYP_DOUBLE) ? TYP_LONG : TYP_INT;
GenTree* intArg = comp->gtNewBitCastNode(intType, arg);
intArg->SetRegNum(regNum);
#ifdef TARGET_ARM
if (floatType == TYP_DOUBLE)
{
regNumber nextReg = REG_NEXT(regNum);
intArg->AsMultiRegOp()->gtOtherReg = nextReg;
}
#endif
return intArg;
}

And I can find other gtNewBitCastNode function call in lower.cpp for GT_RETURN, STORE_LCL_FIELD and etc.
I tried to make tests that create BitCast node (long <=> double for arm&armel) from C# source. However, I can't because conv.* CIL is inserted right before that CILs in DLL files. I am curious that BitCast except in LowerFloatArgReg is really working? Could you share any examples if possible?

I think my investigation has many mistakes. Please share your comments.
Thank you.

@sandreenko
Copy link
Contributor

So the idea of our JIT for 32bit targets is that all longs are created before lowering and then decomposed in this phase right before the main lowering https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/decomposelongs.cpp.
So adding a GT_LONG node for 32bit target during lowering is an exception and LowerFloatArgReg on arm32 soft fp is the only place where it can happen.

So what can we do here? I see two options:

  1. Support it in lowering as you mentioned, kind of pre-existing but go against our concept of long decomposition;
  2. Introduce this long before lowering, maybe here
    passUsingFloatRegs = !callIsVararg && (isHfaArg || varTypeUsesFloatReg(argx)) && !opts.compUseSoftFP;
  3. maybe something else between morph and decomposelongs can do this?

@clamp03
Copy link
Member Author

clamp03 commented Jul 20, 2021

So the idea of our JIT for 32bit targets is that all longs are created before lowering and then decomposed in this phase right before the main lowering https://github.com/dotnet/runtime/blob/main/src/coreclr/jit/decomposelongs.cpp.
So adding a GT_LONG node for 32bit target during lowering is an exception and LowerFloatArgReg on arm32 soft fp is the only place where it can happen.

I think so. (Actually, I missed DecomposeLongs. I learned. Thank you. )

So what can we do here? I see two options:

  1. Support it in lowering as you mentioned, kind of pre-existing but go against our concept of long decomposition;
  2. Introduce this long before lowering, maybe here
    passUsingFloatRegs = !callIsVararg && (isHfaArg || varTypeUsesFloatReg(argx)) && !opts.compUseSoftFP;
  3. maybe something else between morph and decomposelongs can do this?

I think the second is a good idea.
Thank you.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 20, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 20, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-arm32 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants