Skip to content

Commit

Permalink
[Mono][RISCV] Fix bugs so that pass more regression tests (dotnet#98602)
Browse files Browse the repository at this point in the history
* Revert "clean the code"

This reverts commit 82793d7.

* skip test aliasing_retbuf

* skip loopinfinally

* skip loopinfinally

* skip CdeclMemberFunctionTest

* skip PlatformDefaultMemberFunctionTest

* skip tests

* fix atomic

* fix atomic

* fix OP_COMPARE

* fix op_COMPARE

* fix OP_ATOMIC_ADD

* lowering OP_DIV_UN_IMM

* lowering OP_IDIV_UN_IMM

* fix OP_ATOMIC_ADD

* fix ROUND Mode of R and F OP

* process ArgOnStackR4

* support arglist

* Fix handling of OP_IL_SEQ_POINT in mini-riscv.c

* decompose OP_ICONV_TO_U4 as OP_ZEXT_I4

* Refactor division and remainder operations in mini-riscv.c

* Update length of int_div and long_div instructions

* update CI

* process special case of OP_LCGT_UN rs1 -1

* decompose OP_ICONV_TO_OVF_U4 by sext

* Refactor atomic unsigned load instructions in mini-riscv.c

* Update RISC-V instructions and fix method-t-ir for multiplication

* Add support for OP_CALL in mono_arch_lowering_pass

* Fix unhandled op following OP_RCOMPARE and OP_FCOMPARE

* Fix MAX_VIRTUAL_DELEGATE_OFFSET check in get_delegate_virtual_invoke_impl

* Add workflow for syncing branch to daily build

* Update start_handler length in cpu-riscv64.mdesc

* Update scanCommit.yml

* Update scanCommit.yml

* Remove scanCommit.yml workflow

* Update start_handler length in cpu-riscv64.mdesc

* Add support for storing float arguments in integer registers for RISC-V architecture

* Fix widening operation for RISC-V target

* Add support for ArgHFA in mini-riscv.h

* Update RISC-V instructions in mini-riscv.c and cpu-riscv64.mdesc

* Fix RISC-V calling convention in mini-riscv.c

* fix setting lmf in prolague

* update test file

* tmp

* Revert "tmp"

This reverts commit f0db381.

* clean pr

* clang format file

* format

* Revert "clang format file"

This reverts commit b8bc194.

* set cfa_reg

* fix unwind

* tmp

* fix length of vcall2

* fix length of call

* address comment

* revert helpers.c

* widen float type when  r4 multiply by r8
  • Loading branch information
Xinlong-Wu authored Feb 17, 2024
1 parent 6d4fc1a commit 1632e47
Show file tree
Hide file tree
Showing 5 changed files with 555 additions and 152 deletions.
47 changes: 24 additions & 23 deletions src/mono/mono/mini/cpu-riscv64.mdesc
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@ dummy_use: src1:i len:0
il_seq_point: len:0
seq_point: len:0

arglist: src1:i len:12
check_this: src1:b len:4
get_ex_obj: dest:i len:4
gc_safe_point: src1:i len:12 clob:c
start_handler: len:16 clob:c
start_handler: len:36 clob:c
call_handler: len:4 clob:c
endfinally: len:32
endfilter: src1:i len:32
localloc: dest:i src1:i len:52
localloc_imm: dest:i len:28
generic_class_init: src1:a len:12 clob:c
ckfinite: dest:f src1:f len:28
ckfinite: dest:f src1:f len:32
break: len:4

throw: src1:i len:4
Expand All @@ -54,21 +55,21 @@ rethrow: src1:i len:4
br: len:4
br_reg: src1:i len:4
jump_table: dest:i len:16
call: dest:a len:4 clob:c
call_reg: dest:a src1:i len:4 clob:c
call_membase: dest:a src1:b len:20 clob:c
voidcall: len:4 clob:c
voidcall_reg: src1:i len:4 clob:c
voidcall_membase: src1:b len:20 clob:c
vcall2: len:16 clob:c
call: dest:a len:28 clob:c
call_reg: dest:a src1:i len:16 clob:c
call_membase: dest:a src1:b len:32 clob:c
voidcall: len:28 clob:c
voidcall_reg: src1:i len:16 clob:c
voidcall_membase: src1:b len:32 clob:c
vcall2: len:28 clob:c
vcall2_reg: src1:i len:16 clob:c
vcall2_membase: src1:b len:28 clob:c
fcall: dest:f len:8 clob:c
fcall_reg: dest:f src1:i len:8 clob:c
fcall_membase: dest:f src1:b len:12 clob:c
rcall: dest:f len:8 clob:c
rcall_reg: dest:f src1:i len:8 clob:c
rcall_membase: dest:f src1:b len:12 clob:c
vcall2_membase: src1:b len:32 clob:c
fcall: dest:f len:28 clob:c
fcall_reg: dest:f src1:i len:16 clob:c
fcall_membase: dest:f src1:b len:32 clob:c
rcall: dest:f len:28 clob:c
rcall_reg: dest:f src1:i len:16 clob:c
rcall_membase: dest:f src1:b len:32 clob:c

# Note: in RV32, it shoule be
# lcall: dest:l ...
Expand Down Expand Up @@ -101,8 +102,8 @@ loadr4_membase: dest:f src1:b len:24
loadr8_membase: dest:f src1:b len:24

memory_barrier: len:4
atomic_add_i4: dest:i src1:i src2:i len:4
atomic_add_i8: dest:i src1:i src2:i len:4
atomic_add_i4: dest:i src1:i src2:i len:8
atomic_add_i8: dest:i src1:i src2:i len:8
atomic_store_i1: dest:b src1:i len:8
atomic_store_u1: dest:b src1:i len:8
atomic_store_i2: dest:b src1:i len:8
Expand All @@ -113,7 +114,7 @@ atomic_store_i8: dest:b src1:i len:8
atomic_store_u8: dest:b src1:i len:8
atomic_load_i1: dest:b src1:i len:12
atomic_load_u1: dest:b src1:i len:12
atomic_load_i2: dest:b src1:i len:12
atomic_load_i2: dest:b src1:i len:24
atomic_load_u2: dest:b src1:i len:12
atomic_load_i4: dest:b src1:i len:12
atomic_load_u4: dest:b src1:i len:12
Expand All @@ -137,18 +138,18 @@ iconst: dest:i len:16
int_add: dest:i src1:i src2:i len:4
int_sub: dest:i src1:i src2:i len:4
int_mul: dest:i src1:i src2:i len:4
int_div: dest:i src1:i src2:i len:32
int_div: dest:i src1:i src2:i len:80
int_div_un: dest:i src1:i src2:i len:32
int_rem: dest:i src1:i src2:i len:32
int_rem: dest:i src1:i src2:i len:80
int_rem_un: dest:i src1:i src2:i len:32

i8const: dest:i len:16
long_add: dest:i src1:i src2:i len:4
long_sub: dest:i src1:i src2:i len:4
long_mul: dest:i src1:i src2:i len:4
long_div: dest:i src1:i src2:i len:32
long_div: dest:i src1:i src2:i len:80
long_div_un: dest:i src1:i src2:i len:32
long_rem: dest:i src1:i src2:i len:32
long_rem: dest:i src1:i src2:i len:80
long_rem_un: dest:i src1:i src2:i len:32

r8const: dest:f len:16
Expand Down
5 changes: 5 additions & 0 deletions src/mono/mono/mini/method-to-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -8930,6 +8930,11 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
ins->sreg2 = sp [1]->dreg;
type_from_op (cfg, ins, sp [0], sp [1]);
CHECK_TYPE (ins);

if (((sp [0]->type == STACK_R4 && sp [1]->type == STACK_R8) ||
(sp [0]->type == STACK_R8 && sp [1]->type == STACK_R4)))
add_widen_op (cfg, ins, &sp [0], &sp [1]);

ins->dreg = alloc_dreg ((cfg), (MonoStackType)(ins)->type);

/* Use the immediate opcodes if possible */
Expand Down
Loading

0 comments on commit 1632e47

Please sign in to comment.