runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[ARM32] Display wrong register number for double registers

Open hqueue opened this issue 9 years ago • 8 comments

For ARM32, double register number is not shown correctly in JitDump, JitDisasm and etc.

  • An example from coreclr unit test.

    $ COMPlus_JitDisasm=DblAdd COMPlus_JitDump=DblAdd  ./corerun 
    tests/JIT/CodeGenBringUpTests/DblAdd/DblAdd.exe
    ...(omitted)...
    IN0001: 000006  EE30 0B01      vadd    d0, d0, d2
    ...(omitted)...
    IN0001: 000006      vadd    d0, d0, d2
    

    However above instruction encoding EE30 0B01 means vadd d0, d0, d1.

  • Another example from recent PR for ryujit/arm32. I was confused with below example (https://github.com/dotnet/coreclr/pull/11643#issuecomment-301755496) in the PR.

    IN0074: 000180  EEB8 4BC4      vcvt.i2d d8, s8  
    

    This encoding EEB8 4BC4 means vcvt.i2d d4, s8, i.e. single-float register number is correct, but double register number is incorrectly displayed.

Both LegacyJIT and RyuJIT have same problem.

category:implementation theme:debug-dumps skill-level:intermediate cost:medium

hqueue avatar May 16 '17 11:05 hqueue

My appologies, I moved the wrong bug by accident, reopening ...

karelz avatar May 16 '17 12:05 karelz

It seems to be not a trivial job to make it print out double registers for ARM32 correctly, because there are different paths to get a name of ARM32 double registers.

  • COMPlus_JitDump
    • Each phase use different method to print out register name.
  • COMPlus_JitDisasm

For example, each phase of JIT compiler use different way to print out double registers, i.e. calling getRegNameFloat(), getRegName(), compRegVarName(), emitRegName() and etc.

In addition, I've a concern that if I changed this, then it will introduce a lot of differences in jit-diff for ARM32 codegen.

Do you have any idea ?

hqueue avatar May 17 '17 08:05 hqueue

I think for arm32 legacy_backend, we just lived with it, since while it is confusing, once you understand it, there is no ambiguity. It would be nice to fix it, though.

I've a concern that if I changed this, then it will introduce a lot of differences in jit-diff for ARM32 codegen.

That is true, but would be a one-time, temporary thing.

BruceForstall avatar May 18 '17 06:05 BruceForstall

I think for arm32 legacy_backend, we just lived with it, since while it is confusing, once you understand it, there is no ambiguity.

Right, if we are aware of it, there is no problem.

Because there are other urgent issues in ryujit/arm32, I'm going to leave it as future task and just notify it to other arm32 contributors.

@dotnet/arm32-contrib Please be aware that double register number in JitDump and JitDisam is not correct for ARM32 in both LegacyJIT and RyuJIT.

hqueue avatar May 18 '17 08:05 hqueue

Since this isn't required to ship RyuJIT/ARM32, I'm removing it from the RyuJIT/ARM32 project.

BruceForstall avatar Aug 02 '17 20:08 BruceForstall

@BruceForstall seems like this should be moved to Future...?

AndyAyersMS avatar Feb 23 '18 19:02 AndyAyersMS

Yes. Done.

BruceForstall avatar Feb 23 '18 21:02 BruceForstall

I can confirm the problem still exists.

; Method getChars.MyXMLNodeWriter:DblAdd(double,double):double
G_M34776_IG01:              ;; offset=0000H
000000  E92D 4800      push    {r11,lr}
000004  46EB           mov     r11, sp
						;; size=6 bbWeight=1    PerfScore 2.00

G_M34776_IG02:              ;; offset=0006H
000006  EE30 0B01      vadd    d0, d0, d2
						;; size=4 bbWeight=1    PerfScore 1.00

G_M34776_IG03:              ;; offset=000AH
00000A  E8BD 8800      pop     {r11,pc}
						;; size=4 bbWeight=1    PerfScore 1.00
; Total bytes of code: 14

kunalspathak avatar Dec 23 '22 06:12 kunalspathak