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

[RISC-V] Add pseudoinstructions to disassembler #102260

Merged
merged 25 commits into from
May 29, 2024

Conversation

Bajtazar
Copy link
Contributor

Adds pseudoinstruction printing to the disassembler. Requested in #102074 (comment)

Part of #84834, cc @dotnet/samsung

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 15, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label May 15, 2024
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@clamp03 clamp03 added the arch-riscv Related to the RISC-V architecture label May 15, 2024
src/coreclr/jit/emitriscv64.cpp Outdated Show resolved Hide resolved
Copy link
Member

@clamp03 clamp03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Did you check coreclr test? Could you show some dump examples?

@Bajtazar
Copy link
Contributor Author

LGTM Did you check coreclr test? Could you show some dump examples?

Tests passes fine

Examples of disassm:

  • mv instruction

Prior

            slli           a2, a2, 7
            addi           a2, a2, 0
            ld             a2, 0(a2)

New

            slli           a2, a2, 7
            mv             a2, a2
            ld             a2, 0(a2)
  • bnezand j instructions

Prior

G_M10072_IG07:  ;; offset=0x0064
            sltiu          a0, s1, 65
            slli           a0, a0, 56
            srli           a0, a0, 56
            addiw          t6, a0, 0
            bne            t6, zero, G_M10072_IG11
            jal            zero, 80

New

G_M10072_IG07:  ;; offset=0x0064
            sltiu          a0, s1, 65
            slli           a0, a0, 56
            srli           a0, a0, 56
            addiw          t6, a0, 0
            bnez           t6, G_M10072_IG11
            j              80
  • nop instruction

Prior

G_M55990_IG31:  ;; offset=0x1578
            addi           zero, zero, 0

New

G_M55990_IG31:  ;; offset=0x1578
            nop

@clamp03
Copy link
Member

clamp03 commented May 21, 2024

@tomeksowi @jakobbotsch @jkotas Could you review this PR?

src/coreclr/jit/emitriscv64.cpp Outdated Show resolved Hide resolved
@risc-vv
Copy link

risc-vv commented May 23, 2024

RISC-V test results for qemu-prio0-checked: 2718 / 2738 (99.27%)

details

GIT: 6869460


=======================
      passed: 2718
      failed: 3
     skipped: 16
      killed: 1
------------------------
  TOTAL libs: 2738
 TOTAL tests: 2738
   REAL time: 36min 26s 575ms
=======================
failed tests
[44.460s] profiler.unittest.releaseondetach.releaseondetach.sh
    [exitcode-134]: SIGABRT Abort. Managed or native assert, or runtime check such as heap corruption, caused call to abort(). Core dumped.
[28.930s] JIT.Directed.debugging.debuginfo.tester.tester.sh
    [exitcode-  -1]: unknown error
[290.630s] readytorun.determinism.crossgen2determinism.crossgen2determinism.sh
    [exitcode-101]: Unknown exit code.
killed tests
[1810.536s] profiler.eventpipe.reverse_startup.reverse_startup.sh
skipped tests
[0.000s] Interop.MonoAPI.MonoMono.InstallEHCallback.InstallEHCallback.sh
[0.000s] Interop.MonoAPI.MonoMono.PInvokeDetach.PInvokeDetach.sh
[0.000s] Interop.MonoAPI.MonoMono.Thunks.Thunks.sh
[0.000s] tracing.eventpipe.eventsourceerror.eventsourceerror.eventsourceerror.sh
[0.000s] JIT.Directed.arglist.vararg_TargetUnix.vararg_TargetUnix.sh
[0.000s] JIT.opt.ValueNumbering.ExposedLocalsNumbering.ExposedLocalsNumbering.sh
[0.000s] JIT.opt.SSA.MemorySsa.MemorySsa.sh
[0.000s] JIT.Regression.JitBlue.Runtime_57606.Runtime_57606.Runtime_57606.sh
[0.000s] Loader.binding.tracing.BinderTracingTest.Basic.BinderTracingTest.Basic.sh
[0.000s] readytorun.GenericCycleDetection.Depth3Test.Depth3Test.sh
[0.000s] readytorun.DynamicMethodGCStress.DynamicMethodGCStress.DynamicMethodGCStress.sh
[0.000s] baseservices.mono.runningmono.runningmono.sh
[0.000s] baseservices.typeequivalence.signatures.nopiatestil.nopiatestil.sh
[0.000s] baseservices.typeequivalence.istypeequivalent.istypeequivalent.istypeequivalent.sh
[0.000s] baseservices.finalization.CriticalFinalizer.CriticalFinalizer.sh
[0.000s] baseservices.exceptions.stackoverflow.stackoverflowtester.stackoverflowtester.sh

@risc-vv
Copy link

risc-vv commented May 23, 2024

RISC-V test results for starfive-prio0-checked: 2720 / 2738 (99.34%)

details

GIT: 6869460


=======================
      passed: 2720
      failed: 2
     skipped: 16
      killed: 0
------------------------
  TOTAL libs: 2738
 TOTAL tests: 2738
   REAL time: 1h 4min 5s 272ms
=======================
failed tests
[408.370s] readytorun.determinism.crossgen2determinism.crossgen2determinism.sh
    [exitcode-101]: Unknown exit code.
[726.860s] readytorun.coreroot_determinism.coreroot_determinism.coreroot_determinism.sh
    [exitcode-  1]: unknown error
killed tests
skipped tests
[0.000s] readytorun.DynamicMethodGCStress.DynamicMethodGCStress.DynamicMethodGCStress.sh
[0.000s] readytorun.GenericCycleDetection.Depth3Test.Depth3Test.sh
[0.000s] JIT.Regression.JitBlue.Runtime_57606.Runtime_57606.Runtime_57606.sh
[0.000s] JIT.Directed.arglist.vararg_TargetUnix.vararg_TargetUnix.sh
[0.000s] JIT.opt.SSA.MemorySsa.MemorySsa.sh
[0.000s] JIT.opt.ValueNumbering.ExposedLocalsNumbering.ExposedLocalsNumbering.sh
[0.000s] Loader.binding.tracing.BinderTracingTest.Basic.BinderTracingTest.Basic.sh
[0.000s] Interop.MonoAPI.MonoMono.Thunks.Thunks.sh
[0.000s] Interop.MonoAPI.MonoMono.PInvokeDetach.PInvokeDetach.sh
[0.000s] Interop.MonoAPI.MonoMono.InstallEHCallback.InstallEHCallback.sh
[0.000s] tracing.eventpipe.eventsourceerror.eventsourceerror.eventsourceerror.sh
[0.000s] baseservices.finalization.CriticalFinalizer.CriticalFinalizer.sh
[0.000s] baseservices.mono.runningmono.runningmono.sh
[0.000s] baseservices.exceptions.stackoverflow.stackoverflowtester.stackoverflowtester.sh
[0.000s] baseservices.typeequivalence.istypeequivalent.istypeequivalent.istypeequivalent.sh
[0.000s] baseservices.typeequivalence.signatures.nopiatestil.nopiatestil.sh

@risc-vv
Copy link

risc-vv commented May 23, 2024

RISC-V test results for qemu-prio1-checked: 9396 / 9443 (99.50%)

details

GIT: 6869460


=======================
      passed: 9396
      failed: 4
     skipped: 42
      killed: 1
------------------------
  TOTAL libs: 9443
 TOTAL tests: 9443
   REAL time: 1h 17min 16s 683ms
=======================
failed tests
[48.630s] profiler.unittest.releaseondetach.releaseondetach.sh
    [exitcode-134]: SIGABRT Abort. Managed or native assert, or runtime check such as heap corruption, caused call to abort(). Core dumped.
[38.310s] JIT.Directed.debugging.debuginfo.tester.tester.sh
    [exitcode-  -1]: unknown error
[349.840s] readytorun.determinism.crossgen2determinism.crossgen2determinism.sh
    [exitcode-101]: Unknown exit code.
[706.940s] readytorun.coreroot_determinism.coreroot_determinism.coreroot_determinism.sh
    [exitcode-  1]: unknown error
killed tests
[1800.886s] profiler.eventpipe.reverse_startup.reverse_startup.sh
skipped tests
[0.000s] Interop.MonoAPI.MonoMono.InstallEHCallback.InstallEHCallback.sh
[0.000s] Interop.MonoAPI.MonoMono.PInvokeDetach.PInvokeDetach.sh
[0.000s] Interop.MonoAPI.MonoMono.Thunks.Thunks.sh
[0.000s] tracing.eventpipe.eventsourceerror.eventsourceerror.eventsourceerror.sh
[0.000s] JIT.Directed.arglist.vararg_TargetUnix.vararg_TargetUnix.sh
[0.000s] JIT.Directed.rvastatics.RVAOrderingTest.RVAOrderingTest.sh
[0.000s] JIT.Directed.PREFIX.volatile.1.arglist_Target_64BIT_volatile.arglist_Target_64BIT_volatile.sh
[0.000s] JIT.Directed.PREFIX.unaligned.4.arglist_Target_64BIT_unaligned_4.arglist_Target_64BIT_unaligned_4.sh
[0.000s] JIT.Directed.PREFIX.unaligned.1.arglist_Target_64BIT_unaligned_1.arglist_Target_64BIT_unaligned_1.sh
[0.000s] JIT.Directed.PREFIX.unaligned.2.arglist_Target_64BIT_unaligned_2.arglist_Target_64BIT_unaligned_2.sh
[0.000s] JIT.opt.ValueNumbering.ExposedLocalsNumbering.ExposedLocalsNumbering.sh
[0.000s] JIT.opt.SSA.MemorySsa.MemorySsa.sh
[0.000s] JIT.Methodical.refany.seq_d.seq_d.sh
[0.000s] JIT.Methodical.refany.seq_r.seq_r.sh
[0.000s] JIT.Methodical.Coverage.arglist_pos.arglist_pos.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b37646.b37646.b37646.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b41852.b41852.b41852.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b31746.b31746.b31746.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M11-Beta1.b41391.b41391.b41391.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M09.5-PDC.b16423.b16423.b16423.sh
[0.000s] JIT.Regression.JitBlue.Runtime_57606.Runtime_57606.Runtime_57606.sh
[0.000s] JIT.Regression.CLR-x86-EJIT.V1-M12-Beta2.b26323.b26323.b26323.sh
[0.000s] JIT.jit64.mcc.interop.mcc_i00.mcc_i00.sh
[0.000s] Loader.binding.tracing.BinderTracingTest.Basic.BinderTracingTest.Basic.sh
[0.000s] readytorun.GenericCycleDetection.Depth3Test.Depth3Test.sh
[0.000s] readytorun.DynamicMethodGCStress.DynamicMethodGCStress.DynamicMethodGCStress.sh
[0.000s] GC.LargeMemory.API.gc.reregisterforfinalize.reregisterforfinalize.sh
[0.000s] GC.LargeMemory.API.gc.getgeneration.getgeneration.sh
[0.000s] GC.LargeMemory.API.gc.collect.collect.sh
[0.000s] GC.LargeMemory.Allocation.finalizertest.finalizertest.sh
[0.000s] GC.Regressions.dev10bugs.536168.536168.536168.sh
[0.000s] GC.Regressions.Github.Runtime_76219.Runtime_76219.Runtime_76219.sh
[0.000s] GC.Features.BackgroundGC.foregroundgc.foregroundgc.sh
[0.000s] GC.Features.LOHFragmentation.lohfragmentation.lohfragmentation.sh
[0.000s] GC.Coverage.271010.271010.sh
[0.000s] baseservices.threading.regressions.2164.foreground-shutdown.foreground-shutdown.sh
[0.000s] baseservices.mono.runningmono.runningmono.sh
[0.000s] baseservices.typeequivalence.signatures.nopiatestil.nopiatestil.sh
[0.000s] baseservices.typeequivalence.istypeequivalent.istypeequivalent.istypeequivalent.sh
[0.000s] baseservices.finalization.CriticalFinalizer.CriticalFinalizer.sh
[0.000s] baseservices.exceptions.stackoverflow.stackoverflowtester.stackoverflowtester.sh
[0.000s] baseservices.exceptions.StackTracePreserve.StackTracePreserveTests.StackTracePreserveTests.sh

@risc-vv
Copy link

risc-vv commented May 23, 2024

RISC-V test results for starfive-prio1-checked: 9399 / 9443 (99.53%)

details

GIT: 6869460


=======================
      passed: 9399
      failed: 2
     skipped: 42
      killed: 0
------------------------
  TOTAL libs: 9443
 TOTAL tests: 9443
   REAL time: 2h 50min 28s 269ms
=======================
failed tests
[416.290s] readytorun.determinism.crossgen2determinism.crossgen2determinism.sh
    [exitcode-101]: Unknown exit code.
[704.320s] readytorun.coreroot_determinism.coreroot_determinism.coreroot_determinism.sh
    [exitcode-  1]: unknown error
killed tests
skipped tests
[0.000s] readytorun.DynamicMethodGCStress.DynamicMethodGCStress.DynamicMethodGCStress.sh
[0.000s] readytorun.GenericCycleDetection.Depth3Test.Depth3Test.sh
[0.000s] GC.Features.LOHFragmentation.lohfragmentation.lohfragmentation.sh
[0.000s] GC.Features.BackgroundGC.foregroundgc.foregroundgc.sh
[0.000s] GC.Coverage.271010.271010.sh
[0.000s] GC.LargeMemory.Allocation.finalizertest.finalizertest.sh
[0.000s] GC.LargeMemory.API.gc.collect.collect.sh
[0.000s] GC.LargeMemory.API.gc.reregisterforfinalize.reregisterforfinalize.sh
[0.000s] GC.LargeMemory.API.gc.getgeneration.getgeneration.sh
[0.000s] GC.Regressions.dev10bugs.536168.536168.536168.sh
[0.000s] GC.Regressions.Github.Runtime_76219.Runtime_76219.Runtime_76219.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M11-Beta1.b41391.b41391.b41391.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b37646.b37646.b37646.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b31746.b31746.b31746.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M12-Beta2.b41852.b41852.b41852.sh
[0.000s] JIT.Regression.CLR-x86-JIT.V1-M09.5-PDC.b16423.b16423.b16423.sh
[0.000s] JIT.Regression.JitBlue.Runtime_57606.Runtime_57606.Runtime_57606.sh
[0.000s] JIT.Regression.CLR-x86-EJIT.V1-M12-Beta2.b26323.b26323.b26323.sh
[0.000s] JIT.Directed.arglist.vararg_TargetUnix.vararg_TargetUnix.sh
[0.000s] JIT.Directed.rvastatics.RVAOrderingTest.RVAOrderingTest.sh
[0.000s] JIT.Directed.PREFIX.volatile.1.arglist_Target_64BIT_volatile.arglist_Target_64BIT_volatile.sh
[0.000s] JIT.Directed.PREFIX.unaligned.4.arglist_Target_64BIT_unaligned_4.arglist_Target_64BIT_unaligned_4.sh
[0.000s] JIT.Directed.PREFIX.unaligned.2.arglist_Target_64BIT_unaligned_2.arglist_Target_64BIT_unaligned_2.sh
[0.000s] JIT.Directed.PREFIX.unaligned.1.arglist_Target_64BIT_unaligned_1.arglist_Target_64BIT_unaligned_1.sh
[0.000s] JIT.jit64.mcc.interop.mcc_i00.mcc_i00.sh
[0.000s] JIT.opt.SSA.MemorySsa.MemorySsa.sh
[0.000s] JIT.opt.ValueNumbering.ExposedLocalsNumbering.ExposedLocalsNumbering.sh
[0.000s] JIT.Methodical.Coverage.arglist_pos.arglist_pos.sh
[0.000s] JIT.Methodical.refany.seq_d.seq_d.sh
[0.000s] JIT.Methodical.refany.seq_r.seq_r.sh
[0.000s] Loader.binding.tracing.BinderTracingTest.Basic.BinderTracingTest.Basic.sh
[0.000s] Interop.MonoAPI.MonoMono.Thunks.Thunks.sh
[0.000s] Interop.MonoAPI.MonoMono.PInvokeDetach.PInvokeDetach.sh
[0.000s] Interop.MonoAPI.MonoMono.InstallEHCallback.InstallEHCallback.sh
[0.000s] tracing.eventpipe.eventsourceerror.eventsourceerror.eventsourceerror.sh
[0.000s] baseservices.finalization.CriticalFinalizer.CriticalFinalizer.sh
[0.000s] baseservices.mono.runningmono.runningmono.sh
[0.000s] baseservices.threading.regressions.2164.foreground-shutdown.foreground-shutdown.sh
[0.000s] baseservices.exceptions.stackoverflow.stackoverflowtester.stackoverflowtester.sh
[0.000s] baseservices.exceptions.StackTracePreserve.StackTracePreserveTests.StackTracePreserveTests.sh
[0.000s] baseservices.typeequivalence.istypeequivalent.istypeequivalent.istypeequivalent.sh
[0.000s] baseservices.typeequivalence.signatures.nopiatestil.nopiatestil.sh

Copy link
Member

@jakobbotsch jakobbotsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please fix the conflicts?

@risc-vv
Copy link

risc-vv commented May 28, 2024

RISC-V testing failed on init-build

details

GIT: a4381bd

Cloning into 'runtime'...
Updating files:  16% (9631/58593)
Updating files:  17% (9961/58593)
Updating files:  18% (10547/58593)
Updating files:  19% (11133/58593)
Updating files:  20% (11719/58593)
Updating files:  21% (12305/58593)
Updating files:  22% (12891/58593)
Updating files:  23% (13477/58593)
Updating files:  24% (14063/58593)
Updating files:  25% (14649/58593)
Updating files:  26% (15235/58593)
Updating files:  27% (15821/58593)
Updating files:  28% (16407/58593)
Updating files:  29% (16992/58593)
Updating files:  30% (17578/58593)
Updating files:  31% (18164/58593)
Updating files:  32% (18750/58593)
Updating files:  33% (19336/58593)
Updating files:  34% (19922/58593)
Updating files:  35% (20508/58593)
Updating files:  35% (20968/58593)
Updating files:  36% (21094/58593)
Updating files:  37% (21680/58593)
Updating files:  38% (22266/58593)
Updating files:  39% (22852/58593)
Updating files:  40% (23438/58593)
Updating files:  41% (24024/58593)
Updating files:  42% (24610/58593)
Updating files:  43% (25195/58593)
Updating files:  44% (25781/58593)
Updating files:  45% (26367/58593)
Updating files:  46% (26953/58593)
Updating files:  47% (27539/58593)
Updating files:  48% (28125/58593)
Updating files:  49% (28711/58593)
Updating files:  50% (29297/58593)
Updating files:  51% (29883/58593)
Updating files:  52% (30469/58593)
Updating files:  53% (31055/58593)
Updating files:  54% (31641/58593)
Updating files:  55% (32227/58593)
Updating files:  56% (32813/58593)
Updating files:  57% (33399/58593)
Updating files:  58% (33984/58593)
Updating files:  58% (34531/58593)
Updating files:  59% (34570/58593)
Updating files:  60% (35156/58593)
Updating files:  61% (35742/58593)
Updating files:  62% (36328/58593)
Updating files:  63% (36914/58593)
Updating files:  64% (37500/58593)
Updating files:  65% (38086/58593)
Updating files:  66% (38672/58593)
Updating files:  67% (39258/58593)
Updating files:  68% (39844/58593)
Updating files:  69% (40430/58593)
Updating files:  70% (41016/58593)
Updating files:  71% (41602/58593)
Updating files:  72% (42187/58593)
Updating files:  73% (42773/58593)
Updating files:  74% (43359/58593)
Updating files:  75% (43945/58593)
Updating files:  76% (44531/58593)
Updating files:  77% (45117/58593)
Updating files:  78% (45703/58593)
Updating files:  79% (46289/58593)
Updating files:  80% (46875/58593)
Updating files:  81% (47461/58593)
Updating files:  82% (48047/58593)
Updating files:  83% (48633/58593)
Updating files:  84% (49219/58593)
Updating files:  84% (49312/58593)
Updating files:  85% (49805/58593)
Updating files:  86% (50390/58593)
Updating files:  87% (50976/58593)
Updating files:  88% (51562/58593)
Updating files:  89% (52148/58593)
Updating files:  90% (52734/58593)
Updating files:  91% (53320/58593)
Updating files:  92% (53906/58593)
Updating files:  93% (54492/58593)
Updating files:  94% (55078/58593)
Updating files:  95% (55664/58593)
Updating files:  96% (56250/58593)
Updating files:  97% (56836/58593)
Updating files:  98% (57422/58593)
Updating files:  99% (58008/58593)
Updating files: 100% (58593/58593)
Updating files: 100% (58593/58593), done.
Switched to a new branch 'build-net'
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3506 (offset 3 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3506 (offset 3 lines).
Hunk #2 succeeded at 3555 (offset 3 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3508 (offset 3 lines).
Hunk #2 succeeded at 3532 (offset 3 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3508 (offset 3 lines).
Hunk #2 succeeded at 3570 (offset 3 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3347 (offset 3 lines).
Hunk #2 succeeded at 3413 (offset 3 lines).
Hunk #3 succeeded at 3822 (offset 10 lines).
Checking patch src/coreclr/jit/emitriscv64.h...
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3825 (offset 10 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3347 (offset 3 lines).
Hunk #2 succeeded at 3367 (offset 3 lines).
Hunk #3 succeeded at 3457 (offset 3 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3478 (offset 3 lines).
Hunk #2 succeeded at 3516 (offset 3 lines).
Hunk #3 succeeded at 3822 (offset 10 lines).
Hunk #4 succeeded at 3901 (offset 10 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3428 (offset 3 lines).
Hunk #2 succeeded at 3531 (offset 3 lines).
Hunk #3 succeeded at 3908 (offset 10 lines).
Checking patch src/coreclr/jit/codegenriscv64.cpp...
Checking patch src/coreclr/jit/emitriscv64.cpp...
error: while searching for:
{
    code_t code = emitInsCode(ins);

    if (INS_mov == ins)
    {
        assert(isGeneralRegisterOrR0(reg1));
        assert(isGeneralRegisterOrR0(reg2));

error: patch failed: src/coreclr/jit/emitriscv64.cpp:588
error: src/coreclr/jit/emitriscv64.cpp: patch does not apply
Checking patch src/coreclr/jit/instrsriscv64.h...
error: while searching for:
INST(nop,           "nop",            0,    0x00000013)

//// R_R
INST(mov,           "mov",            0,    0x00000013)

////R_I
INST(lui,           "lui",            0,    0x00000037)

error: patch failed: src/coreclr/jit/instrsriscv64.h:35
error: src/coreclr/jit/instrsriscv64.h: patch does not apply
Checking patch src/coreclr/jit/codegenriscv64.cpp...
Checking patch src/coreclr/jit/emitriscv64.cpp...
error: while searching for:
inline bool emitter::emitInsMayWriteToGCReg(instruction ins)
{
    assert(ins != INS_invalid);
    return (ins <= INS_remuw) && (ins >= INS_mv) && !(ins >= INS_jal && ins <= INS_bgeu && ins != INS_jalr) &&
                   (CodeGenInterface::instInfo[ins] & ST) == 0
               ? true
               : false;

error: patch failed: src/coreclr/jit/emitriscv64.cpp:141
error: src/coreclr/jit/emitriscv64.cpp: patch does not apply
Checking patch src/coreclr/jit/instrsriscv64.h...
error: while searching for:
INST(nop,           "nop",            0,    0x00000013)

//// R_R
INST(mv,            "mv",             0,    0x00000013)

////R_I
INST(lui,           "lui",            0,    0x00000037)

error: patch failed: src/coreclr/jit/instrsriscv64.h:35
error: src/coreclr/jit/instrsriscv64.h: patch does not apply
Checking patch src/coreclr/jit/instrsriscv64.h...
error: while searching for:
INST(nop,           "nop",            0,    0x00000013)

//// R_R
INST(mov,           "mov",            0,    0x00000013)

////R_I
INST(lui,           "lui",            0,    0x00000037)

error: patch failed: src/coreclr/jit/instrsriscv64.h:35
error: src/coreclr/jit/instrsriscv64.h: patch does not apply
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3360 (offset 3 lines).
Hunk #2 succeeded at 3373 (offset 3 lines).
Hunk #3 succeeded at 3524 (offset 3 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3540 (offset 3 lines).
Hunk #2 succeeded at 3562 (offset 3 lines).
Hunk #3 succeeded at 3587 (offset 3 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
error: while searching for:
                case 0x0: // ADDIW
                    printf("addiw          %s, %s, %d\n", rd, rs1, imm12);
                    return;
                case 0x1:                                                         // SLLIW
                    printf("slliw          %s, %s, %d\n", rd, rs1, imm12 & 0x3f); // 6 BITS for SHAMT in RISCV64
                    return;
                case 0x5: // SRLIW & SRAIW
                    if (((code >> 30) & 0x1) == 0)
                    {
                        printf("srliw          %s, %s, %d\n", rd, rs1, imm12 & 0x1f); // 5BITS for SHAMT in RISCV64
                    }
                    else
                    {
                        printf("sraiw          %s, %s, %d\n", rd, rs1, imm12 & 0x1f); // 5BITS for SHAMT in RISCV64
                    }
                    return;
                default:
                    printf("RISCV64 illegal instruction: 0x%08X\n", code);
                    return;
            }
        }
        case 0x33:

error: patch failed: src/coreclr/jit/emitriscv64.cpp:3614
error: src/coreclr/jit/emitriscv64.cpp: patch does not apply
Checking patch src/coreclr/jit/emitriscv64.cpp...
error: while searching for:
                case 0x5: // SRLIW & SRAIW
                {
                    static constexpr unsigned kLogicalShiftFunct7    = 0x00;
                    static constexpr unsigned kArithmeticShiftFunct7 = 0x30;

                    unsigned funct7 = (imm12 >> 5) & 0x7f;
                    if (funct7 == kLogicalShiftFunct7)

error: patch failed: src/coreclr/jit/emitriscv64.cpp:3631
error: src/coreclr/jit/emitriscv64.cpp: patch does not apply
Checking patch src/coreclr/jit/emitriscv64.cpp...
error: while searching for:
                case 0x1: // SLLIW
                {
                    unsigned funct7 = (imm12 >> 5) & 0x7f;
                    // SLLI's instruction code's upper 7 bits have to be equal to zero
                    if (funct7 == 0)
                    {
                        printf("slliw          %s, %s, %d\n", rd, rs1, imm12 & 0x1f); // 5 BITS for SHAMT in RISCV64

error: patch failed: src/coreclr/jit/emitriscv64.cpp:3617
error: src/coreclr/jit/emitriscv64.cpp: patch does not apply
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3563 (offset 3 lines).
error: while searching for:
                    return;
                case 0x5: // SRLIW & SRAIW
                {
                    static constexpr unsigned kLogicalShiftFunct7    = 0x00;
                    static constexpr unsigned kArithmeticShiftFunct7 = 0x20;

                    unsigned funct7 = (imm12 >> 5) & 0x7f;
                    if (funct7 == kLogicalShiftFunct7)

error: patch failed: src/coreclr/jit/emitriscv64.cpp:3630
error: src/coreclr/jit/emitriscv64.cpp: patch does not apply
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3541 (offset 3 lines).
error: while searching for:
                    return;
                case 0x1: // SLLIW
                {
                    unsigned funct7 = (imm12 >> 5) & 0x7f;
                    // SLLIW's instruction code's upper 7 bits have to be equal to zero
                    if (funct7 == 0)
                    {
                        printf("slliw          %s, %s, %d\n", rd, rs1, imm12 & 0x1f); // 5 BITS for SHAMT in RISCV64
                    }

error: patch failed: src/coreclr/jit/emitriscv64.cpp:3616
error: src/coreclr/jit/emitriscv64.cpp: patch does not apply
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3644 (offset -14 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3733 (offset -14 lines).
Checking patch src/coreclr/jit/emitriscv64.cpp...
error: while searching for:
                    break;
                case 0x1: // SLLI
                {
                    static constexpr kSlliFunct6 = 0b000000;

                    unsigned funct6 = (imm12 >> 6) & 0x3f;
                    // SLLI's instruction code's upper 6 bits have to be equal to zero

error: patch failed: src/coreclr/jit/emitriscv64.cpp:3538
error: src/coreclr/jit/emitriscv64.cpp: patch does not apply
Checking patch src/coreclr/jit/emitriscv64.cpp...
error: while searching for:
                    switch (opcode3)
                    {
                        case 0x0: // ADDW
                            return;
                            return;
                        case 0x1: // SLLW
                            printf("sllw           %s, %s, %s\n", rd, rs1, rs2);
                            return;
                        case 0x5: // SRLW
                    {
                            return;
                        default:
                            return emitDispIllegalInstruction(code);

error: patch failed: src/coreclr/jit/emitriscv64.cpp:3759
error: src/coreclr/jit/emitriscv64.cpp: patch does not apply
Checking patch src/coreclr/jit/emitriscv64.cpp...
Hunk #1 succeeded at 3591 (offset 1 line).

@Bajtazar
Copy link
Contributor Author

Can you please fix the conflicts?

Conflicts have been fixed. Could you please review new changes?

@jakobbotsch jakobbotsch merged commit d9bc680 into dotnet:main May 29, 2024
102 of 107 checks passed
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
* [RISC-V] Reworked emitDispInsName a bit to ease further development

* [RISC-V] Little improvements

* [RISC-V] Refactored code

* [RISC-V] Added mv and nop pseudoinstructions to disasm

* [RISC-V] Added branch pseudos to disasm

* [RISC-V] Removed dead code

* [RISC-V] Fixes

* [RISC-V] Added j pseudoinstruction to disasm

* [RISC-V] Improved readability

* [RISC-V] Fixed mov pseudoinstruction

* Revert "[RISC-V] Fixed mov pseudoinstruction"

This reverts commit a011c43.

* [RISC-V] Fixed mov printing name

* [RISC-V] After review changes

* [RISC-V] More fixes after review

* [RISC-V] Adjusted 32-bit shift disasm to changes

* [RISC-V] Fixed bug

* [RISC-V] Fixed comment

* [RISC-V] Changed constants' literal type

* [RISC-V] Added more constants

* [RISC-V] Reinforced printing 1

* [RISC-V] Reinforced printing 2

* [RISC-V] Fixed bug

* [RISC-V] Resolved more bugs

* [RISC-V] Removed dead assert
@github-actions github-actions bot locked and limited conversation to collaborators Jun 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-riscv Related to the RISC-V architecture area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants