@@ -44,6 +44,38 @@ pub fn translate(riscv_instr: RiscVInstruction) -> Vec<ArmInstruction> {
4444 target: map_val( target, & width) ,
4545 }
4646 } ] ,
47+ RiscVInstruction :: Bge { arg1, arg2, target } => vec ! [ {
48+ let width = RiscVWidth :: Double ;
49+ ArmInstruction :: Bge {
50+ arg1: map_register( arg1, & width) ,
51+ arg2: map_register( arg2, & width) ,
52+ target: map_val( target, & width) ,
53+ }
54+ } ] ,
55+ RiscVInstruction :: Blt { arg1, arg2, target } => vec ! [ {
56+ let width = RiscVWidth :: Double ;
57+ ArmInstruction :: Blt {
58+ arg1: map_register( arg1, & width) ,
59+ arg2: map_register( arg2, & width) ,
60+ target: map_val( target, & width) ,
61+ }
62+ } ] ,
63+ RiscVInstruction :: Bgt { arg1, arg2, target } => vec ! [ {
64+ let width = RiscVWidth :: Double ;
65+ ArmInstruction :: Bgt {
66+ arg1: map_register( arg1, & width) ,
67+ arg2: map_register( arg2, & width) ,
68+ target: map_val( target, & width) ,
69+ }
70+ } ] ,
71+ RiscVInstruction :: Bne { arg1, arg2, target } => vec ! [ {
72+ let width = RiscVWidth :: Double ;
73+ ArmInstruction :: Bne {
74+ arg1: map_register( arg1, & width) ,
75+ arg2: map_register( arg2, & width) ,
76+ target: map_val( target, & width) ,
77+ }
78+ } ] ,
4779 RiscVInstruction :: J { target } => vec ! [ ArmInstruction :: B {
4880 target: map_val( target, & RiscVWidth :: Double ) ,
4981 } ] ,
@@ -52,6 +84,14 @@ pub fn translate(riscv_instr: RiscVInstruction) -> Vec<ArmInstruction> {
5284 src: map_register( src, & width) ,
5385 dest: map_val( dest, & width) ,
5486 } ] ,
87+ RiscVInstruction :: Slli { dest, src, imm } => {
88+ let width = RiscVWidth :: Double ;
89+ vec ! [ ArmInstruction :: Lsl {
90+ dest: map_register( dest, & width) ,
91+ src: map_register( src, & width) ,
92+ imm: imm
93+ } ]
94+ } ,
5595 RiscVInstruction :: L { width, dest, src } => vec ! [ ArmInstruction :: Ldr {
5696 width: map_width( & width) ,
5797 dest: map_register( dest, & width) ,
@@ -101,7 +141,55 @@ pub fn translate(riscv_instr: RiscVInstruction) -> Vec<ArmInstruction> {
101141 name: map_register_name( arg2) ,
102142 } ) ,
103143 } ] ,
104- RiscVWidth :: Double => sorry ! ( ) ,
144+ RiscVWidth :: Double => vec ! [ ArmInstruction :: Add {
145+ dest: ArmRegister {
146+ width: ArmWidth :: Double ,
147+ name: map_register_name( dest) ,
148+ } ,
149+ arg1: ArmRegister {
150+ width: ArmWidth :: Double ,
151+ name: map_register_name( arg1) ,
152+ } ,
153+ arg2: ArmVal :: Reg ( ArmRegister {
154+ width: ArmWidth :: Double ,
155+ name: map_register_name( arg2) ,
156+ } ) ,
157+ } ] ,
158+ } ,
159+ RiscVInstruction :: Sub {
160+ width,
161+ dest,
162+ arg1,
163+ arg2,
164+ } => match width {
165+ RiscVWidth :: Word => vec ! [ ArmInstruction :: Sub {
166+ dest: ArmRegister {
167+ width: ArmWidth :: Word ,
168+ name: map_register_name( dest) ,
169+ } ,
170+ arg1: ArmRegister {
171+ width: ArmWidth :: Word ,
172+ name: map_register_name( arg1) ,
173+ } ,
174+ arg2: ArmVal :: Reg ( ArmRegister {
175+ width: ArmWidth :: Word ,
176+ name: map_register_name( arg2) ,
177+ } ) ,
178+ } ] ,
179+ RiscVWidth :: Double => vec ! [ ArmInstruction :: Sub {
180+ dest: ArmRegister {
181+ width: ArmWidth :: Double ,
182+ name: map_register_name( dest) ,
183+ } ,
184+ arg1: ArmRegister {
185+ width: ArmWidth :: Double ,
186+ name: map_register_name( arg1) ,
187+ } ,
188+ arg2: ArmVal :: Reg ( ArmRegister {
189+ width: ArmWidth :: Double ,
190+ name: map_register_name( arg2) ,
191+ } ) ,
192+ } ] ,
105193 } ,
106194 RiscVInstruction :: SextW { dest, src } => vec ! [ ArmInstruction :: Sxtw {
107195 dest: ArmRegister {
0 commit comments