Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Commit

Permalink
Fix RV32 gen_opi_immediate default case
Browse files Browse the repository at this point in the history
This manifested itself through broken multiplication when the RHS was an immediate.
  • Loading branch information
duk-37 committed Jun 11, 2023
1 parent 28335d2 commit bb6de25
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions riscv32-gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,13 @@ static int gen_opi_immediate( int op, int fc, int ll )
vset_VT_CMP( op );
vtop->cmp_r = a | 0 << 8;
return 0;
default:
/*
default case means we have to bail, since otherwise we're pretending we handled it properly
as an example, '*' will hit this if RHS is an immediate since RV32M doesn't have MULI,
so we used to just... not actually compile a multiplication instruction in at all
*/
return 1;
}

// push the value to the stack (general case)
Expand Down

0 comments on commit bb6de25

Please sign in to comment.